hello!!!

when I dropped a file on the general form , I can open the dropped file
however when I dropped a file on edit(no richedit), the WM_DROPFILES event does not work.

I have tried to code in different ways like this

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DlgProc proc hWin :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD

.if uMsg == WM_COMMAND
.if wParam == IDC_OK
      .elseif wParam == IDC_IDCANCEL
invoke EndDialog, hWin, 0
.endif


; only on form this event works
.elseif uMsg == WM_DROPFILES
Invoke SetDlgItemText,hWin,IDC_MSSG,ADDR MSG_OK

          ;I am not sure these codes
.elseif uMsg == WM_NOTIFY
mov    ebx, lParam
mov    eax, .NMHDR.hwndFrom
.if wParam == IDC_EDIT
Invoke SetDlgItemText,hWin,IDC_MSSG,ADDR MSG_OK
.endif




.elseif uMsg == WM_CLOSE
invoke EndDialog,hWin,0
.endif

xor eax,eax
ret
DlgProc endp
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Posted on 2006-02-18 06:51:02 by dongmin
To catch all messages going to your EDIT control you should either subclass it, or build your own message loop. As to the latter approach: something like this could be used:

in your WinMain function:

  invoke CreateDialogParam, hInstance, IDD_DLG1, 0, addr DlgFunc, 0
  .if eax
    mov hDialog, eax
    invoke GetMessage, addr msgx, NULL, 0, 0      ;msgx is of MSG type
    .while eax
      .if eax == -1
      .break
      .else
        invoke IsHookedMessage, addr msgx    ;check if the message is among those you especially care about
        .if !eax
          ;here comes the standard message loop
          invoke IsDialogMessage, hDialog, addr msgx
          .if !eax
            invoke TranslateMessage, addr msgx
            invoke DispatchMessage, addr msgx
          .endif
        .endif
      .endif
      invoke GetMessage, addr msgx, NULL, 0, 0
    .endw
    invoke DestroyWindow, hDialog
  .endif


while your IsHookedMessage function might look as follows:

IsHookedMessage proc pmsg: DWORD
  mov eax, pmsg
  .if .MSG.message == WM_DROPFILES
    ;here you may check if the window handle of the message is the one you care about
    ;and do your processing of the message

    ;at the end return TRUE to suppress further processing of the message
    or eax, -1
    ;(or return FALSE, if you want the window to receive this message anyway)


  .else
    ;return FALSE to process the message in a standard way
    xor eax, eax
  .endif
  ret
IsHookedMessage endp
Posted on 2006-02-19 11:16:18 by Morris