Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to define a single hotkey in a dialog box
#1
I define a hotkey for the dialog, but it requires at least two keys, for example ctrl+F1, I want to use one hotkey(F1), I did not find the example in the help, I hope someone can remind me, thanks in advanceSmile

Macro Macro5
Code:
Select All      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030506 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam
__RegisterHotKey- t_hk1
sel message
,case WM_INITDIALOG
,t_hk1.Register(hDlg 1 MOD_CONTROL VK_F1) ;;Ctrl+F1
,
,case WM_HOTKEY
,sel wParam
,,case 1 mes "Ctrl+F1"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
gave you the answer to this in another post 

http://www.quickmacros.com/forum/showthr...n=lastpost
#3
hi kevin ,Thanks so much, I forgot to check previous posts  Tongue
#4
hi @kevin

Using the above code, I found a problem. In some places when I press Enter and confirm the operation, when I press the Enter key, it doesn't work. Do you know what the reason is? Can't use Enter key, not very convenient  Huh
#5
please show your code
#6
Macro Macro1
Code:
Select All      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 548 318 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 548 320 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str ax3SHD="$desktop$\Quiz\quiz.html"

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_CLOSE
,DT_Ok(hDlg)
ret
;messages2
sel wParam
,case IDOK
,ret 0
,case IDCANCEL
,ret 0
ret 1


Please extract the Quiz.zip file to your desktop  Smile

The password is: 123

After entering the password, press the Enter key, I should be able to confirm, but in the above code, the carriage return does not work


Attached Files
.zip   Quiz.zip (Size: 440.45 KB / Downloads: 30)
#7
change IDOK to this
Code:
Select All      Help
,case IDOK
,ifk(Y)  
,,key Y           ;; Enter
,,ret 0
#8
@kevin

Your programming skills are great, perfect solution, thank you very much Tongue

How to activate the flash control?

Above code, I need to click swf, then I can enter the password, otherwise it is not possible to enter the password, I tried (act) can not take effect  Huh
#9
its not so simple. Need to figure out a way to know  when file is loaded. Then can maybe send mouse message. Sorry cant help  more  im not at my pc. Will try later
#10
OK, I'm trying to try other reliable methods
#11
try this its working for me

Function Dialog_Quiz
Code:
Select All      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 548 318 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 548 320 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str ax3SHD

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
int- t_mainDlg

sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,SHDocVw.WebBrowser we3
,we3._getcontrol(id(3 hDlg))
,str s.expandpath("$Desktop$\quiz.html")
,we3.Navigate(s)
,we3._setevents("sub.we3")
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_CLOSE
,DT_Ok(hDlg)
ret
;messages2
sel wParam
,case IDOK
,ifk(Y)          ;; Enter
,,key Y           ;; Enter
,,ret 0
,case IDCANCEL
,ifk(Z)          ;; Esc
,,key Z
,,ret 0
ret 1


#sub we3_DocumentComplete
function IDispatch'pDisp `&URL ;;SHDocVw.IWebBrowser2'we3
int- t_mainDlg
Htm e=htm("EMBED" "sf" "" t_mainDlg "0" 0 0x221)
e.SetFocus
#12
An error occurred Huh


Attached Files Image(s)
   
#13
restart qm and try again
#14
Still no object found
#15
try this
Htm e=htm("EMBED" "sf" "" t_mainDlg "0" 0 0x201)
if doesnt work you will need to create your own htm statement.
floating toolbar
   
#16
After changing to 201


Attached Files Image(s)
   
#17
pointing to which variable?
try restart qm again
#18
int w=wait(3 WV win("Dialog" "#32770"))
Htm e1=htm("CENTER" "" "[]<CENTER><BR>[]<SCRIPT language=javascript>[]<!--[]function writeSwf(movie, width, height) {[]  document.write('<object classid=''clsidBig Grin27CDB6E-AE6D-11cf-96B8-444553540000'' codebase=''http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'' width=''' + width + [39]'' height=''" w "0" 0 0x20 3)
e1.SetFocus

This will not succeed Huh
#19
int w=win("Dialog" "#32770")
Htm e=htm("EMBED" "sf" "" w "0" 0 0x220)
e.SetFocus
maybe keep changing options make sure Wait max,s is 0
3 seconds isnt long enough
#20
Now, it seems that activating swf , only with the mouse click  Big Grin
#21
try this 1

Code:
Select All      Help
Htm e=htm("EMBED" "" "" t_mainDlg "0")
e.SetFocus

