instance problem in CreateWindowEx{A,W,16}

Peter Oberndorfer kumbayo84 at
Sat Dec 27 12:39:24 CST 2003

Trying to run PEview.exe i found a problem.

First i create a window with  CreateWindowEx and pass 0 as instance.
When trying to read the instance with GetWindowLong(hWnd,GWL_HINSTANCE)
# Wine returns 0 as passed to the function.
# Win 98 returns 0x400000 which is what GetModuleHandle( NULL ) gives me.

For the CreateWindowEx{A,W} it can easily be fixed by adding this two 
lines at the beginning of the function:

    if (instance == 0)
        instance = GetModuleHandleW( NULL );

But For CreateWindowEx16 i'm not sure how to check.
But i had a look at  some code in class.c, where similar checks are 
performed and constructed following:

    if (!HINSTANCE_32(instance))
        instance = HINSTANCE_32(GetModuleHandle16(NULL));

So does the code for CreateWindowEx16 look right?

Greetings Peter

More information about the wine-devel mailing list