Hi Van,
Thanks again for the skeleton! I can see the problem now and I think it is due to a strange Windows behaviour although I do not know why it happens.
Windows has some default functions that should be invoked for non-processed messages. For example, a standard window calls DefWindowProc while an MDI window should call DefFrameProc. That is what the Easy Code visual libraries internally do when the message is not processed (that is, when the return value is FALSE). The problem appears when DefFrameProc is called for the WM_COMMAND message (sent by a tool bar) and wParam (which is the number of the pushed button) is 9. Windows makes the "Select Window" to appear, not Easy Code, and I have no idea why that happens.
At the moment, you can solve the problem by doing the following:
.Const
.Data?
hWndToolBar HWND ?
.Data
.Code
;-----------------------------------------------------------------------------
;
;-----------------------------------------------------------------------------
mdi_LootMDIProcedure Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
.If uMsg == WM_CREATE
;Save the handle for the Toolbar control
Invoke GetWindowItem, hWnd, IDC_MDI_LOOTMDI_TB_LOOTMDI
Mov hWndToolBar, Eax
.ElseIf uMsg == WM_COMMAND
;lParam = Handle for the control sending the message
;wParam = For a Toolbar control, number of the pushed button
Mov Eax, lParam
.If Eax == hWndToolBar
.If wParam == 1
;Do something for button 1
.ElseIf wParam == 3
;Do something for button 3
.ElseIf wParam == 5
;Do something for button 5
.ElseIf wParam == 7
;Do something for button 7
.ElseIf wParam == 9
;Do something for button 9
...
...
.EndIf
Return TRUE ;For no further processing
.EndIf
.EndIf
Xor Eax, Eax ;Return FALSE
Ret
mdi_LootMDIProcedure EndP
Returning TRUE for the WM_COMMAND message when it is sent for a Toolbar control, avoids the mysterious "Select Window" to appear. However, for next versions of Easy Code, I will try to find the way for the IDE to take care of this issue.
Thanks for your help!
Regards,
Ramon