| AutoHotkey | Windows API or C Function | Additional Information |
|---|---|---|
| A_AhkPath | GetModuleFileName | |
| A_AppData | SHGetFolderPath | CSIDL_APPDATA |
| A_AppDataCommon | SHGetFolderPath | CSIDL_COMMON_APPDATA |
| A_Args | __argc and __targv | |
| A_CaretX/Y | GetWindowThreadProcessId + GetGUIThreadInfo | GUITHREADINFO.rcCaret left (x) and top (y). |
| A_ComputerName | GetComputerName | |
| A_ComSpec | GetEnvironmentVariable | comspec |
| A_Cursor | GetCursorInfo | Load all system cursors with LoadCursor and compare each one with CURSORINFO.hCursor |
| A_DD / A_MDay | GetLocalTime | _stprintf(Buf, _T("%02d"), SYSTEMTIME.wDay); |
| A_DDDD / A_DDD | GetDateFormat | GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dddd"), Buf, BufSize) |
| A_Desktop | SHGetFolderPath | CSIDL_DESKTOPDIRECTORY |
| A_DesktopCommon | SHGetFolderPath | CSIDL_COMMON_DESKTOPDIRECTORY |
| A_GuiWidth / A_GuiHeight | Set in WM_SIZE | Width: LOWORD(lParam). Height: HIWORD(lParam). |
| A_GuiX / A_GuiY | GetMessage (message loop) | MSG.pt (X and Y coordinates for GuiContextMenu and GuiDropFiles events) |
| A_Hour | GetLocalTime | SYSTEMTIME.wHour |
| A_IPAddress1-4 | WSAStartup + gethostname + gethostbyname + WSACleanup | |
| A_Is64bitOS | #ifdef _WIN64 or IsWow64Process | |
| A_IsAdmin | OpenSCManager + LockServiceDatabase | Alternatives: IsUserAnAdmin, CheckTokenMembership, GetTokenInformation |
| A_IsUnicode | #ifdef UNICODE | |
| A_Language | GetSystemDefaultUILanguage | |
| A_LastError | GetLastError | |
| A_LoopFile... | See Loop (Files and Folders) | |
| A_LoopReg... | See Loop (Registry) | |
| A_Min | GetLocalTime | SYSTEMTIME.wMinute |
| A_MM/A_Mon | GetLocalTime | SYSTEMTIME.wMonth |
| A_MMMM/A_MMM | GetDateFormat | GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("MMMM"), Buf, BufSize) |
| A_MSec | GetLocalTime | _stprintf(aBuf, _T("%03d"), SYSTEMTIME.wMilliseconds); |
| A_MyDocuments | SHGetFolderPath | CSIDL_MYDOCUMENTS |
| A_Now | GetLocalTime | The time string from a SYSTEMTIME structure is formated with _stprintf. |
| A_NowUTC | GetSystemTime | |
| A_OSType | RtlGetVersion | OSVERSIONINFOW.dwPlatformId returns VER_PLATFORM_WIN32_NT if the OS is NT-based. |
| A_OSVersion | RtlGetVersion | Checks OSVERSIONINFOW dwMajorVersion and dwMinorVersion |
| A_ProgramFiles | SHGetFolderPath | CSIDL_PROGRAM_FILES |
| A_Programs | SHGetFolderPath | CSIDL_PROGRAMS |
| A_ProgramsCommon | SHGetFolderPath | CSIDL_COMMON_PROGRAMS |
| A_PtrSize | sizeof(void *) | |
| A_Sec | GetLocalTime | SYSTEMTIME.wSecond |
| A_ScreenDPI | GetDeviceCaps | GetDeviceCaps(hdc, LOGPIXELSX); |
| A_ScreenHeight | GetSystemMetrics | SM_CYSCREEN |
| A_ScreenWidth | GetSystemMetrics | SM_CXSCREEN |
| A_StartMenu | SHGetFolderPath | CSIDL_STARTMENU |
| A_StartMenuCommon | SHGetFolderPath | CSIDL_COMMON_STARTMENU |
| A_Startup | SHGetFolderPath | CSIDL_STARTUP |
| A_StartupCommon | SHGetFolderPath | CSIDL_COMMON_STARTUP |
| A_Temp | GetTempPath | |
| A_TickCount | GetTickCount | |
| A_TimeIdle | GetLastInputInfo | GetTickCount() - LASTINPUTINFO.dwTime |
| A_UserName | GetUserName | |
| A_WDay | GetLocalTime | SYSTEMTIME.wDayOfWeek + 1 |
| A_WinDir | GetWindowsDirectory | |
| A_WorkingDir | GetCurrentDirectory | |
| A_YDay | ||
| A_Year/A_YYYY | GetLocalTime | SYSTEMTIME.wYear |
| A_YWeek | ||
| Abs | qmathFabs (qmath.h, assembly code) | Alternative: abs (stdlib.h) |
| Acos | qmathAcos (qmath.h, assembly code) | Alternative: acos (math.h) |
| ASin | qmathAsin (qmath.h, assembly code) | Alternative: asin (math.h) |
| ATan | qmathAtan (qmath.h, assembly code) | Alternative: atan (math.h) |
| BlockInput | Involves keyboard and mouse hooking. | |
| Ceil | qmathCeil (qmath.h, assembly code) | Alternative: ceil (math.h) |
| Chr | int to LPTSTR | |
| Clipboard | Get: IsClipboardFormatAvailable + OpenClipboard + GetClipboardData + GlobalLock + _tcscpy or DragQueryFile (if CF_HDROP) + GlobalUnlock + CloseClipboard Set: GlobalAlloc + GlobalLock + tcslcpy + EmptyClipboard + GlobalUnlock + GlobalFree + SetClipboardData + CloseClipboard | |
| ClipboardAll | Get: OpenClipboard + EnumClipboardFormats + GetClipboardFormatName (for unregistered formats) + GetClipboardData... Set: OpenClipboard + EmptyClipboard + GlobalAlloc + GlobalLock + memcpy + GlobalUnlock + SetClipboardData + CloseClipboard | |
| ClipWait | CountClipboardFormats or IsClipboardFormatAvailable | The sleep duration is checked with GetTickCount in a for-loop. |
| ComObjCreate | CoCreateInstance | |
| Control Add | ComboBox: CB_ADDSTRING. ListBox: LB_ADDSTRING | |
| Control Check / Uncheck | BM_GETCHECK + SetActiveWindow + GetWindowRect + WM_LBUTTONDOWN + WM_LBUTTONUP | Thread input: GetWindowThreadProcessId + AttachThreadInput |
| Control Choose | ComboBox: CB_SETCURSEL. ListBox: LB_SETCURSEL or LB_SETSEL (multi-select) | Additionally: WM_COMMAND CBN_SELCHANGE and CBN_SELENDOK or LBN_SELCHANGE and LBN_DBLCLK |
| Control ChooseString | ComboBox: CB_SELECTSTRING. ListBox: LB_SELECTSTRING or LB_FINDSTRING (multi-select) | Additionally: WM_COMMAND CBN_SELCHANGE and CBN_SELENDOK or LBN_SELCHANGE and LBN_DBLCLK |
| Control Delete | ComboBox: CB_DELETESTRING. ListBox: LB_DELETESTRING | |
| Control EditPaste | EM_REPLACESEL | |
| Control Enable / Disable | EnableWindow | |
| Control Show / Hide | ShowWindow | SW_SHOWNOACTIVATE / SW_HIDE |
| Control Style / ExStyle | GetWindowLong + SetWindowLong | GWL_STYLE / GWL_EXSTYLE. May also call InvalidateRect to redraw. |
| Control Show/HideDropDown | CB_SHOWDROPDOWN | wParam: TRUE shows the list box, FALSE hides it. |
| Control TabLeft / TabRight | WM_KEYDOWN + WM_KEYUP (PostMessage) | lParam: VK_LEFT / VK_RIGHT << 16 | 0x00000001 (for key down), 0xC0000001 (for key up) |
| ControlClick | PostMessage | For a left click: WM_LBUTTONDOWN and WM_LBUTTONUP with MK_LBUTTON as wParam. |
| ControlFocus | SetFocus | |
| ControlGet Checked | BM_GETCHECK | |
| ControlGet Choice | ComboBox: CB_GETCURSEL + CB_GETLBTEXTLEN + CB_GETLBTEXT. ListBox: LB_GETCURSEL + LB_GETTEXTLEN + LB_GETTEXT | |
| ControlGet CurrentCol | EM_GETSEL + EM_LINEFROMCHAR + for-loop + EM_LINEFROMCHAR | |
| ControlGet CurrentLine | EM_LINEFROMCHAR | |
| ControlGet Enabled | IsWindowEnabled | |
| ControlGet FindString | ComboBox: CB_FINDSTRINGEXACT. ListBox: LB_FINDSTRINGEXACT | |
| ControlGet Line | EM_GETLINE | |
| ControlGet LineCount | EM_GETLINECOUNT | |
| ControlGet List | ComboBox: CB_GETCOUNT + CB_GETLBTEXTLEN + CB_GETLBTEXT in a for-loop. ListBox: LB_GETCOUNT + LB_GETTEXTLEN + LB_GETTEXT in a for-loop | |
| ControlGet List (ListView) | LVM_GETITEMCOUNT + LVM_GETHEADER + HDM_GETITEMCOUNT + for-loop: WriteProcessMemory + LVM_GETITEMTEXT + ReadProcessMemory. Selected / focused: for-loop: LVM_GETNEXTITEM (LVNI_SELECTED / LVNI_FOCUSED) | Allocate interprocess memory: GetWindowThreadProcessId + OpenProcess + VirtualAllocEx for a local LVITEM with UINT (32-bit) or UINT64 (64-bit) |
| ControlGet List, Count... | LVM_GETITEMCOUNT. Selected: LVM_GETSELECTEDCOUNT. Focused: LVM_GETNEXTITEM (wParam: -1, lParam: LVNI_FOCUSED). Col: LVM_GETHEADER + HDM_GETITEMCOUNT | |
| ControlGet Selected | EM_GETSEL + WM_GETTEXTLENGTH + malloc + WM_GETTEXT | |
| ControlGet Style / ExStyle | GetWindowLong | GWL_STYLE / GWL_EXSTYLE |
| ControlGet Tab | TCM_GETCURSEL | |
| ControlGet Visible | IsWindowVisible | |
| ControlGetFocus | GetGUIThreadInfo | GUITHREADINFO.hwndFocus |
| ControlGetPos | GetWindowRect | The coordinates are subtracted from the non-child parent (GetAncestor). |
| ControlGetText | WM_GETTEXTLENGTH + WM_GETTEXT | SendMessageTimeout with the flag SMTO_ABORTIFHUNG. |
| ControlMove | GetWindowRect + GetParent + ScreenToClient + MoveWindow | The first three functions are needed if either coordinate is unspecified. |
| ControlSend | ||
| ControlSendRaw | ||
| ControlSetText | WM_SETTEXT | |
| Cos | qmathCos (qmath.h, assembly code) | Alternative: cos (math.h) |
| Drive Eject | GetDriveType + mciSendString | "set cdaudio door %s wait" (%s = "closed" or "open"). Other commands for specific drive letter. |
| Drive Label | SetVolumeLabel | |
| Drive Lock | CreateFile + DeviceIoControl | IOCTL_STORAGE_MEDIA_REMOVAL, PREVENT_MEDIA_REMOVAL.PreventMediaRemoval |
| Drive Unlock | CreateFile + DeviceIoControl | IOCTL_STORAGE_MEDIA_REMOVAL |
| DriveGet Capacity | GetDiskFreeSpaceEx | lpTotalNumberOfBytes |
| DriveGet Filesystem | GetVolumeInformation | |
| DriveGet Label | GetVolumeInformation or SetVolumeLabel | |
| DriveGet List | GetDriveType | For-loop A through Z. |
| DriveGet Serial | GetVolumeInformation | |
| DriveGet Status | GetDiskFreeSpace + GetLastError | |
| DriveGet StatusCD | mciSendString | "status cdaudio mode" or "open %s type cdaudio alias cd wait shareable" |
| DriveGet Type | GetDriveType | |
| DriveSpaceFree | GetDiskFreeSpaceEx | lpFreeBytesAvailable |
| EnvUpdate | WM_SETTINGCHANGE | Target: HWND_BROADCAST, lParam: (LPARAM)_T("Environment"), flag: SMTO_BLOCK |
| ExitApp | DestroyWindow + PostQuitMessage + deactivate all hooks | |
| Exp | qmathExp (qmath.h, assembly code) | Alternative: exp (math.h) |
| FileAppend | See FileOpen | |
| FileCopy | GetFullPathName + CopyFile | A do-while loop with FindFirstFile and FindNextFile is performed to operate on multiple files. |
| FileCopyDir | GetFullPathName + GetFileAttributes + CreateDirectory + SHFileOperation | SHFILEOPSTRUCT.wFunc = FO_COPY |
| FileCreateDir | GetFileAttributes + CreateDirectory | FileCreateDir recursively creates all needed ancestor directories. GetFileAttributes checks if the directory already exists. |
| FileCreateShortcut | IShellLink interface | CLSID_ShellLink, IID_IShellLink |
| FileDelete | DeleteFile | |
| FileExist | FindFirstFile or GetFileAttributes | |
| FileGetAttrib | GetFileAttributes | |
| FileGetShortcut | IShellLink interface | |
| FileGetSize | CreateFile + GetFileSizeEx | Alternative: FindFirstFile nFileSizeHigh << 32 | nFileSizeLow |
| FileGetTime | FindFirstFile + FileTimeToLocalFileTime | The time string from a SYSTEMTIME structure is formated with _stprintf. |
| FileGetVersion | GetFileVersionInfo + VerQueryValue | |
| FileInstall | CreateFile + FindResource + LoadResource + LockResource + WriteFile + SizeofResource + CloseHandle | FileInstall includes the specified file inside the compiled version of the script (this operation is performed by a script compiler, which invokes UpdateResource to add the raw binary data as RC data in the .rsrc section of the PE executable). Later, when the compiled script is run, the files are extracted back out onto the disk. |
| FileMove | GetFullPathName + MoveFile | A do-while loop with FindFirstFile and FindNextFile is performed to operate on multiple files. |
| FileMoveDir | GetFullPathName + GetFileAttributes + SHFileOperation | SHFILEOPSTRUCT.wFunc = FO_MOVE (the directory is copied and deleted if source and destination are on different volumes. See FileCopyDir and FileRemoveDir). |
| FileOpen | CreateFile + GetCPInfo + ReadFile (detect UTF-8 and UTF-16 LE BOMs) + WriteFile (write/append) + SetFilePointerEx (append). Standard streams (stdin/stdout/stderr): GetStdHandle. | CreateFile flags: dwDesiredAccess: GENERIC_READ (read), GENERIC_WRITE (write), GENERIC_WRITE | GENERIC_READ (append) dwShareMode: ((aFlags >> 8) & (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)); dwCreationDisposition: OPEN_EXISTING (read), CREATE_ALWAYS (write), OPEN_ALWAYS (append) |
| File.Length | GetFileSizeEx | |
| File.Read | ||
| File.Write | ||
| File.ReadLine | ||
| File.WriteLine | ||
| File.ReadNumType | ||
| File.WriteNumType | ||
| File.RawRead | ||
| File.RawWrite | ||
| File.Seek | SetFilePointerEx | liDistanceToMove |
| File.Tell | SetFilePointerEx | lpNewFilePointer |
| File.Close | CloseHandle | |
| FileRead | CreateFile + GetFileSize + ReadFile + CloseHandle | |
| FileReadLine | ||
| FileRecycle | SHFileOperation | With the parameters FO_DELETE and FOF_ALLOWUNDO. |
| FileRecycleEmpty | SHEmptyRecycleBin | |
| FileRemoveDir | RemoveDirectory or SHFileOperation (FO_DELETE) | |
| FileSelectFile | GetOpenFileName or GetSaveFileName | The working directory is changed as a side-effect. AHK fixes that. |
| FileSelectFolder | SHBrowseForFolder + SHGetPathFromIDList | |
| FileSetAttrib | SetFileAttributes | A do-while loop with FindFirstFile and FindNextFile is performed to operate on multiple files. |
| FileSetTime | LocalFileTimeToFileTime + CreateFile + SetFileTime | |
| Floor | qmathFloor (qmath.h, assembly code) | Alternative: floor (cmath.h) |
| Format | _sctprintf ("ULT" options: CharUpper and CharLower) | Alternative: innumerous variants of sprintf (_stprintf, StringCchPrintf, etc). |
| FormatTime | ||
| GetKeyState | GetKeyState | |
| Gui Add, (Control Type) | CreateWindowEx | All controls have the styles WS_CHILD and WS_VISIBLE. Almost all controls have WS_TABSTOP. Specific styles for each control type are described below. The font is applied with WM_SETFONT. The initial control text is defined with SetWindowText, except for Tab (TabCtrl_InsertItem), ListView (ListView_InsertColumn), ComboBox/DDL (CB_ADDSTRING) and ListBox (LB_ADDSTRING). |
| Gui Add, Text | CreateWindowEx: Static | |
| Gui Add, Link | CreateWindowEx: SysLink | |
| Gui Add, Picture | CreateWindowEx: Static | LoadPicture (internal AHK function), SS_BITMAP or SS_ICON, STM_SETIMAGE |
| Gui Add, GroupBox | CreateWindowEx: Button | BS_GROUPBOX |
| Gui Add, Button | CreateWindowEx: Button | Default button (BS_DEFPUSHBUTTON): DM_SETDEFID and BM_SETSTYLE |
| Gui Add, CheckBox | CreateWindowEx: Button | BS_AUTOCHECKBOX or BS_AUTO3STATE. Initial state: BM_SETCHECK. |
| Gui Add, Radio | CreateWindowEx: Button | BS_AUTORADIOBUTTON. CheckRadioButton or BM_SETCHECK. Styles: BS_AUTORADIOBUTTON | BS_NOTIFY | WS_GROUP (WS_TABSTOP is applied only to the first radio in the group). |
| Gui Add, ComboBox | CreateWindowEx: Combobox | WS_VSCROLL|CBS_AUTOHSCROLL|CBS_DROPDOWN|CBS_NOINTEGRALHEIGHT |
| Gui Add, DropDownList | CreateWindowEx: Combobox | WS_VSCROLL|CBS_DROPDOWNLIST|CBS_NOINTEGRALHEIGHT |
| Gui Add, Listbox | CreateWindowEx: Listbox | WS_VSCROLL|LBS_USETABSTOPS|LBS_NOTIFY, WS_EX_CLIENTEDGE |
| Gui Add, ListView | CreateWindowEx: WC_LISTVIEW (SysListView32) | LVS_SHOWSELALWAYS|LVS_REPORT, WS_EX_CLIENTEDGE, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP |
| Gui Add, TreeView | CreateWindowEx: WC_TREEVIEW (SysTreeView32) | TVS_SHOWSELALWAYS|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS, WS_EX_CLIENTEDGE |
| Gui Add, Edit | CreateWindowEx: Edit | WS_EX_CLIENTEDGE. Additional operations for some styles/options. |
| Gui Add, DateTime | CreateWindowEx: DATETIMEPICK_CLASS (SysDateTimePick32) | DTS_SHORTDATECENTURYFORMAT |
| Gui Add, MonthCal | CreateWindowEx: MONTHCAL_CLASS (SysMonthCal32) | |
| Gui Add, Hotkey | CreateWindowEx: HOTKEY_CLASS (msctls_hotkey32) | |
| Gui Add, UpDown | CreateWindowEx: UPDOWN_CLASS (msctls_updown32) | UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_AUTOBUDDY|UDS_ARROWKEYS |
| Gui Add, Slider | CreateWindowEx: TRACKBAR_CLASS (msctls_trackbar32) | |
| Gui Add, Progress | CreateWindowEx: PROGRESS_CLASS (msctls_progress32) | PBS_SMOOTH |
| Gui Add, Tab / Tab2 / Tab3 | CreateWindowEx: WC_TABCONTROL (SysTabControl32) | Styles: TCS_MULTILINE|WS_CLIPSIBLINGS. Tab3: CreateDialogIndirect, SetProp "ahk_dlg", EnableThemeDialogTexture, WS_EX_CONTROLPARENT. The Tab3 dialog procedure creates a pattern brush based on a bitmap of the tab dialog's background: GetClientRect + CreateCompatibleDC + CreateCompatibleBitmap + SelectObject + WM_PRINTCLIENT + CreatePatternBrush... SetTextColor + MapWindowPoints + SetBrushOrgEx + SetBkMode |
| Gui Add, ActiveX | AtlAxWinInit + CreateWindowEx: AtlAxWin | WS_CLIPSIBLINGS |
| Gui Add, StatusBar | CreateStatusWindow | SBARS_SIZEGRIP (if the window is resizable (WS_SIZEBOX)) and SBARS_TOOLTIPS |
| Gui Cancel/Hide | ShowWindow | SW_HIDE |
| Gui Color | CreateSolidBrush... | Alternative: WNDCLASSEX.hbrBackground |
| Gui Destroy | DestroyWindow | Destroy icons, bitmaps, brushes, remove the menu (SetMenu), call DragFinish, DestroyAcceleratorTable, etc. |
| Gui Flash | FlashWindow | |
| Gui Font | CreateFont... | |
| Gui Menu | CreateMenu or CreatePopupMenu + SetMenuInfo + SetMenu + CreateAcceleratorTable | MENUINFO.dwStyle = MNS_CHECKORBMP |
| Gui Minimize / Maximize / Restore | ShowWindow | SW_MINIMIZE / SW_MAXIMIZE / SW_RESTORE |
| Gui New | RegisterClassEx + CreateWindowEx + WM_SETICON, parse options, SetWindowText (title), etc | WNDCLASSEX style: CS_DBLCLKS, cbWndExtra: DLGWINDOWEXTRA. The window can also be created with "Gui Add" or "Gui Show". |
| Gui Show | SetWindowText (for title), IsZoomed, IsIconic, IsWindowVisible, AdjustWindowRectEx, GetSystemMetrics, WM_NCCALCSIZE, SystemParametersInfo (SPI_GETWORKAREA), GetWindowRect, GetClientRect, ShowWindow, etc | |
| Gui Submit | See GuiControlGet (Contents). | NoHide skips ShowWindow(mHwnd, SW_HIDE). |
| GuiClose | WM_CLOSE | |
| GuiContextMenu | WM_CONTEXTMENU | |
| GuiControl (Set Text) | SetWindowText | |
| GuiControl (CheckBox) | BM_SETCHECK | |
| GuiControl (Edit) | SetWindowText | LF is converted to CRLF if the control has the style ES_MULTILINE. |
| GuiControl (DateTime) | DateTime_SetSystemtime or DateTime_SetFormat | |
| GuiControl (MonthCal) | MonthCal_SetSelRange or MonthCal_SetCurSel | |
| GuiControl (Hotkey) | HKM_SETHOTKEY | |
| GuiControl (UpDown) | UDM_GETPOS32 or UDM_GETPOS + UDM_SETPOS32 or UDM_SETPOS | |
| GuiControl (Slider) | TBM_SETPOS | |
| GuiControl (Progress) | PBM_SETPOS or PBM_DELTAPOS | |
| GuiControl (StatusBar) | SetWindowText | Sets the text of the first part only. See SB_SetText. |
| GuiControl (Tab) | TabCtrl_InsertItem | |
| GuiControl (ComboBox/DDL) | CB_ADDSTRING | |
| GuiControl (ListBox) | LB_ADDSTRING | |
| GuiControl (Picture) | LoadPicture (internal AHK function) + STM_SETIMAGE | |
| GuiControl (Radio) | CheckRadioButton or BM_SETCHECK | |
| GuiControl +/-Option | ||
| GuiControl Choose | Tab: TabCtrl_SetCurSel or TabCtrl_SetCurFocus. ComboBox/DDL: CB_SETCURSEL. ListBox: LB_SETSEL (multiple selection) or LB_SETCURSEL | |
| GuiControl ChooseString | Tab: TabCtrl_GetItemCount + TabCtrl_GetItem + _tcscmp or lstrcmpi (to find the tab index by name) + TabCtrl_SetCurSel or TabCtrl_SetCurFocus. ComboBox/DDL: CB_SELECTSTRING. ListBox: LB_FINDSTRING + LB_SETSEL (multiple selection) or LB_SELECTSTRING | |
| GuiControl Enable/Disable | EnableWindow | |
| GuiControl Focus | SetFocus | |
| GuiControl Font | WM_SETFONT. ListView: ListView_SetTextColor. TreeView: TreeView_SetTextColor. DateTime: DateTime_SetMonthCalColor. MonthCal: MonthCal_SetColor. InvalidateRect | |
| GuiControl Move | MoveWindow and (if unspecified coords) GetWindowRect + ScreenToClient | Alternative: SetWindowPos |
| GuiControl MoveDraw | The same as above + GetWindowRect + MapWindowPoints + InvalidateRect | |
| GuiControl Show/Hide | ShowWindow | SW_SHOWNOACTIVATE or SW_HIDE |
| GuiControlGet (Contents) | UpDown: UDM_GETPOS32 or UDM_GETPOS. Slider: TBM_GETPOS. Progress: PBM_GETPOS. DateTime: DateTime_GetSystemtime. MonthCal: MonthCal_GetCurSel or MonthCal_GetSelRange. Hotkey: HKM_GETHOTKEY. CheckBox/Radio: BM_GETCHECK. DDL (+AltSubmit: position): CB_GETCURSEL. ComboBox: CB_GETCURSEL + GetWindowText + CB_FINDSTRINGEXACT + CB_GETLBTEXT. ListBox: LB_GETCURSEL + LB_GETTEXTLEN + LB_GETTEXT (single selection) or LB_GETSELCOUNT + LB_GETSELITEMS + for-loop LB_GETTEXT (multiple selection). Tab: TabCtrl_GetCurSel + TabCtrl_GetItem. ActiveX: AtlAxGetControl + QueryInterface etc. Others or "Text" param: GetWindowTextLength + GetWindowText | |
| GuiControlGet Focus | GetFocus | |
| GuiControlGet Enabled | IsWindowEnabled | |
| GuiControlGet Pos | GetWindowRect + ScreenToClient | |
| GuiControlGet Visible | IsWindowVisible | |
| GuiDropFiles | WM_DROPFILES + DragQueryFile | The window must have WS_EX_ACCEPTFILES (added by AHK). wParam is a handle to an internal Windows structure describing the dropped files. |
| GuiEscape | WM_KEYDOWN (VK_ESCAPE) | |
| GuiSize | WM_SIZE | |
| Hotkey | RegisterHotkey | See also: Keyboard and mouse hook. |
| Hotstring | Keyboard hook | |
| IL_Add | ImageList_AddMasked (bitmaps), ImageList_AddIcon (icons) | LoadPicture (AHK internal function) is used to load and determine the type of the file. |
| IL_Create | ImageList_Create | GetSystemMetrics is used to determine width and height. Flags: ILC_MASK | ILC_COLOR32 |
| IL_Delete | ImageList_Destroy | |
| IniRead | GetPrivateProfileString | |
| IniWrite | WritePrivateProfileString | |
| InStr | String manipulation | Case insensitive comparisson converts the characters to lowercase with CharLower or "char | 0x20". Alternatives: strstr, wcsstr, _tcsstr, etc. |
| Keyboard and mouse hook | SetWindowsHookEx + CallNextHookEx etc | WH_KEYBOARD_LL and WH_MOUSE_LL |
| KeyWait | For-loop, GetTickCount + GetKeyState or GetAsyncKeyState or (for joystick buttons) joyGetDevCaps + joyGetPosEx | |
| Ln | qmathLog (qmath.h, assembly code) | Alternative: log (Math.h) |
| LoadPicture | ExtractIconEx, LoadImage, etc. | FindResource, CreateIconFromResourceEx, ExtractIconEx, PrivateExtractIcons, LoadImage, OleLoadPicture... |
| Log | qmathLog10 (qmath.h, assembly code) | Alternative: log10 (math.h) |
| Loop (Files and Folders) | FindFirstFile + FindNextFile + FindClose | Recursively. |
| Loop (Registry) | RegOpenKeyEx + RegQueryInfoKey + RegEnumValue + RegEnumKeyEx + RegCloseKey | Recursively. |
| LV_Add | ListView_InsertItem | |
| LV_Add / Modify Check | ListView_InsertItem / ListView_SetItem + ListView_SetCheckState | LVITEM.state |= 0x1000 (checked) or 0x2000 (unchecked) |
| LV_Add / Modify Col | ListView_InsertItem / ListView_SetItem | LVITEM.iSubItem |
| LV_Add / Modify Focus | ListView_InsertItem / ListView_SetItem | LVITEM.state |= LVIS_FOCUSED |
| LV_Add / Modify Icon | ListView_InsertItem / ListView_SetItem | LVITEM.iImage |
| LV_Add / Modify Select | ListView_InsertItem / ListView_SetItem | LVITEM.state |= LVIS_SELECTED |
| LV_Delete | LVM_DELETEITEM or LVM_DELETEALLITEMS | |
| LV_DeleteCol | ListView_DeleteColumn + MoveMemory | |
| LV_GetCount (Items) | LVM_GETITEMCOUNT | |
| LV_GetCount Column | LVM_GETHEADER + HDM_GETITEMCOUNT | |
| LV_GetCount Selected | LVM_GETSELECTEDCOUNT | |
| LV_GetNext (Selected) | ListView_GetNextItem | LVNI_SELECTED |
| LV_GetNext Checked | ListView_GetItemCount + for-loop + ListView_GetCheckState | |
| LV_GetNext Focused | ListView_GetNextItem | LVNI_FOCUSED |
| LV_GetText (Header) | LVM_GETCOLUMN | LVCOLUMN.pszText, LVCF_TEXT mask |
| LV_GetText (Row) | LVM_GETITEM | LVITEM.pszText, LVIF_TEXT mask |
| LV_Insert | ListView_InsertItem | |
| LV_InsertCol | ListView_InsertColumn | |
| LV_Modify | ListView_SetItem | |
| LV_Modify Vis | LVM_ENSUREVISIBLE | |
| LV_ModifyCol (no params) | ListView_SetColumnWidth | For report mode only (LVS_REPORT). Param: LVSCW_AUTOSIZE. |
| LV_...Col N (width) | ListView_InsertColumn / ListView_SetColumn | LVCOLUMN.mask |= LVCF_WIDTH; LVCOLUMN.cx |
| LV_...Col Auto / AutoHdr | ListView_SetColumnWidth | LVSCW_AUTOSIZE / LVSCW_AUTOSIZE_USEHEADER |
| LV_...Col Icon | ListView_InsertColumn / ListView_SetColumn | LVCOLUMN.fmt |= LVCFMT_IMAGE, LVCOLUMN.iImage |
| LV_...Col IconRight | ListView_InsertColumn / ListView_SetColumn | LVCOLUMN.fmt |= LVCFMT_BITMAP_ON_RIGHT |
| LV_...Col (alignment) | ListView_InsertColumn / ListView_SetColumn | LVCFMT_RIGHT, LVCFMT_LEFT, LVCFMT_CENTER |
| LV_...Col (set text) | ListView_InsertColumn / ListView_SetColumn | LVCOLUMN.mask |= LVCF_TEXT; |
| LV_...Col (sort by type) | ListView_InsertColumn / ListView_SetColumn | LV_COL_INTEGER, LV_COL_FLOAT, LV_COL_TEXT |
| LV_...Col (sorting commands) | LVM_SORTITEMS or LVM_SORTITEMSEX + LVM_GETITEM + ListView_SetItem | StrCmpLogicalW (shlwapi.dll) is used for "Logical" sorting. |
| LV_...Col (sorting options) | ListView_InsertColumn / ListView_SetColumn | Sorting options: Case, CaseLocale, Desc, Logical, NoSort, Sort, SortDesc, Uni. |
| LV_SetImageList | ListView_SetImageList | Icon size is determined with ImageList_GetIconSize and GetSystemMetrics(SM_CXSMICON). |
| Menu ... Add | InsertMenuItem + CreatePopupMenu (for submenus) + SetMenuItemInfo (options) + CreateAcceleratorTable | MENUITEMINFO.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING | MIIM_STATE... (it may also include MIIM_SUBMENU and MIIM_BITMAP) |
| Menu ... Add (Separator) | InsertMenuItem | MENUITEMINFO.fType = MFT_SEPARATOR |
| Menu ... Add +Radio | SetMenuItemInfo | MENUITEMINFO.fType |= MFT_RADIOCHECK |
| Menu ... Add +Right | SetMenuItemInfo | MENUITEMINFO.fType |= MFT_RIGHTJUSTIFY |
| Menu ... Add +Break | SetMenuItemInfo | MENUITEMINFO.fType |= MFT_MENUBREAK |
| Menu ... Add +BarBreak | SetMenuItemInfo | MENUITEMINFO.fType |= MFT_MENUBARBREAK |
| Menu ... Check / Uncheck | SetMenuItemInfo | MENUITEMINFO.fState |= MFS_CHECKED or MFS_UNCHECKED |
| Menu ... Color | SetMenuInfo | MENUINFO.fMask = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS, MENUINFO.hbrBack |
| Menu ... Default | SetMenuDefaultItem | Makes the menu item bold. |
| Menu ... Delete | RemoveMenu | Additionally, the icon is destroyed and the menu bar is updated. |
| Menu ... DeleteAll | RemoveMenu (in a for-loop) | |
| Menu ... Enable / Disable | SetMenuItemInfo | MENUITEMINFO.fState |= MFS_ENABLED or MFS_DISABLED |
| Menu ... Icon | Internal AHK functions LoadPicture and IconToBitmap32 + SetMenuItemInfo | MENUITEMINFO.hbmpItem (the icon must be a bitmap). To remove the icon, set hbmpItem to NULL. |
| Menu ... Insert | InsertMenuItem | |
| Menu ... Rename | SetMenuItemInfo | MENUITEMINFO.dwTypeData |
| Menu ... Show, [X, Y] | GetCursorPos + TrackPopupMenuEx | Flags: TPM_LEFTALIGN | TPM_LEFTBUTTON |
| Menu Tray, Click | Handled in MainWindowProc (AHK_NOTIFYICON) | WM_LBUTTONDOWN or WM_LBUTTONDBLCLK |
| Menu Tray, Icon | Shell_NotifyIcon, NOTIFYICONDATA | NIM_ADD, Flags: NIF_MESSAGE | NIF_TIP | NIF_ICON, NOTIFYICONDATA.uCallbackMessage = AHK_NOTIFYICON |
| Menu Tray, NoIcon | Shell_NotifyIcon | NIM_DELETE |
| Menu Tray, Tip | Shell_NotifyIcon | NIM_MODIFY, NOTIFYICONDATA.szTip |
| Min / Max | Loop params, Min ? Val1 < Val2 : Val1 > Val2, etc. | AHK source: BIF_MinMax |
| Mod | qmathFmod (qmath.h, assembly code) | Alternative: modulus operator ("%") |
| MouseClick | mouse_event (move) + GetCursorPos + WindowFromPoint + GetWindowThreadProcessId + WM_NCHITTEST + BringWindowToTop... + mouse_event (mouse button) | mouse_event is called twice at the end for "down" and "up" events (a left click involves MOUSEEVENTF_LEFTDOWN and MOUSEEVENTF_LEFTUP). |
| MouseClickDrag | mouse_event (move), mouse_event (mouse button down), mouse_event (move), mouse_event (mouse button up) | |
| MouseGetPos | GetCursorPos + WindowFromPoint or EnumChildWindows | |
| MouseMove | mouse_event | Flags: MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE. The Speed parameter invokes mouse_event in a loop for every calculated intermediary point. Relative coordinates are converted to absolute coordinates. |
| MsgBox | MessageBox | Alternative: MessageBoxTimeout |
| NumGet | ||
| NumPut | ||
| OnMessage | Messages are handled in the window procedure. | |
| Ord | TBYTE typecasting | |
| OutputDebug | OutputDebugString | |
| PixelGetColor | GetDC or CreateDC + GetPixel + ReleaseDC or DeleteDC | |
| PixelSearch | ||
| Process Close | OpenProcess + TerminateProcess + CloseHandle | |
| Process Exist | EnumProcesses + (for process name) EnumProcessModules + GetModuleBaseName + _tsplitpath + _tcscat + _tcsicmp + CloseHandle | Without parameters: GetCurrentProcessId. |
| Process Priority | OpenProcess + SetPriorityClass + CloseHandle | |
| Process Wait / WaitClose | for (;;) + GetTickCount + "Process Exist" | |
| Random | genrand_int32 (mt19937ar-cok.cpp) | Alternatives: srand(time(NULL)), rand() % (max - min)) + min; CryptGenRandom, RtlRandomEx, rand_s (msvcrt.dll) |
| Random (NewSeed) | init_genrand (mt19937ar-cok.cpp) | Alternative: srand |
| RegDelete | RegOpenKeyEx + RegDeleteKey or RegDeleteValue + RegCloseKey | Recursively: RegEnumKeyEx + RegOpenKeyEx + RegDeleteKey or RegDeleteKeyEx |
| RegExMatch | pcre_compile2 + pcre_fullinfo + pcre_exec | PCRE library |
| RegExReplace | pcre_compile2 + pcre_fullinfo + pcre_exec... | PCRE library |
| RegRead | RegOpenKeyEx + RegQueryValueEx + RegCloseKey | |
| RegWrite | RegCreateKeyEx + RegSetValueEx + RegCloseKey | |
| Round | qmathFloor or qmathCeil + qmathPow (qmath.h, assembly code) | Alternative: round + pow (for decimal places) |
| Run | CreateProcess or ShellExecuteEx | ShellExecuteEx accepts verbs (edit, explore, find, open, print, properties). |
| RunAs | CreateProcessWithLogonW | |
| SB_SetIcon | SB_SETICON | Retrieves and destroys the old icon (SB_GETICON and DestroyIcon). See also: LoadPicture. |
| SB_SetParts | SB_SETPARTS | |
| SB_SetText | SB_SETTEXT | |
| SetRegView | KEY_WOW64_64KEY or KEY_WOW64_32KEY | Flags for RegCreateKeyEx, RegDeleteKeyEx, RegOpenKeyEx |
| SetTimer | ||
| SetWorkingDir | SetCurrentDirectory | |
| Shutdown | ExitWindowsEx | |
| Sin | qmathSin (qmath.h, assembly code) | Alternative: sin (math.h) |
| Sleep | For-loop + GetTickCount etc (MsgSleep in application.cpp) | Alternative: Sleep |
| Sort | ||
| SoundBeep | Beep | |
| SoundGet / Set | Interfaces: IMMDeviceEnumerator, IAudioEndpointVolume, IMMDevice, IDeviceTopology, IConnector, IPart, IAudioVolumeLevel, IAudioMute. | XP: mixerOpen, mixerGetDevCaps, mixerGetLineInfo, mixerGetLineControls, mixerGetControlDetails, mixerSetControlDetails, mixerClose. |
| SoundGet/SetWaveVolume | ||
| SoundPlay | PlaySound | |
| SplitPath | Parsing (_tcsrchr, etc) | Alternative: _tsplitpath |
| Sqrt | qmathSqrt (qmath.h, assembly code) | Alternative: sqrt (math.h) |
| StatusBarGetText | SB_GETPARTS, SB_GETTEXTLENGTH, SB_GETTEXT | Memory is allocated in the remote process with VirtualAllocEx and read with ReadProcessMemory. |
| StringLower | CharLower | Title case: For-loop IsCharAlpha + CharUpper or CharLower |
| StringUpper | CharUpper | |
| StrLen | _tcslen (string.h) | |
| StrReplace | ||
| StrSplit | String manipulation | Alternative: strtok or _tcstok (string.h) |
| SubStr | String manipulation | |
| SysGet | GetSystemMetrics | |
| Tan | qmathTan (qmath.h, assembly code) | Alternative: tan (math.h) |
| ToolTip | CreateWindowEx (tooltips_class32) + ToolTip messages | Messages: TTM_ADDTOOL, TTM_SETMAXTIPWIDTH, TTM_TRACKPOSITION, TTM_TRACKACTIVATE, TTM_UPDATETIPTEXT |
| Trim / LTrim / RTrim | String manipulation | |
| TV_Add | TreeView_InsertItem | TVINSERTSTRUCT.hInsertAfter = TVI_LAST |
| TV_Add / Modify Bold | TreeView_InsertItem / TreeView_SetItem | TVITEM.state |= TVIS_BOLD |
| TV_Add / Modify Check | TreeView_InsertItem / TreeView_SetItem | TVITEM.state |= adding ? 0x2000 (unchecked) : 0x1000 (checked) |
| TV_Add / Modify Expand | TreeView_InsertItem / TreeView_SetItem or TreeView_Expand | TreeView_Expand flag: TVE_EXPAND. TVITEM.state |= TVIS_EXPANDED |
| TV_Add / Modify First | TreeView_InsertItem / TreeView_SetItem | TVINSERTSTRUCT.hInsertAfter = TVI_FIRST |
| TV_Add / Modify Icon | TreeView_InsertItem / TreeView_SetItem | TVITEM.iImage and TVITEM.iSelectedImage, mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE |
| TV_Add / Modify Select | TreeView_InsertItem / TreeView_SetItem | Adding: TreeView_Select, TVGN_CARET |
| TV_Add / Modify Sort | TreeView_InsertItem / TreeView_SortChildren | Adding: TVINSERTSTRUCT.hInsertAfter = TVI_SORT |
| TV_Add / Modify Vis | TVM_ENSUREVISIBLE | |
| TV_Add / Modify VisFirst | TreeView_Select | TVGN_FIRSTVISIBLE | |
| TV_Delete | TVM_DELETEITEM | |
| TV_Get Bold | TVM_GETITEMSTATE | TVIS_BOLD |
| TV_Get Check | TVM_GETITEMSTATE | TVIS_STATEIMAGEMASK result == 0x2000 |
| TV_Get Expand | TVM_GETITEMSTATE | TVIS_EXPANDED |
| TV_GetChild | TVM_GETNEXTITEM | TVGN_CHILD |
| TV_GetCount | TVM_GETCOUNT | |
| TV_GetNext | TVM_GETNEXTITEM | TVGN_NEXT or TVGN_ROOT (when all parameters are omitted) |
| TV_GetNext Checked | For-loop: TreeView_GetChild or TreeView_GetNextSibling + TreeView_GetCheckState | |
| TV_GetParent | TVM_GETNEXTITEM | TVGN_PARENT |
| TV_GetPrev | TVM_GETNEXTITEM | TVGN_PREVIOUS |
| TV_GetSelection | TVM_GETNEXTITEM | TVGN_CARET |
| TV_GetText | TVM_GETITEM | TVITEM.mask = TVIF_TEXT, text = TVITEM.pszText |
| TV_Modify | TreeView_SetItem | |
| TV_SetImageList | TreeView_SetImageList | |
| UrlDownloadToFile | InternetOpen + InternetOpenUrl + _tfopen + InternetReadFileExA or InternetReadFile + InternetCloseHandle | InternetOpenUrl flags: INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_CACHE_WRITE |
| VarSetCapacity | FillMemory | Alternative: ZeroMemory |
| WinActivate / WinActivateBottom | BringWindowToTop etc | |
| WinActive | GetForegroundWindow | |
| WinClose | WM_CLOSE | See also: WinKill. |
| WinExist | IsWindow or EnumWindows | |
| WinGet ControlListHwnd | ||
| WinGet List | EnumWindows | |
| WinGet MinMax | IsZoomed or IsIconic | |
| WinGet PID | GetWindowThreadProcessId | |
| WinGet ProcessName | GetModuleBaseName | |
| WinGet ProcessPath | GetModuleFileNameEx | |
| WinGet Style / ExStyle | GetWindowLong | GWL_STYLE / GWL_EXSTYLE |
| WinGet TransColor | GetLayeredWindowAttributes | pcrKey, if (pdwFlags & LWA_COLORKEY) |
| WinGet Transparent | GetLayeredWindowAttributes | pbAlpha, if (pdwFlags & LWA_ALPHA) |
| WinGetActiveStats | GetForegroundWindow + GetWindowTextLength + GetWindowText + GetWindowRect | |
| WinGetActiveTitle | GetForegroundWindow + GetWindowTextLength + GetWindowText | |
| WinGetClass | GetClassName | |
| WinGetPos | GetWindowRect | |
| WinGetText | EnumChildWindows + WM_GETTEXTLENGTH + WM_GETTEXT | |
| WinGetTitle | GetWindowTextLength + GetWindowText | |
| WinHide | ShowWindowAsync | SW_HIDE |
| WinKill | WM_CLOSE | Or: GetWindowThreadProcessId + OpenProcess + TerminateProcess + CloseHandle |
| WinMaximize | ShowWindowAsync | SW_MAXIMIZE |
| WinMenuSelectItem | GetMenu or GetSystemMenu + GetMenuItemCount + GetMenuItemID + (recurse if ItemID is 0xFFFFFFFF or -1) GetSubMenu + GetMenuString + PostMessage (WM_COMMAND or WM_SYSCOMMAND) | |
| WinMinimize | ShowWindowAsync | SW_MINIMIZE or SW_FORCEMINIMIZE |
| WinMove | GetWindowRect (for unspecified coords) + MoveWindow | |
| WinRestore | ShowWindowAsync | SW_RESTORE |
| WinSet AlwaysOnTop On / Off | SetWindowPos | HWND_TOPMOST / HWND_NOTOPMOST. |
| WinSet AlwaysOnTop Toggle | GetWindowLong + SetWindowPos | GWL_EXSTYLE, WS_EX_TOPMOST |
| WinSet Bottom / Top | SetWindowPos | HWND_BOTTOM / HWND_TOP |
| WinSet Disable / Enable | EnableWindow | |
| WinSet Redraw | InvalidateRect | |
| WinSet Region | CreateRectRgn or CreateRoundRectRgn or CreateEllipticRgn or CreatePolygonRgn + SetWindowRgn | |
| WinSet Style / ExStyle | GetWindowLong + SetWindowLong | GWL_STYLE / GWL_EXSTYLE. May also call SetWindowPos and InvalidateRect to redraw. |
| WinSet TransColor | SetWindowLong | GWL_EXSTYLE, WS_EX_LAYERED, LWA_COLORKEY, LWA_ALPHA |
| WinSet Transparent | SetWindowLong + SetLayeredWindowAttributes | GWL_EXSTYLE, WS_EX_LAYERED, LWA_ALPHA |
| WinSetTitle | SetWindowText | |
| WinShow | ShowWindow |