15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Localizing OLE controls using AmbientLocaleID

Kristoffer -- gjevre@filenet.com
Wednesday, March 05, 1997

Environment: VC++ 4.2b Win NT 4.0

The PROBLEM is that in VB 4.0 and VB 5.0 the LocaleID returned is always 
English.

I have an OLE Control written in VC++/MFC 4.2b on Win NT 4.0 that does the 
following to determine what version of the localized resources to use (this 
is loosely based on the "VC++ Books, MFC 4.2, Programming with MFC: 
Encyclopedia, OLE Controls , OLE Controls: Localizing an OLE Control" 
document):

void CMyLocCtrl::OnSetClientSite()
{
	COleControl::OnSetClientSite();
	LCID lcid = AmbientLocaleID();
	// Get resources based on LCID is not shown.
}

void CMyLocCtrl::OnAmbientPropertyChange(DISPID dispid)
{
	if (dispid == DISPID_AMBIENT_LOCALEID)
	{
		LCID lcid = AmbientLocaleID();
	// Get resources based on LCID is not shown.
		InvalidateControl();
	}
}
void CMyLocPropPage::OnSetPageSite()
{
	LCID lcid = 0;
	LPPROPERTYPAGESITE pSite = GetPageSite();
	if (pSite != NULL)
		pSite->GetLocaleID(&lcid);
	COlePropertyPage::OnSetPageSite();
}

The LocaleID returned when the control is used in the VC++ OLE Control Test 
Container matches the Regional Settings.  The ambient LocaleID can also be 
changed in the OLE Control Test Container, and the control reacts correctly 
to it.  (The only annoyance is that CMyLocCtrl::OnSetClientSite gets called 
initially and when we exit, in which case AmbientLocaleID returns 0).
The PROBLEM is that in VB 4.0 and VB 5.0 the LocaleID returned is always 
English.  I have tried this on both Win 95 and Win NT, and it happens in 
design mode when I drop the control in, in debug mode, and when running the 
VB EXE.

Am I missing something here?
Kristoffer Gjevre
gjevre@filenet.com




Mike Blaszczak -- mikeblas@nwlink.com
Thursday, March 06, 1997

At 12:18 3/5/97 -0800, "Gjevre, Kristoffer"  wrote:
>Environment: VC++ 4.2b Win NT 4.0

>The PROBLEM is that in VB 4.0 and VB 5.0 the LocaleID returned is always 
>English.

> [...]

>The PROBLEM is that in VB 4.0 and VB 5.0 the LocaleID returned is always 
>English.  I have tried this on both Win 95 and Win NT, and it happens in 
>design mode when I drop the control in, in debug mode, and when running the 
>VB EXE.

It seems then that this is "PROBLEM" actually with VB and not MFC. Doesn't it?




.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
           This performance was not lip-synched.





Become an MFC-L member | Вернуться в корень Архива |