News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Rebar Window fails to create | invalid handle

Started by xandaz, November 01, 2020, 03:49:57 AM

Previous topic - Next topic

xandaz

   hey guys. I was making a ReBar Controls but Olly gives invalid handle. Can Someone help.Thanks in advance,
.elseif uMsg==WM_CREATE
        mov     edi,lParam
        .if     [edi.CREATESTRUCT.hwndParent]==0
                invoke CreateWindowEx,0,addr ReBarClass,addr ReBarName\
                ,WS_VISIBLE+WS_CHILD+RBS_AUTOSIZE+RBS_VERTICALGRIPPER,\
                0,0,MainWindowWidth-10,40,hWnd,0,hInstance,0
                mov     hReBar,eax
       .endif 

Biterider

Hi
Use GetLastError to get an indication of what is going wrong.
I suspect the class name is wrong. It should be "ReBarWindow32".

Regards, Biterider

jj2007

Quote from: xandaz on November 01, 2020, 03:49:57 AMOlly gives invalid handle

CreateWindowEx may return an error code, but it is valid only if eax==0. Have you checked that? Did you call InitCommonControls before creating the Rebar?


xandaz

  it gives invalid_handle_value. ClassName is correct

Biterider

Hi
"it gives invalid_handle_value."
The 9th parameter of CreateWindowEx should be the parent window. What is hWnd in your implementation?

Biterider

xandaz


xandaz

   Call to GetLastError gives the same ERROR_INVLID_HANDLE

xandaz


xandaz

   Is it possible it is a valid handle value?

Biterider

Hi
That is OK, ERROR_INVLID_HANDLE = 6.
If the returned value from CreateWindowEx is zero, check the GetLastError value before and after the invocation. This is to make sure that the error value is set.
Check the hWnd value, maybe using it for another call (ShowWindow). Use the debugger to look into the parameters and verify the requirements listed here https://docs.microsoft.com/en-us/windows/win32/controls/create-rebar-controls

Biterider

xandaz


xandaz

   Works fine with another function... it's one of those things that are before my eyes and i can't see it. thanks a lot

xandaz

    Shouldn't hWnd be valid for WM_CREATE message?

xandaz

   Don't know what's happening. Tried to creater a Button and hWnd works fine.

HSE

Hi!

Have you loaded ICC_COOL_CLASSES in InitCommonControlsEx?
Equations in Assembly: SmplMath