HINSTANCE hInstance;
HWND hWindow;
hWindow = CreateWindowEx(0, //more or
'extended' styles
TEXT("ERR"), //the 'class'
of window to create
TEXT("Simple Window"), //the window
title
WS_OVERLAPPEDWINDOW, //window
style: how it looks
GetSystemMetrics(SM_CXSCREEN)/4, //window
position: left
GetSystemMetrics(SM_CYSCREEN)/4, //window
position: top
GetSystemMetrics(SM_CXSCREEN)/2, //window
width
GetSystemMetrics(SM_CYSCREEN)/2, //window
height
NULL, //parent
window handle
NULL, //handle to
this windows's menu
hInstance, //application
instance
NULL); //user
defined information
if (!hWindow)
dialogBox("Failed to create wnd");
ShowWindow(hWindow, 1);
UpdateWindow(hWindow);
/Michael
"Michael Gade" <mgn5...@stud.auc.dk> wrote in message
news:3d614eae$0$94829$edfa...@dspool01.news.tele.dk...
If you want to get the HINSTANCE for the current process (the .exe
that started the program), you have two choices:
a) Keep the value passed to WinMain
b) Call GetModuleHandle, and pass NULL as the argument. The
documentation for the function says it returns an HMODULE, but I
believe the values are the same (so a cast will work).
If you want to get the HINSTANCE for the DLL, you have three choices:
a) Keep the value passed to DllMain
b) Keep the value returned by LoadLibrary
c) Call LoadLibrary to get the return value, then call FreeLibrary
I've never used the last method, so I can 't vouch directly. But it
makes sense.
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret
PenFact, Inc.
46 Beach Street
Boston, MA 02111
www.penfact.com