News:

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

Getting Focus

Started by Jimg, August 04, 2005, 03:52:31 PM

Previous topic - Next topic

Jimg

Ok, let's see if I got this right-

Marks method:  ( this is currently working)

DlgProc proc uses edi esi ebx hWnd:DWord,uMsg:DWord,wParam:DWord,lParam:DWord
    .if uMsg == WM_COMMAND
        mov eax,wParam  ; identifier of the control, or accelerator
        .if eax==WM_USER+3
            PrintText "Time to doit"
        .endif
    .elseif uMsg==WM_ACTIVATE
        mov eax,wParam
        .if ax==WA_ACTIVE || ax==WA_CLICKACTIVE
            inv PostMessage,hWnd,WM_COMMAND,WM_USER+3,0 ; send me a message when everything else is settled
        .endif
    .else


Pauls Method:

DlgProc proc uses edi esi ebx hWnd:DWord,uMsg:DWord,wParam:DWord,lParam:DWord
    ; I'm here because there is a uMsg so before I check what it is, do this every time, for the thousands of messages I get
.data
InFocusFlag dd 0
.code
     invoke GetFocus
     .if eax==hWnd   ; then it's me
        .if InFocusFlag==1 then   ; I didn't have focus for a while
            inv PostMessage,hWnd,WM_COMMAND,WM_USER+3,0 ; send me a message to take care of business when all else is settled
            mov InFocusFlag,0    ; reset the flag
        .endif
    .else    ; it's not me
        mov InFocusFlag,1    ; flag that I lost focus
    .endif
    ; now do normal message processing           
    .if uMsg == WM_COMMAND

PBrennick

Jimg,
If Mark's method is working, I say 'If it is not broke, don't fix it.'  And be sure to say thanks to Mark.  :U

BTW, I see you got the point I was trying to make...
Paul
The GeneSys Project is available from:
The Repository or My crappy website