MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey-v1.0 / ScriptSendMessage

Method ScriptSendMessage

Source/script2.cpp:2881–2899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2879
2880
2881ResultType Line::ScriptSendMessage(char *aMsg, char *awParam, char *alParam, char *aControl
2882 , char *aTitle, char *aText, char *aExcludeTitle, char *aExcludeText)
2883{
2884 HWND target_window = DetermineTargetWindow(aTitle, aText, aExcludeTitle, aExcludeText);
2885 if (!target_window)
2886 return g_ErrorLevel->Assign("FAIL"); // Need a special value to distinguish this from numeric reply-values.
2887 HWND control_window = *aControl ? ControlExist(target_window, aControl) : target_window;
2888 if (!control_window)
2889 return g_ErrorLevel->Assign("FAIL");
2890 // Use ATOI64 to support unsigned (i.e. UINT, LPARAM, and WPARAM are all 32-bit unsigned values).
2891 // ATOI64 also supports hex strings in the script, such as 0xFF, which is why it's commonly
2892 // used in functions such as this:
2893 DWORD dwResult;
2894 if (!SendMessageTimeout(control_window, ATOU(aMsg), ATOU(awParam), ATOU(alParam)
2895 , SMTO_ABORTIFHUNG, 5000, &dwResult)) // Increased from 2000 in v1.0.27.
2896 return g_ErrorLevel->Assign("FAIL"); // Need a special value to distinguish this from numeric reply-values.
2897 // By design (since this is a power user feature), no ControlDelay is done here.
2898 return g_ErrorLevel->Assign(dwResult); // UINT seems best most of the time?
2899}
2900
2901
2902

Callers

nothing calls this directly

Calls 3

ControlExistFunction · 0.85
ATOUFunction · 0.85
AssignMethod · 0.80

Tested by

no test coverage detected