The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: newAsm on July 13, 2009, 04:11:19 AM

Title: SS_Notify on Vista & XP
Post by: newAsm on July 13, 2009, 04:11:19 AM
Hi,

I wrote a project using Masm32, ProStart in QEditor. I created label controls using SS_Notify. After I had compiled and link, the .exe file would work on my XP computer. If I compile and link in another computer which is using Vista OS, the same .exe would not run.

What I actually wanted to do was detect the label controls being double-clicked. Why should such problem exists? I spent a week, troubleshooting running in Vista until I moved it to XP and found it working.

Another problem I had was getting Windbg to run. Even after I had installed the symbols in C:\Windows\Symbols, or to use http:\\.../download, Windbg can not load the symbol files. Is there any other way?

Appreciate any comments...newAsm.

[attachment deleted by admin]
Title: Re: SS_Notify on Vista & XP
Post by: ToutEnMasm on July 13, 2009, 07:56:09 AM

The ml option  "/Zd Add line number debug info" is missing.
This made that the debugger couldn't follow your source code.
Title: Re: SS_Notify on Vista & XP
Post by: sinsi on July 13, 2009, 08:25:48 AM
windbg - set an environment -
_NT_SYMBOL_PATH=srv*c:\windows\symbols*http://msdl.microsoft.com/download/symbols;cache*c:\windows\symbols

Where do you make your labels? The ones that I can see are all magic numbers for the style (50000000h) when SS_NOTIFY is 0100h. Too many files to look through...
Title: Re: SS_Notify on Vista & XP
Post by: ToutEnMasm on July 13, 2009, 09:03:30 AM

The SS_NOTIFY style send messages threw a WM_NOTIFY message and i don't see one in your source code (i have searched any .asm and any .inc) .Where is it ?.
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 15, 2009, 06:02:28 AM
Hi ToutEnMasm & Sinsi,
Thanks for your reply. The file containing all the controls are in uChipfrm.asm. The setup_form routine create the controls. Line 204-208, 214-18, 224-228, 234-238, 282-285etc.

In line 282, the SS_NOTIFY is written into the style - code 0x50000101h, where the 2nd byte 01 contains the SS_NOTIFY style.

I will try out the /Zd option.

Thanks..GS

Title: Re: SS_Notify on Vista & XP
Post by: sinsi on July 15, 2009, 06:34:04 AM
In your WndProc you have

.elseif edx == STN_DBLCLK
   push ax ; save ID

I can't find a 'pop ax', but there is this later

pop eax ; EDX = control ID


I don't think you should be pushing words onto the stack, it mis-aligns it.
Title: Re: SS_Notify on Vista & XP
Post by: ToutEnMasm on July 15, 2009, 06:44:25 AM
correct way to treat Static control with SS_NOTIFY style

Quote
   .elseif uMsg == WM_COMMAND
      HIWORD wParam      ;events of controls are here
      mov edx,eax      ;exemple :TCN_SELCHANGE
      LOWORD wParam      ;Id of controls
      mov ebx,lParam   ; handle of control
      ;suite   
;SS_NOTIFY Sends the parent window
;           STN_CLICKED, STN_DBLCLK, STN_DISABLE, and STN_ENABLE       
      .if edx ==  STN_CLICKED
      .endif
Title: Re: SS_Notify on Vista & XP
Post by: sinsi on July 15, 2009, 07:23:35 AM
ToutEnMasm, SS_NOTIFY comes from WM_COMMAND
Quote from: SDKThe STN_DBLCLK notification message is sent when the user double-clicks a static control that has the SS_NOTIFY style. The parent window of the control receives this notification message through the WM_COMMAND message.
Title: Re: SS_Notify on Vista & XP
Post by: ToutEnMasm on July 15, 2009, 09:32:04 AM
unusual way for a notify message,I have correct this.
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 16, 2009, 12:50:22 PM
Hi sinsi & ToutEnMasm,

I found my bugs and with thanks to you I managed to get Windbg working. With Windbg, I found that the ID was corrupted.

I have one more thing I need to do: how to change the colour of the static control? When the user entered the wrong information, it would be highlighted, blink a few times and then reset to its previous background colour.

I am aware that you use WM_CTLCOLORSTATIC to change. What I am interested is the mechanism to do it. Is it possible for you to enlighten mehow to go about doing it? I have written some of the code for WM_CTLCOLORSTATIC but at a loss how to do it - the code is in uChipCimu.asm starting from line 426.

Appreciate your help and THANK YOU. The working code is attached for your 'fun'.

[attachment deleted by admin]
Title: Re: SS_Notify on Vista & XP
Post by: sinsi on July 16, 2009, 01:01:04 PM
WM_CTLCOLORSTATIC
Quote from: MSDNIf an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control.
So in WM_CREATE, make your 'brushes' then return the right brush handle in the WM_CTLCOLORSTATIC code.
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 17, 2009, 02:39:23 AM
Thanks sinsi for the step,

