#RequireAdmin
#include <WinAPIEx.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $stData
Local $JMPPR = _WinAPI_OpenFileMapping('openfile')
If $JMPPR Then
Local $RJMP = _WinAPI_MapViewOfFile($JMPPR)
$stData = DllStructCreate('wchar[2]', $RJMP)
Else
Local $CJMF = _WinAPI_CreateFileMapping(-1, 10, 'openfile')
Local $RJMP = _WinAPI_MapViewOfFile($CJMF)
$stData = DllStructCreate('wchar[2]', $RJMP)
EndIf
Local $Form1 = GUICreate("Form1", 355, 119, 192, 124)
Global $Label1 = GUICtrlCreateLabel("Working", 40, 32, 148, 17)
Global $Button1 = GUICtrlCreateButton("Button1", 208, 72, 75, 25)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
While 1
If DllStructGetData($stData, 1) Then
GUICtrlSetData($Label1, 'Pause')
While 1
Sleep(10)
If Not DllStructGetData($stData, 1) Then
GUICtrlSetData($Label1, 'Working')
ExitLoop
EndIf
WEnd
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0xFFFF)
Switch $nNotifyCode
Case 0
Switch $nID
Case $Button1
If Not DllStructGetData($stData, 1) Then
DllStructSetData($stData, 1, '1')
Else
DllStructSetData($stData, 1, '')
EndIf
EndSwitch
EndSwitch
Return 'GUI_RUNDEFMSG'
EndFunc ;==>WM_COMMAND