Another win32 problem

The problem with creating a child window with C ++ and win32 api. If I test the getLastError function, returning it is "87", but I don't know what that means. For what I know, my code is error-free, can someone take a look at my code and help me figure out what is wrong with it.

(This is under the WinProc WM_CREATE section.)

        HWND hChildWindow   =   CreateWindowEx(WS_EX_CLIENTEDGE,0,NULL,WS_OVERLAPPEDWINDOW|WS_VISIBLE,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,hwnd,0,GetModuleHandle(0),NULL);
    if(!hChildWindow)
    {
         char text[256];
             int errormsg = (int)GetLastError();
             sprintf(text,"Error# %i",errormsg);
             MessageBox(0,text,"Error",MB_OK|MB_ICONEXCLAMATION);   
         return false;
    }
+3
source share
3 answers

87 = Invalid parameter - remember that you can use FormatMessage to get a string message from the error code.

+2
source

CreateWindowEx - ( ATOM). , NULL .

P.S.

, ...

. - , . - -, . /// .. - .

+2

A quick look at the System Error Codes code indicates ERROR_INVALID_PARAMETER. Most likely, you will pass an invalid combination of styles / flags to your window.

+1
source

Source: https://habr.com/ru/post/1777166/


All Articles