News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

SS_Notify on Vista & XP

Started by newAsm, July 13, 2009, 04:11:19 AM

Previous topic - Next topic

newAsm

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]

ToutEnMasm


The ml option  "/Zd Add line number debug info" is missing.
This made that the debugger couldn't follow your source code.

sinsi

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...
Light travels faster than sound, that's why some people seem bright until you hear them.

ToutEnMasm


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 ?.

newAsm

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


sinsi

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.
Light travels faster than sound, that's why some people seem bright until you hear them.

ToutEnMasm

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

sinsi

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.
Light travels faster than sound, that's why some people seem bright until you hear them.

ToutEnMasm

unusual way for a notify message,I have correct this.

newAsm

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]

sinsi

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.
Light travels faster than sound, that's why some people seem bright until you hear them.

newAsm

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

newAsm

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


newAsm

Hi,

I forgot to attach the files..newAsm

[attachment deleted by admin]

sinsi

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]
Light travels faster than sound, that's why some people seem bright until you hear them.