#include-once ; #INDEX# ======================================================================================================================= ; Title .........: SendMessage ; AutoIt Version: 3.1.1++ ; Language: English ; Description: Functions that assist SendMessage calls. ; =============================================================================================================================== ; #VARIABLES# =================================================================================================================== ;============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_SendMessage ;_SendMessageA ;============================================================================================================================== ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ;============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _SendMessage ; Description ...: Wrapper for commonly used Dll Call ; Syntax.........: _SendMessage($hWnd, $iMsg[, $wParam = 0[, $lParam = 0[, $iReturn = 0[, $wParamType = "wparam"[, $lParamType = "lparam"[, $sReturnType = "lparam"]]]]]]) ; Parameters ....: $hWnd - Window/control handle ; $iMsg - Message to send to control (number) ; $wParam - Specifies additional message-specific information ; $lParam - Specifies additional message-specific information ; $iReturn - What to return: ; |0 - Return value from dll call ; |1 - $ihWnd ; |2 - $iMsg ; |3 - $wParam ; |4 - $lParam ; |<0 or > 4 - array same as dllcall ; $wParamType - See DllCall in Related ; $lParamType - See DllCall in Related ; $sReturnType - See DllCall in Related ; Return values .: Success - User selected value from the DllCall() result ; Failure - @error is set ; Author ........: Valik ; Modified.......: Gary Frost (GaryFrost) aka gafrost ; Remarks .......: ; Related .......: _SendMessageA, DllCall ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _SendMessage($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lparam") Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessage", "hwnd", $hWnd, "int", $iMsg, $wParamType, $wParam, $lParamType, $lParam) If @error Then Return SetError(@error, @extended, "") If $iReturn >= 0 And $iReturn <= 4 Then Return $aResult[$iReturn] Return $aResult EndFunc ;==>_SendMessage ; #FUNCTION# ==================================================================================================================== ; Name...........: _SendMessageA ; Description ...: Wrapper for commonly used Dll Call (Force Ansi Call) ; Syntax.........: _SendMessageA($hWnd, $iMsg[, $wParam = 0[, $lParam = 0[, $iReturn = 0[, $wParamType = "wparam"[, $lParamType = "lparam"[, $sReturnType = "lparam"]]]]]]) ; Parameters ....: $hWnd - Window/control handle ; $iMsg - Message to send to control (number) ; $wParam - Specifies additional message-specific information ; $lParam - Specifies additional message-specific information ; $iReturn - What to return: ; |0 - Return value from dll call ; |1 - $ihWnd ; |2 - $iMsg ; |3 - $wParam ; |4 - $lParam ; |<0 or > 4 - array same as dllcall ; $wParamType - See DllCall in Related ; $lParamType - See DllCall in Related ; $sReturnType - See DllCall in Related ; Return values .: Success - User selected value from the DllCall() result ; Failure - @error is set ; Author ........: Valik ; Modified.......: Gary Frost (GaryFrost) aka gafrost ; Remarks .......: ; Related .......: _SendMessage, DllCall ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _SendMessageA($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lparam") Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessageA", "hwnd", $hWnd, "int", $iMsg, $wParamType, $wParam, $lParamType, $lParam) If @error Then Return SetError(@error, @extended, "") If $iReturn >= 0 And $iReturn <= 4 Then Return $aResult[$iReturn] Return $aResult EndFunc ;==>_SendMessageA