English - United States  


Usenet Posting #32 - Trigeminal Software, Inc. (English)

Subject: MSLU Sample!
(Originally posted 10/11/01)

If you are using the Microsoft Layer for Unicode on Windows 95/98/Me Systems (MSLU) you might want a sample C/C++ project that you can look at to see how things work. This is just such a sample!

Steps to take the OCLIENT sample from MSDN and convert it to use MSLU. First grab the OCLIENT project files, available in MSDN:

OCLIENT project download

Note that I am not providing the actual sample, I am giving the steps I used to integrate MSLU and the one source file that shows how to do things like function overrides and the MSLU loader override.

Here are the steps I used for the conversion:

  1. Project Settings (you can select both Unicode projects (UniDebug and UniRel) or do them one at a time, makes no difference):

        General: Microsoft Foundation Classes --> Use MFC in a Static Library

  2. Link: Replace the "Object/library modules" line that is there with the following:

    /nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib 
    /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib 
    /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib unicows.lib kernel32.lib gdi32.lib 
    user32.lib ole32.lib oleaut32.lib oledlg.lib shell32.lib uuid.lib comctl32.lib comdlg32.lib 
    advapi32.lib winspool.lib 
  3. Add the attached file mslu.cpp to the project, which includes the following functions:

    • LoadMSLU --> overrides the MSLU Loader, reading the location from the registry value MsluLocation from the regkey "Software\\My Company", on failure it exits -- this avoids the nasty crash bug that occurs in MFC if all string functions start failing (idea inspired by Rick Cameron -- thanks, Rick!).

    • UserOleUIAddVerbMenuW --> Overrides the MSLU stub function OleUIAddVerbMenuW

    • UserOleUIInsertObjectW --> Overrides the MSLU stub function OleUIInsertObjectW

And now, you're done!


Problems with this site? Please contact the webmaster@trigeminal.com
with your comments, questions, or suggestions.