The MASM Forum

Projects => Easy Code IDE 32/64-bit => Topic started by: K_F on January 12, 2014, 09:08:23 PM

Title: Strange window popping up in Toolbar button 9
Post by: K_F on January 12, 2014, 09:08:23 PM
Hi Ramon.. here's another to keep you busy  :P

On every toolbar I make, Button-9 comes up with this window (see attached pic)
There is no code written yet.. just the imagelist created and applied to the toolbar.

I can shift the images up one position to even buttons then there's no problem... but Button-9 is interesting.
:biggrin:
Title: Re: Strange window popping up in Toolbar button 9
Post by: rsala on January 14, 2014, 09:57:22 AM
Hi K_F,

Thanks for the picture. I will have a look.

Ramon
Title: Re: Strange window popping up in Toolbar button 9
Post by: K_F on January 17, 2014, 08:21:23 AM
Ramon.. I'm starting to think that there are compatibility problems/differences between Win7 Pro and Win XP SP3.

I'm 'developing' between my PC (win7 Pro) and Laptop (XP-SP3) and don't get the problems on my laptop.
I'm transferring the code via a memory stick between the two PC's so it's not a code problem.

I'm starting to think Win 7 is screwing us around with anomalies.. I'm the sucker for the punishment

:biggrin:
Title: Re: Strange window popping up in Toolbar button 9
Post by: rsala on January 18, 2014, 12:41:08 AM
Hi Van,

Yes, I've also noticed some different behaviour between Win7 and WinXP. I usually develop on Win 7, when everything runs fine I test the same code on Win XP (SP-3) and sometimes there are slight (or not so slight) differences.

Ramon
Title: Re: Strange window popping up in Toolbar button 9
Post by: K_F on January 19, 2014, 12:14:58 AM
Here's the skeleton
Title: Re: Strange window popping up in Toolbar button 9
Post by: rsala on January 19, 2014, 07:21:45 AM
Hi,

Thank you very much! I'll see what I can do.

Ramon

Title: Re: Strange window popping up in Toolbar button 9
Post by: rsala on January 19, 2014, 10:19:05 PM
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
Title: Re: Strange window popping up in Toolbar button 9
Post by: K_F on January 21, 2014, 05:18:51 AM
Thanks Ramon.. I'll do this
:t