H 变更


Moderators: tmplinshi, arcticir

Posts: 647
Joined: 17 Nov 2013, 11:32

H 变更

05 Oct 2014, 21:49

AutoHotkey_H New Features

Commands / Functions
Alias Create ByRef variable or share variables to other threads in a multi-thread environment.

#DllImport Create an alias function for a dll function that allows to omit parameters and use default values.

Send Sleep functionality for Send command, for example Send 123{100}456 would send 123 then sleep for 100 milliseconds and send 456.

sizeof Returns the size in bytes for default data type, structure or structure definition, for example MsgBox % sizeof("TCHAR").

OnMessage New parameter allows monitoring same message number for multiple windows and call different functions for each window.

Input While Input is running the variable will be updated instantly and will be available to script. Use SetTimer or AutoHotkey.dll to get content of variable while Input is running.
- New option A is available to append input to variable, otherwise the variable will be set empty before Input starts.

CriticalSection Creates a Critical Section Structure and returns its pointer. Use Lock and UnLock to Enter and Leave the Critical Section.
- Critical Section is requred for multi-threading environment.

Lock Enter and lock a Critical Section.

UnLock Leave and unlock a Critical Section.

TryLock Try enter and lock a Critical Section.

ahk_parent Allow to identify the right window if multiple window with same criteria exist, ahk_parent must be followed by space and Window Id. ahk_parent can be used in any Win... and Control... functions. For example WinActivate, ahk_class #32770 ahk_parent 0x3F4A5

UnZipRawMemory Decompress [and decrypt] raw zipped data, previously packed [and encrypted] with Ahk2Exe.

VarSetCapacity When the buffer size of a variable is changed and FillByte is not used and old and new capacity is > 1 byte, the original buffer content is kept/copied to the new buffer.


ComObjDll Creates a COM Object from a COM dll.

CriticalObject Create multi-thread save object.

DynaCall Imports a Dll function and defines its parameters so we don't need to define on each call like in DllCall.

Struct Creates C++ like Structure object that is accessed and modified it using object syntax.

MemoryModule Allows loading a dll from Memory, e.g. Resource.

MemoryLoadLibrary Similar to LoadLibrary but loads a dll from memory. This allows real multi-threading by loading loading a dll multiple times.

MemoryGetProcAddress Similar to GetProcAddress for MemoryModule.

MemoryFreeLibrary Similar to FreeLibrary for MemoryModule.

MemoryFindResource Similar to FindResource.

MemoryFindResourceEx Similar to FindResourceEx for MemoryModule.

MemorySizeofResource Similar to SizeOfResource for MemoryModuel.

MemoryLoadResource Similar to LoadResource.

MemoryLoadString Similar to LoadString.

MemoryLoadStringEx Similar to LoadString but allows specifying language.


NULL New built-in, variable same as FALSE. Resolves to 0.

A_IsDll returns 1 (true) if called from AutoHotkey.dll and FALSE/NULL/0 otherwise.

A_DllPath returns the path of current module (dll or exe).

A_ModuleHandle Equivalent to GetModuleHandle(NULL) but returns the correct ModuleHandle for AutoHotkey.dll when using MemoryModule

A_ScriptStruct returns pointer to internal g_script structure.

A_GlobalStruct returns pointer to internal g structure.

A_CoordModeToolTip returns current CoordMode for ToolTip, 0 = Client | 1 = Window | 2 = Screen.

A_CoordModePixel returns current CoordMode for Pixel, 0 = Client | 1 = Window | 2 = Screen.

A_CoordModeMouse returns current CoordMode for Mouse, 0 = Client | 1 = Window | 2 = Screen.

A_CoordModeCaret returns current CoordMode for Caret, 0 = Client | 1 = Window | 2 = Screen.

A_CoordModeMenu returns current CoordMode for Menu, 0 = Client | 1 = Window | 2 = Screen.


Compiling AutoHotkey Original AutoHotkey is only capable to be compiled with AutoHotkeySC.bin. In AutoHotkey_H any AutoHotkey binary (AutoHotkey.dll, AutoHotkey.exe, AutoHotkeySC.bin) can be compiled.
This allows keeping full functionality of AutoHotkey including executing other scripts. Compiled AutoHotkey.exe and AutoHotkey[Mini].dll can use /E switch to execute different script than compiled one.
Ahk2Exe Custom version of fincs Ahk2Exe compiler with support for AutoHotkey_H features.
Resource Library You can include library functions in resource of exe or dll (Resorce type must be "LIB", e.g. LIB/WATCHDIRECTORY.AHK).

Additionally AutoHotkey.dll can load library functions from exe file automatically (Note both execuables must be using same password if source is encrypted).
Note, this is not supported by AutoHotkeySC.bin.

Resource Compression and Encryption Ahk2Exe supports compression and encryption for resource files, AutoHotkey will decompress and decrypt the files internally automatically. UnZipRawMemory() can be used to decompress and decrypt resources in Script.

AutoHotkey.dll Module

AutoHotkey.dll AutoHotkey Module with COM support that can be used for multi-threading and allows AutoHotkey to be embedded into another applications. It provides AutoHotkey functionality that might be more difficult to implement in another language.

AutoHotkeyMini.dll Mini AutoHotkey Module for less memory usage and faster load.

Exported Functions Available for AutoHotkey.exe and AutoHotkey[Mini].dll

ahkIsUnicode returns 1 (true) to idenitify that dll is Unicode.

ahkFunction Call a function via SendMessage method. Mainly used with AutoHotkey[Mini].dll to call a function in dll script or call a function in main script from dll.

ahkPostFunction Call a function via PostMessage method (does not wait until function returns). Also used mainly with AutoHotkey[Mini].dll

ahkExecuteLine Executes script from given line pointer.

ahkLabel Goto (PostMessage) or Gosub (SendMessage) a Label. Also used mainly with AutoHotkey[Mini].dll

ahkFindFunction Find a function and return its pointer.

ahkFindLabel Find a label and return its pointer.

addFile Add and optionally execute additional script/code from file. Not available for scripts compiled with AutoHotkeySC.bin.

addScript Add and optionally execute additional script/code from text/memory/variable. Not available for scripts compiled with AutoHotkeySC.bin.

ahkExec Execute some script/code from text/memory/variable temporarily. Not available for scripts compiled with AutoHotkeySC.bin.

ahkassign Assign a value to variable or pointer of variable.

ahkgetvar Retrieve a value from a variable.

ahkPause Pause Script.

Exported Functions Available only in AutoHotkey[Mini].dll

ahkdll Load a new thread from a file, current thread will be terminated.

ahktextdll Load a new thread from a string/memory/variable, current thread will be terminated.

ahkReady Returns 1 (true) if a thread is being executed currently, 0 (false) otherwise.

ahkTerminate Terminate thread.

ahkTerminate Reload thread using same parameters used with ahkdll or ahktextdll.


& Retrieve pointer to any String or build in variable like &A_LoopField or &"Text".

Function Libraries
In addition to the user library in %A_MyDocuments%\AutoHotkey\Lib, standard library in the AutoHotkey directory and local library which resides in %A_ScriptDir%\Lib functions may be auto-included from a folder that %A_AhkExeDir%\lib.lnk points to. For more information, see Libraries of Functions.

Static Variables
Static variables are saved in separate array internally for better performance. Also ListVars shows static and local variables separately.
Posts: 1600
Joined: 01 Oct 2013, 14:57

Re: H 变更

06 Oct 2014, 04:23

ComObjDll Creates a COM Object from a COM dll.
User avatar
Posts: 186
Joined: 22 Nov 2013, 03:08
Location: Egret Island, China

Re: H 变更

06 Oct 2014, 05:24

tmplinshi wrote:
ComObjDll Creates a COM Object from a COM dll.
一直都有吧,还有 ComObjMemDll。
Posts: 1600
Joined: 01 Oct 2013, 14:57

Re: H 变更

06 Oct 2014, 05:26


Return to “其他”

Who is online

Users browsing this forum: No registered users and 1 guest