Author Topic: Strange window popping up in Toolbar button 9  (Read 3914 times)

K_F

  • Member
  • *****
  • Posts: 1418
  • Anybody out there?
Strange window popping up in Toolbar button 9
« 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:
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

rsala

  • Moderator
  • Member
  • *****
  • Posts: 285
    • Easy Code
Re: Strange window popping up in Toolbar button 9
« Reply #1 on: January 14, 2014, 09:57:22 AM »
Hi K_F,

Thanks for the picture. I will have a look.

Ramon
EC coder

K_F

  • Member
  • *****
  • Posts: 1418
  • Anybody out there?
Re: Strange window popping up in Toolbar button 9
« Reply #2 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:
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

rsala

  • Moderator
  • Member
  • *****
  • Posts: 285
    • Easy Code
Re: Strange window popping up in Toolbar button 9
« Reply #3 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
EC coder

K_F

  • Member
  • *****
  • Posts: 1418
  • Anybody out there?
Re: Strange window popping up in Toolbar button 9
« Reply #4 on: January 19, 2014, 12:14:58 AM »
Here's the skeleton
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

rsala

  • Moderator
  • Member
  • *****
  • Posts: 285
    • Easy Code
Re: Strange window popping up in Toolbar button 9
« Reply #5 on: January 19, 2014, 07:21:45 AM »
Hi,

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

Ramon

EC coder

rsala

  • Moderator
  • Member
  • *****
  • Posts: 285
    • Easy Code
Re: Strange window popping up in Toolbar button 9
« Reply #6 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
« Last Edit: January 21, 2014, 01:25:02 AM by rsala »
EC coder

K_F

  • Member
  • *****
  • Posts: 1418
  • Anybody out there?
Re: Strange window popping up in Toolbar button 9
« Reply #7 on: January 21, 2014, 05:18:51 AM »
Thanks Ramon.. I'll do this
 :t
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'