News:

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

Main Menu

Strange window popping up in Toolbar button 9

Started by K_F, January 12, 2014, 09:08:23 PM

Previous topic - Next topic

K_F

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:
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

rsala

Hi K_F,

Thanks for the picture. I will have a look.

Ramon
EC coder

K_F

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:
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

rsala

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
EC coder

K_F

'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

rsala

Hi,

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

Ramon

EC coder

rsala

#6
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
EC coder

K_F

'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'