more simplified should work hopefully
#22
Error (RT) in <open ":1: /977">Macro2:we3_DocumentComplete:  this variable not initialized.    <help #IDP_ERR>?

Macro Macro1
Code:
Select All      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 548 318 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 548 320 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str ax3SHD

if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
int- t_mainDlg

sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,SHDocVw.WebBrowser we3
,we3._getcontrol(id(3 hDlg))
,we3.Navigate("http://static.focusky.com/web/demo/Eduction/Complexity Thoughts/index.html")

,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_CLOSE
,DT_Ok(hDlg)
ret
;messages2
sel wParam
,case IDOK
,ifk(Y)          ;; Enter
,,key Y           ;; Enter
,,ret 0
,case IDCANCEL
,ifk(Z)          ;; Esc
,,key Z
,,ret 0
ret 1

How to hide the right scroll bar? I did not find the style options


Attached Files Image(s)
   
#23
Oh i see your loading different  file. No wonder it doesn't work. The flash or html page which ever it is bigger than the dialog control that's why the scroll bar.
on my pc there is no scroll bar .It auto sizes to fit dialog control on my pc. must be a win7 issue or browser control is running in compatibility mode again.

this also works for me loading the quiz.swf file directly
Function Dialog_Quiz
Code:
Select All      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CB0AC8 0x0 0 0 548 318 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 548 320 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam
int- t_mainDlg
sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,DT_SetAutoSizeControls(hDlg "3s")
,SHDocVw.WebBrowser we3
,we3._getcontrol(id(3 hDlg))
,str s.expandpath("$Desktop$\quiz.swf")
,we3.Navigate(s)
,we3._setevents("sub.we3")
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_CLOSE
,DT_Ok(hDlg)
ret
;messages2
sel wParam
,case IDOK
,ifk(Y)          ;; Enter
,,key Y           ;; Enter
,,ret 0
,case IDCANCEL
,ifk(Z)          ;; Esc
,,key Z
,,ret 0
ret 1


#sub we3_DocumentComplete
function IDispatch'pDisp `&URL ;;SHDocVw.IWebBrowser2'we3
int- t_mainDlg
int w=win("Dialog" "#32770")
;just outputting 2 variables for testing they are both dialog window handle and should be the same
out w
out t_mainDlg
;either of the above two vars should work as they are the same
Htm e=htm("EMBED" "" "" w "0")
e.SetFocus
#24
In fact, they are all loading the same file: quiz.swf

Because it(swf) is included in quiz.html

If it is set to   ( str s.expandpath("$Desktop$\quiz.swf"))  be successful,

If it is set to  ( str s.expandpath("$Desktop$\quiz.html"))  be fail

But in many cases the swf file  included in the html file. How do I set it? In addition, the scroll bar on the right cannot be hidden.

I tried many ways to fail Undecided
#25
Check your  browser control to see what version  it's running. Navigate to Google search for browser version test or browser usee agent test
#26
Browser Control is IE8.0


Attached Files Image(s)
   
#27
Might  be why i get different results try running  the browser  contro version  function  then test again
#28
I don't quite understand why these two variables are the same

Macro Macro1
Code:
Select All      Help
int- t_mainDlg
int w=win("Dialog" "#32770")
;just outputting 2 variables for testing they are both dialog window handle and should be the same
out w
out t_mainDlg
;either of the above two vars should work as they are the same


I did not find t_mainDlg in the QM help. In addition, I found that many times you will need the prefix (t_) variable. Where are these variables found?

In a few days, I will try again after upgrading the operating system to windows 10. Thank you very much for your help. Heart
#29
A variable  can have any name i only put them there  to check that both were  getting the same  window handle . The name can be anything,  could  be int dialoghandle, int window handle  etc  etc ect  qm uses w w1 w2 w3 ect for window  handles  and hDlg for dialogs.  qm does have some predefined  variables but other than that can make it any name u wish. The general rule is to make the variable name clear as to what it does so later you can easily identify what it does
#30
Macro swf
Code:
Select All      Help
int- t_mainDlg
Htm e=htm("EMBED" "" "" t_mainDlg "0")
e.SetFocus
I do not understand why the variables here are the main window (Replace w with t_mainDlg), the following code, I understand,

I don't understand too much about functions and parameters


Macro swf
Code:
Select All      Help
int w=win("Dialog" "#32770")
Htm e=htm("EMBED" "" "" w "0")


Forum Jump:


Users browsing this thread: 1 Guest(s)