Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Created QM video tutorials
#11
@r0n

Hello, I am watching a video tutorial 18
I run the following code, the prompt is undefined, can you guide me, where can I find this custom function? Thanks in advance

I have encountered this problem in other tutorial code files. If export the related files to a .qml file, it will be more convenient to use.

code File : 13 (2).txt

Macro Macro2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 191 113 "Dialog"
;5 Static 0x54000000 0x0 62 26 110 11 ""
;4 Button 0x54032000 0x0 3 23 48 14 "HOTKEY 1"
;3 Static 0x54000000 0x0 19 50 142 10 "Shift + left click on button is clear hotkey!"
;2 Button 0x54030000 0x4 77 94 48 14 "Cancel"
;8 Button 0x54020007 0x0 57 16 120 26 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

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

#sub DlgProc
function# hDlg message wParam lParam
int- maindlg=hDlg
sel message
,case WM_INITDIALOG
,,int- t_hk
,,__RegisterHotKey hk
,,str hr    
,,str- hk1="119"
,,str purge="" ;;I often use this to empty inputfields (can be anything you want).
,,int vk_in mod_in mod
,,vk_in=val(hk1)&255 ;; vk
,,mod_in=val(hk1)>>8 ;;mod
,,mod=(mod_in~5)|(mod_in>>2&1)|(mod_in<<2&4)        
,,FormatKeyString vk_in mod_in &hr ;; human readable format!
,,if(!hk.Register(hDlg 0 mod vk_in)) ;; '0' => hotkey ID can be any number.
,,,mes(F"Could not register:[][]{hr}" "!")        
,,hr.setwintext(id(5 hDlg))

,case WM_HOTKEY
,,hk_MakeHr(val(hk1) hr)        
,,;; IF HOTKEY F8 IS PRESSED!
,,if(wParam=0) ;; 'wParam' corresponds to hotkey id
,,,out
,,,0.1
,,,out F"Key {hr} pressed"

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,,;; ifk(S) checks if [SHIFT] was pressed, this means UNREGISTER (unmap) hotkey!
,,;; make sure that you place 'ifk' commands at the beginning of your code
,,;; this means beginning of macro,function,... OR beginning of a code section
,,;; in this example you see it being placed DIRECTLY AFTER 'case 4'
,,;; which means button id '4' pressed in dialog.
,,ifk(S)
,,,UnregisterHotKey(hDlg 0)
,,,hk1="0"
,,,purge.setwintext(id(5 hDlg))            
,,,goto skip
,,UnregisterHotKey(hDlg 0)        
,,hk_Sethotkey
,,if(t_hk>0) ;; We now use 't_hk' for registering key, val(t_hk) is NOT needed. 't_hk' is already integer!
,,,vk_in=t_hk&255 ;; vk
,,,mod_in=t_hk>>8 ;;mod
,,,mod=(mod_in~5)|(mod_in>>2&1)|(mod_in<<2&4)        
,,,FormatKeyString vk_in mod_in &hr        
,,,if(!hk.Register(hDlg 0 mod vk_in)) ;; '0', you MUST use the hotkey ID which you set under 'case WM_HOTKEY'
,,,,mes(F"Could not register:[][]{hr}" "!")
,,,hk_MakeHr(t_hk hr)
,,,hr.setwintext(id(5 hDlg))
,,,hk1=t_hk ;; We MUST put 't_hk' in STRING 'hk1' because above in "case WM_HOTKEY" we use 'hk1' to output which keyboard shortcut was pressed!
,,;skip

,case IDOK
,case IDCANCEL
ret 1


Attached Files Image(s)
   


Messages In This Thread
Created QM video tutorials - by r0n - 01-02-2017, 05:52 PM
RE: Created QM video tutorials - by win - 05-11-2018, 03:25 PM
RE: Created QM video tutorials - by r0n - 05-16-2018, 04:52 PM
RE: Created QM video tutorials - by win - 05-17-2018, 01:49 AM
RE: Created QM video tutorials - by win - 11-14-2018, 12:03 AM
RE: Created QM video tutorials - by win - 04-05-2019, 12:08 AM
RE: Created QM video tutorials - by r0n - 04-06-2019, 04:39 PM
RE: Created QM video tutorials - by win - 04-06-2019, 09:14 PM
RE: Created QM video tutorials - by r0n - 04-06-2019, 10:07 PM
RE: Created QM video tutorials - by win - 04-06-2019, 10:15 PM
RE: Created QM video tutorials - by r0n - 04-06-2019, 10:46 PM
RE: Created QM video tutorials - by win - 04-06-2019, 10:49 PM
RE: Created QM video tutorials - by win - 04-07-2019, 03:21 AM
RE: Created QM video tutorials - by r0n - 04-07-2019, 04:01 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)