WinApi() wraps a lot of Windows dlls and allows to use DllCall much easier.
Additionally it saves a lot of code :!:
Requires AutoHotkey_H.exe or dll due to DynaCall!
WinApi.ahk - or - WinApi.ahk (v2 version)
WinApi List of Functions.txt ( 6433 functions in 29 dlls ).
user.ahk.api - Save in ..\SciTE\user\user.ahk.api to have CallTips and Autocompletition for all functions in SciTe and a lot of windows constants.
mapping:
WinApi supports 4 modes:
1. Enable all functions_:=WinApi("") ;example how to load all available dlls and their functions not using any mappingMsgBox % _.GetProcAddress(_.LoadLibrary.("AutoHotkey.dll"),"ahkReady")2. Enable only certain dll(s)_:=WinApi("kernel32.dll") ;example how to load only required dll(s) not using any mappingMsgBox % _.GetProcAddress(_.LoadLibrary.("AutoHotkey.dll"),"ahkReady")3. Enable only certain functions_:=WinApi("LoadLibrary GetProcAddress") ;example how to load only required functions not using any mappingMsgBox % _.GetProcAddress(_.LoadLibrary.("AutoHotkey.dll"),"ahkReady")4. Enable only certain functions and use abbreviation mapping._:=WinApi("LoadLibrary=ll GetProcAddress=gpa") ;add/load only some functions and use abbreviation mappingMsgBox % _.gpa(_.ll("AutoHotkey.dll"),"ahkdll")You can also have a mix of 2/3/4 Add functions to existing object:
You can pass an object to WinApi so the functions will be added to your existing object.A:={} ;here an existing object will be passed to WinApi and functions will be added.WinApi("AnimateWindow=WinAni sleep",A) ;enable only 2 function and rename AnimateWindow to WinAniGui,+LastFoundhwnd:=WinExist()Gui,Show,Hide w400 h600A.WinAni(hwnd,1000,0x20000|0x10) ;show WindowA.sleep(1000) ;sleep 1000 msA.WinAni(hwnd,1000,0x10000|0x10) ;hide WindowExitAppAdd Functions to default base:Gui,Show,Hide w400 h600Gui,+LastFoundDoAnimation(WinExist())ExitAppDoAnimation(hwnd){ static init:=WinApi(true,"AnimateWindow=WinAni sleep") ;enable only 2 function and rename AnimateWindow to WinAni "".WinAni(hwnd,1000,0x20000|0x10) ;show Window "".sleep(1000) ;sleep 1000 ms "".WinAni(hwnd,1000,0x10000|0x10) ;hide Window}
I have not tested all functions, so please report any bugs.
Enjoy