Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoTrayIcon ; Should add this to prevent tray icon in sub-thread.
- #include 'N.au3'
- global $g = NGlobal()
- func task_1($l)
- $g.number = 50
- endfunc
- func task_2($l)
- local $msg = StringFormat('Number is %d', $g.number)
- MsgBox(0, 'Task 2 (ID: ' & NGetId() & ')', $msg)
- endfunc
- ; main
- func main()
- ; Create GUI with 3 buttons.
- GUICreate('Test 1', 300, 180)
- local $btn1 = GUICtrlCreateButton('Task 1', 20, 50, 80, 30)
- local $btn2 = GUICtrlCreateButton('Task 2', 120, 50, 80, 30)
- GUISetState(@SW_SHOW)
- $g.number = 20
- while true
- switch GUIGetMsg()
- ; close
- case -3
- exit
- ; button 1
- case $btn1
- NRun('task_1')
- ; button 2
- case $btn2
- NRun('task_2')
- endswitch
- wend
- endfunc
- ; Execute main entry.
- NMain('main')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement