Hi,

What's the non-MFC way of doing AfxSetResourceHandle(hDLL);
Not even sure the above is CE API, it's Win32 API.

Basically I want to provide alternative DLL for my application to fetch its
resources from, like dialbog boxes, menus, icons, string tables, etc, for
multi-lang purposes.

Lisa

Re: AfxSetResourceHandle(hDLL); by Norman

Norman
Mon Jun 18 19:17:00 CDT 2007

You have to call LoadLibrary yourself, keep the hinstance in a member
variable, and use the hinstance in your resource loading calls.

"Lisa Pearlson" <no@spam.plz> wrote in message
news:OzY7EnesHHA.4788@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> What's the non-MFC way of doing AfxSetResourceHandle(hDLL);
> Not even sure the above is CE API, it's Win32 API.
>
> Basically I want to provide alternative DLL for my application to fetch
> its resources from, like dialbog boxes, menus, icons, string tables, etc,
> for multi-lang purposes.
>
> Lisa
>


Re: AfxSetResourceHandle(hDLL); by Paul

Paul
Mon Jun 18 19:20:01 CDT 2007

You should use MUI for retrieving localized resources from different dlls.

http://msdn2.microsoft.com/en-us/library/aa454477.aspx
http://msdn2.microsoft.com/en-us/library/ms881385.aspx

Paul Monson
Intrinsyc


Lisa Pearlson wrote:
> Hi,
>
> What's the non-MFC way of doing AfxSetResourceHandle(hDLL);
> Not even sure the above is CE API, it's Win32 API.
>
> Basically I want to provide alternative DLL for my application to fetch its
> resources from, like dialbog boxes, menus, icons, string tables, etc, for
> multi-lang purposes.
>
> Lisa
>
>

Re: AfxSetResourceHandle(hDLL); by Mihai

Mihai
Tue Jun 19 01:58:12 CDT 2007

> You should use MUI for retrieving localized resources from different dlls.
The MUI API is only available in Vista, and as a backport library on XP
(but the library's behavior is not not quite compatible with the Vista one)

But there is nothing for mobile. You will have to do your own thing
(LoadLibrary and use the handle to retrieve resources, as Norman advised)


--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

Re: AfxSetResourceHandle(hDLL); by ctacke/>

ctacke/>
Tue Jun 19 09:35:02 CDT 2007

Not to be argumentative, but MUI is most certainly supported in CE since at
least 5.0:

http://msdn2.microsoft.com/en-us/library/ms904030.aspx


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


"Mihai N." <nmihai_year_2000@yahoo.com> wrote in message
news:Xns9953F3D6EB7D0MihaiN@207.46.248.16...
>> You should use MUI for retrieving localized resources from different
>> dlls.
> The MUI API is only available in Vista, and as a backport library on XP
> (but the library's behavior is not not quite compatible with the Vista
> one)
>
> But there is nothing for mobile. You will have to do your own thing
> (LoadLibrary and use the handle to retrieve resources, as Norman advised)
>
>
> --
> Mihai Nita [Microsoft MVP, Windows - SDK]
> http://www.mihai-nita.net
> ------------------------------------------
> Replace _year_ with _ to get the real email



Re: AfxSetResourceHandle(hDLL); by Norman

Norman
Tue Jun 19 19:10:47 CDT 2007

http://msdn2.microsoft.com/en-us/library/ms903947.aspx
> Platform Builder for Microsoft Windows CE 5.0
> MUI Resource DLLs
> For an application to support a multiple-language UI, you must create a
> per-language DLL that contains only localizable resources.

That sounds familiar.

> Do not create a DLL for the system-default language. Localizable resources
> for the system-default language remain in the executable.

Oops. Oh no. Since the user can change the system-default language at will
(on Smartphone if not on Pocket PC), I'm in big trouble. My executable
contains localizable resources for the application-default language which
the customer specified. I changed the localizable resources in the
executable when the customer changed their specification for what the
application-default language would be, but I don't change them every time
the user changes their system-default language. I load satellite DLLs for
languages other than the application-default language, and one of them might
be the system-default language. Oh no, big trouble here. I wonder how to
solve this.

> Your application can call EnumUILanguages to determine which languages are
> supported,

That sounds familiar.

> and therefore decide which resource DLLs to install.

Oh no. Well, this one isn't too bad. Sometimes DLLs might be installed
which can't be used, because they get installed before my application runs,
they get installed before my application can call EnumUILanguages... Well,
this might waste a bit of space in ROM, but at least this isn't a serious
problem.

> To load and get the DLL handle for a language, call LoadLibraryEx.
> Thereafter, this handle is used in all calls to load resources.

That sounds familiar. I wonder where I saw that mentioned recently.


"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:eA3rH8nsHHA.2268@TK2MSFTNGP05.phx.gbl...
> Not to be argumentative, but MUI is most certainly supported in CE since
> at least 5.0:
>
> http://msdn2.microsoft.com/en-us/library/ms904030.aspx
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Managed Code in an Embedded World
> www.OpenNETCF.com
>
>
> "Mihai N." <nmihai_year_2000@yahoo.com> wrote in message
> news:Xns9953F3D6EB7D0MihaiN@207.46.248.16...
>>> You should use MUI for retrieving localized resources from different
>>> dlls.
>> The MUI API is only available in Vista, and as a backport library on XP
>> (but the library's behavior is not not quite compatible with the Vista
>> one)
>>
>> But there is nothing for mobile. You will have to do your own thing
>> (LoadLibrary and use the handle to retrieve resources, as Norman advised)
>>
>>
>> --
>> Mihai Nita [Microsoft MVP, Windows - SDK]
>> http://www.mihai-nita.net
>> ------------------------------------------
>> Replace _year_ with _ to get the real email
>
>


Re: AfxSetResourceHandle(hDLL); by Mihai

Mihai
Wed Jun 20 03:01:52 CDT 2007

> Not to be argumentative, but MUI is most certainly supported in CE since at
> least 5.0:
>
> http://msdn2.microsoft.com/en-us/library/ms904030.aspx

You are right, but that only explains how to do your own MUI thing.

"To load and get the DLL handle for a language, call LoadLibraryEx.
Thereafter, this handle is used in all calls to load resources."
(http://msdn2.microsoft.com/en-us/library/ms903947.aspx)

This is what Norman (and I) where saying.
The technique itself is old (the Win 2000 MUI was implemented that
way), and it is "best practice" for a long time now.

But the public API is new.
This is the API I was talking about:
http://msdn2.microsoft.com/en-us/library/ms776204.aspx

The MUI API (LoadMUILibrary, FreeMUILibrary, GetFileMUIInfo,
GetFileMUIPath) and the languages (plural) preferences
(GetSystemPreferredUILanguages, GetThreadPreferredUILanguages,
GetUserPreferredUILanguages, SetThreadPreferredUILanguages)
are new to Vista and not available on CE.

So, we are both right: MUI is supported on CE, but MUI API is not :-)

--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

Re: AfxSetResourceHandle(hDLL); by Mihai

Mihai
Wed Jun 20 03:09:52 CDT 2007

> This is the API I was talking about:

Compare this:
http://msdn2.microsoft.com/en-us/library/ms906479.aspx
to this:
http://msdn2.microsoft.com/en-us/library/ms776204.aspx



--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email