The solid brush, would I need one for default and one for the colour I intend to use in WM_CREATE? I have done that for yellow colour but not sure of the default, or there is no need for me to do it since it's already a default?

I have a strategy worked out. I would have to use WM_Timer to do my colour blink but I need to get the colour transition change correct.

I will try it out and see the outcome.

Thanks again..newAsm
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 24, 2009, 10:09:57 AM
Hi Sinsi & ToutEnMasm,

I tried it out but I could not get either button or the static control to change colour. You need to press the [Start Game] button -> [Click Next Instruction]. The button will change colour. I used InvalidateRect to redraw the window.

I first tried in WM_CTLCOLORBTN

            invoke SetTextColor,wParam,00F0F0F0h    ; 00BBGGRR
       invoke SetBkMode,wParam,TRANSPARENT
       invoke GetStockObject,BLACK_BRUSH
           ret

to change the text colour, but nothing happened and then I returned

         mov      eax,[YellowBrush]
                        ret

which was a handle for a yellow colour and still nothing happened.

What did I missed out? Appreciate your comment.

Thanks..newAsm

Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 24, 2009, 10:32:31 AM
Hi,

I forgot to attach the files..newAsm

[attachment deleted by admin]
Title: Re: SS_Notify on Vista & XP
Post by: sinsi on July 25, 2009, 11:36:10 AM
I'm not sure what you are doing (your source is pretty big :bg) but here is what I did to see about coloured static controls. Maybe this can help.

edit: replace 'include \asm\win32.inc' with 'include \masm32\include\masm32rt.inc'. Sorry.

[attachment deleted by admin]
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 27, 2009, 03:42:48 AM
Hi Sinsi,

I cannot assemble your code. I am using Masm32 (Hutch's version). You created the colour brushes in WM_CREATE as well (same as what I did). When I changed windows.inc to masm32rt.inc no colour change was seen.

I know, I know that I might have done something wrong. In CTLCOLORBTN, I returned one of the handle for the colour brush (same as what you did), and no colour change was seen.

I need to relook at my codes again.

Thanks for your help and it is frustrating to come to this point and it does not respond to what it is suppose to do. I have to find out where I did wrong.

...newAsm
Title: Re: SS_Notify on Vista & XP
Post by: sinsi on July 27, 2009, 04:07:25 AM
I changed my include line and it wouldn't build either  :red
Try this one - it includes the exe. I'm running it in win7 64-bit and it works ok.

[attachment deleted by admin]
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 29, 2009, 12:54:39 AM
Thanks Sinsi,

Your example helped me sort out the static control and the colour is now working. Does the same rule works for button? Can I use WM_CTLCOLORBTN to change the button colour? From Win32Hlp, it sounds the same. So far, I have also not being able to get the button colour change working. I am happy that the static control is working but it would be perfect if I can change the button colours as well. Thanks a lot for your time and example.

..newAsm
Title: Re: SS_Notify on Vista & XP
Post by: sinsi on July 29, 2009, 01:06:14 PM
I see no reason why buttons wouldn't work the same way. If you process CTLCOLORx you return a brush and windows uses it.
The thing to watch is where you trigger it and what triggers it.
Title: Re: SS_Notify on Vista & XP
Post by: ToutEnMasm on July 29, 2009, 02:19:44 PM
WM_CTLCOLORBTN will be useful here to change the color of the  OWNER DRAWN bottom
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 30, 2009, 12:23:06 PM
Thanks ToutEnMasm & Sinsi,

The static control now works. I am struggling with CTLCOLORBTN. It could my programming. I will recheck it. You can play with it now. Double click on uChipCimu.exe

Click on the [Start Game] and then click the first line on the RHS checkbox, and then click [Accept Changes]. The bit(s) that are wrong will be indicated by red. I am trying still to get the button to change colours for [Next Instruction] and [Accept Changes].

Thanks for your help. I will strive on and debug slowly any stupid errors.

[attachment deleted by admin]
Title: Re: SS_Notify on Vista & XP
Post by: Ghandi on July 30, 2009, 02:41:08 PM
I've searched for this myself on a few occasions, always ending with the same conclusion. ToutEnMasm has it correct, you can only use WM_CTLCOLORBTN if you are taking over ALL aspects of drawing the buttons. Otherwise you wont be able to change your button color (that i've found). You can read about the message on MSDN:

http://msdn.microsoft.com/en-us/library/bb761849(VS.85).aspx

HR,
Ghandi
Title: Re: SS_Notify on Vista & XP
Post by: newAsm on July 31, 2009, 02:31:07 AM
Thanks ToutEnMasm & Ghandi for your help. I will make do with what I have until I revise my program with user owned button.

Thanks a lot for your help...newAsm