Search the Community
Showing results for tags '$wm_create'.
-
Hi all, i am playing with some gui code. I am trying to do some stuff in WM_CREATE. This is my code. But this is not working. Somebody please guide me. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <WinAPI.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= Local $hForm1 = GUICreate("Hello Program", 550, 306, 277, 153) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") Local $hLabel1 = GUICtrlCreateLabel("Hello from AutoIt", 200, 120, 136, 17) Local $hBtn = GUICtrlCreateButton("Click", 100, 100, 86, 57) GUICtrlSetOnEvent(-1, "BtClick") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ GUIRegisterMsg($WM_CREATE, "WM_Create") Local $idMsg = 0 $whHook = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam') $wpHook = DllCallbackGetPtr($whHook) While 1 Sleep(50) ;~ $idMsg = GUIGetMsg() ;~ Select ;~ Case $idMsg = $WM_CREATE ;~ SoundPlay("C:\Users\Vinod\Desktop\ProgWin5\Chap03\HelloWin\HelloWin.wav",1) ;~ ;ConsoleWrite("Created" & @CRLF) ;~ Case $WM_PAINT ;~ GUICtrlSetData($hLabel1,"Label After Painted") ;~ ;ConsoleWrite("Painted" & @CRLF) ;~ Case $WM_DESTROY ;~ Exit ;~ EndSelect WEnd Func Form1Close() Exit EndFunc Func BtClick() ;$imsg = GUIGetMsg(1) ;_ArrayDisplay($imsg) SoundPlay("C:\Users\Vinod\Desktop\ProgWin5\Chap03\HelloWin\HelloWin.wav",1) EndFunc Func WM_Create($hWnd, $iMsg, $wParam, $lParam) #forceref $Hwnd, $iMsg SoundPlay("C:\Users\Vinod\Desktop\ProgWin5\Chap03\HelloWin\HelloWin.wav",1) Return 0 EndFunc Func _WinProc($hWnd, $iMsg, $wParam, $lParam) Local $hDC, $hSv, $oldMsg ConsoleWrite('_winProc $lParam: ' & $lParam / 255 & @CRLF) Switch $iMsg Case $WM_CREATE SoundPlay("C:\Users\Vinod\Desktop\ProgWin5\Chap03\HelloWin\HelloWin.wav",1) ConsoleWrite('WM_CREATE:' & @CRLF) Return 0 EndSwitch Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc