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

Method ControlSetName

source/script_gui.cpp:1020–1045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1018
1019
1020ResultType GuiType::ControlSetName(GuiControlType &aControl, LPTSTR aName)
1021{
1022 if (aName && !*aName)
1023 {
1024 aName = NULL;
1025 }
1026 else if (aName)
1027 {
1028 // Make sure the name isn't already taken.
1029 for (GuiIndexType u = 0; u < mControlCount; ++u)
1030 if (mControl[u]->name && !_tcsicmp(mControl[u]->name, aName))
1031 {
1032 if (mControl[u] == &aControl) // aControl already has this name, but upper- vs lower-case may differ.
1033 break;
1034 return g_script.RuntimeError(_T("A control with this name already exists."), aName);
1035 }
1036
1037 aName = _tcsdup(aName);
1038 if (!aName)
1039 return MemoryError();
1040 }
1041 if (aControl.name)
1042 free(aControl.name);
1043 aControl.name = aName;
1044 return OK;
1045}
1046
1047
1048ResultType GuiType::MethodGetPos(ResultToken &aResultToken, ExprTokenType *aParam[], int aParamCount, RECT &aPos)

Callers 1

InvokeMethod · 0.80

Calls 2

MemoryErrorFunction · 0.85
RuntimeErrorMethod · 0.80

Tested by

no test coverage detected