MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / Invoke

Method Invoke

source/script_gui.cpp:278–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278ResultType GuiType::Invoke(ResultToken &aResultToken, int aID, int aFlags, ExprTokenType *aParam[], int aParamCount)
279{
280 if (!mHwnd)
281 _o_throw(ERR_GUI_NO_WINDOW);
282
283 TCHAR nbuf1[MAX_NUMBER_SIZE], nbuf2[MAX_NUMBER_SIZE];
284
285 auto member = MemberID(aID);
286 switch (member)
287 {
288 case M_Destroy:
289 Destroy();
290 _o_return_empty;
291 case M_Show:
292 return Show(ParamIndexToOptionalString(0, nbuf1));
293 case M_Hide:
294 Cancel();
295 _o_return_empty;
296 case M_Minimize:
297 // If the window is hidden, it is unhidden as a side-effect (this happens even for SW_SHOWMINNOACTIVE).
298 ShowWindow(mHwnd, SW_MINIMIZE);
299 _o_return_empty;
300 case M_Maximize:
301 ShowWindow(mHwnd, SW_MAXIMIZE);
302 _o_return_empty;
303 case M_Restore:
304 ShowWindow(mHwnd, SW_RESTORE);
305 _o_return_empty;
306 case M_Flash:
307 FlashWindow(mHwnd, ParamIndexToOptionalBOOL(0, TRUE));
308 _o_return_empty;
309 case M_SetFont:
310 {
311 LPTSTR options = ParamIndexToOptionalString(0, nbuf1); // A number currently isn't valid here, so nbuf is passed just for maintainability.
312 LPTSTR font_name = ParamIndexToOptionalString(1, nbuf2); //
313 return SetCurrentFont(options, font_name);
314 }
315 case M_Opt:
316 {
317 LPTSTR options = ParamIndexToOptionalString(0, nbuf1);
318 bool set_last_found_window = false;
319 ToggleValueType own_dialogs = TOGGLE_INVALID;
320 if (!ParseOptions(options, set_last_found_window, own_dialogs))
321 break; // Above already displayed an error message.
322 if (set_last_found_window)
323 g->hWndLastUsed = mHwnd;
324 SetOwnDialogs(own_dialogs);
325 _o_return_empty;
326 }
327 case M_Submit:
328 {
329 return Submit(aResultToken, ParamIndexToOptionalBOOL(0, TRUE));
330 }
331 case M___Enum:
332 {
333 _o_return(new IndexEnumerator(this, ParamIndexToOptionalInt(0, 1)
334 , static_cast<IndexEnumerator::Callback>(&GuiType::GetEnumItem)));
335 }

Callers

nothing calls this directly

Calls 15

TokenSetResultFunction · 0.85
TokenIsPureNumericFunction · 0.85
TokenToInt64Function · 0.85
TokenToStringFunction · 0.85
AssignColorFunction · 0.85
rgb_to_bgrFunction · 0.85
sntprintfcatFunction · 0.85
TokenToArrayFunction · 0.85
ControlInitOptionsMethod · 0.80
ControlParseOptionsMethod · 0.80
ControlSetFontMethod · 0.80
ParseMoveParamsMethod · 0.80

Tested by

no test coverage detected