IsDialogMessage in Modeless Dialog

Started by Log, July 15, 2005, 11:39:06 PM

Previous topic - Next topic

Log

Hi
I want to use modeless dialog in DialogApp (not Dialog as a Main)
Please tell me how to trap WM_CHAR in this code and why cannot do that in this fashion.


.386
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive

include windows.inc
include kernel32.inc
include user32.inc
include Comctl32.inc

includelib kernel32.lib
includelib user32.lib
includelib Comctl32.lib

DlgProc PROTO :HWND,:UINT,:WPARAM,:LPARAM

IDD_DIALOG1 equ 101

.const

.data?
hDlgWnd HWND ?
hInstance dd ?
msg MSG <?>

.data

.code

start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke InitCommonControls

invoke CreateDialogParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
mov hDlgWnd,eax

    .while TRUE
        invoke GetMessage,addr msg,NULL,0,0
        .BREAK .if !eax
        invoke IsDialogMessage, hDlgWnd, ADDR msg
        .if eax==FALSE
            invoke TranslateMessage, ADDR msg
            invoke DispatchMessage, ADDR msg
        .endif
    .endw
   
    invoke ExitProcess,0

;########################################################################

DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL rect:RECT

mov eax,uMsg
    .if eax==WM_INITDIALOG

    .elseif eax==WM_CHAR
        ; it does not reach here !!!!

    .elseif eax==WM_DESTROY
        invoke PostQuitMessage,NULL

    .elseif eax==WM_CLOSE
        invoke DestroyWindow,hWin
       
    .else
        mov eax,FALSE
        ret
    .endif
    mov eax,TRUE
ret

DlgProc endp

end start




KetilO

Hi

Can't be done.
Removing IsDialogMessage might work.

KetilO