News:

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

CreateDialogParam

Started by Mark_201, June 06, 2006, 09:17:07 PM

Previous topic - Next topic

Mark_201

I just wanted to make sure the AboutDlgProc code is ok.


.elseif eax==IDM_HELP_ABOUT
invoke CreateDialogParam,hInstance,IDD_ABOUT_DLG,hWnd,ADDR AboutDlgProc,NULL
.endif

AboutDlgProc proc dWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg==WM_INITDIALOG            ; WM_INITDIALOG

.elseif uMsg==WM_CLOSE              ; WM_CLOSE
    invoke  EndDialog,dWin,0             ; end the dialog
.elseif uMsg==WM_COMMAND         ; WM_COMMAND
mov eax,wParam
and eax,0FFFFh                       ; get id
  .if eax==IDC_BTN_OK 
invoke  EndDialog,dWin,0 ; end the dialog
.endif
.else
    mov eax,FALSE                           ; delete unhandled message
    ret                                            ; and continue
  .endif
  mov    eax,TRUE                           ; message handled with success
  ret                                              ; and continue
AboutDlgProc      endp

Tedd

Looks okay from here :wink
I would usually use SetFocus in WM_INITDIALOG, just to have control over what gets the focus. As the code currently is, it will fall through and return true, meaning windows will set the focus to the 'first' control. (If you choose your own focus, then you should return false.)
No snowflake in an avalanche feels responsible.

Mark_201

Quote from: Tedd on June 07, 2006, 02:29:57 AM
Looks okay from here :wink
I would usually use SetFocus in WM_INITDIALOG, just to have control over what gets the focus. As the code currently is, it will fall through and return true, meaning windows will set the focus to the 'first' control. (If you choose your own focus, then you should return false.)

I see what you mean.  If you have more then one controls (child window controls) in a dialog setfocus to what you want. I guess window will setfocus to the first non-static item as a default.