Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Attaching a quick macro to an application menu
#1
Hi I am new to the quick macro application
I have an application assume Notepad and I would like to replace the open file dialog with my own. Thus when I user clicks on Notepad’s menu File/Open I would like to trap the windows dialog menu and replace it with my own form (dialog).

In the dialog form I would like to find the file and send to notepad the path of the new file to be opened. (My dialog form will find the file based on search criteria)

Any help would be appreciated
Regards
S.Keynan
#2
Bypassing the original Open dialog is not possible, but you can hide it.

Function AnyName
Trigger: !cv"Open" "#32770" "File &name:" "Static" /NOTEPAD
Code:
Copy      Help
int hwnd=val(_command) ;;get handle of Open dialog
;mov 10000 0 hwnd ;;hide the Open dialog. enable this line if works well


;g1
if(!inp(_s)) ;;i use inp for simplicity. replace it with your dialog code (ShowDialog etc)
,;Cancel
,clo hwnd
,ret

_s.setwintext(id(1148 hwnd)) ;;set text of 'File name:' edit box
but 1 hwnd; err ret ;;press OK

;wait until closed, because sometimes OK does not close it
wait 2 -WC hwnd
err ;;stil exists after 2 s
,int w2=win("Open" "#32770" "" 64 hwnd 0) ;;error message box?
,if(w2)
,,act w2
,,wait 0 -WC w2 ;;wait until closed and retry
,,goto g1 ;;retry
,mes "something wrong"
,clo hwnd

This function will run automatically whenever QM sees that Open dialog in Notepad is opened.


Forum Jump:


Users browsing this thread: 1 Guest(s)