News:

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

OfnHookProc

Started by bomz, April 15, 2011, 12:32:24 PM

Previous topic - Next topic

bomz

 ::) HELP
Quote
******************
mov ofn.Flags, OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or OFN_LONGNAMES or OFN_EXPLORER or OFN_HIDEREADONLY or OFN_ENABLEHOOK
mov ofn.lpfnHook, OfnHookProc
******************
OfnHookProc proc hwnd:DWORD,uMsg:DWORD,wParam:WPARAM,lParam:LPARAM
   .IF uMsg==WM_NOTIFY

   ASSUME  eax:PTR OFNOTIFY
   mov eax,lParam
   mov eax,dword ptr [eax].NMHDR.code
   .IF eax==CDN_INITDONE

   invoke SetWindowPos, hwnd, HWND_NOTOPMOST, 150, 150, 150, 200, NULL
;       invoke MessageBox,0,0,0, MB_OK
   .ENDIF
   .ENDIF
        ret
OfnHookProc endp

bomz

This works. But how is right?
Quote
mov ofn.Flags, OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or OFN_LONGNAMES or OFN_EXPLORER or OFN_HIDEREADONLY or OFN_ENABLEHOOK
mov ofn.nFileOffset, NULL
mov ofn.nFileExtension, NULL
mov ofn.lpstrDefExt, NULL
mov ofn.lCustData, NULL
mov ofn.lpfnHook, OfnHookProc
mov ofn.lpTemplateName, NULL

OfnHookProc proc hwnd:DWORD,uMsg:DWORD,wParam:WPARAM,lParam:LPARAM
   .IF uMsg==WM_NOTIFY

;   ASSUME  eax:PTR OFNOTIFY
;   mov eax,lParam
;   mov eax,dword ptr [eax].NMHDR.code

mov ecx,lParam
mov ecx,dword ptr [ecx].NMHDR.code
mov eax,CDN_FIRST
sub eax,ecx

   .IF eax==CDN_INITDONE

invoke GetParent, hwnd

   invoke SetWindowPos, eax, HWND_NOTOPMOST, 150, 150, 425, 300, NULL
;invoke MessageBox,0,0,0, MB_OK
   .ENDIF
   .ENDIF
        xor     eax,eax
        ret
OfnHookProc endp


When I add OFN_ENABLEHOOK flag windows changes - why?

without

with

hutch--

Its just how Microsoft do it, as soon as you set a hook procedure for a file dialog you get the interface without the side band.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

bomz

OK. Thanks. I trying all flags.

what about this? whats is right???

   ASSUME  eax:PTR OFNOTIFY
   mov eax,lParam
   mov eax,dword ptr [eax].NMHDR.code
   .IF eax==CDN_INITDONE


mov ecx,lParam
mov ecx,dword ptr [ecx].NMHDR.code
mov eax,CDN_FIRST
sub eax,ecx