AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[AHK_H] - WinDlls()

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Mon Mar 08, 2010 2:50 pm    Post subject: [AHK_H] - WinDlls() Reply with quote

WinDlls() wraps a lot of Windows dlls and allows to use DllCall much easier.
Additionally it saves a lot of code Wink

Requires AutoHotkey_H.exe or dll due to DynaCall!

Download wrote:
WinDlls.ahk
WinDlls List of Functions.txt ( 6160 functions in 28 dlls ).
user.ahk.api - Save in ..\SciTE\user\user.ahk.api to have CallTips and Autocompletition for all functions in SciTe.


WinDlls(mapping,object) wrote:

mapping:
    WinDlls supports 4 modes:
    1. Enable all functions
    Code:
    _:=WinDlls("") ;example how to load all available dlls and their functions not using any mapping
    MsgBox % _.GetProcAddress(_.LoadLibrary.("AutoHotkey.dll"),"ahkReady")

    2. Enable only certain dll(s)
    Code:
    _:=WinDlls("kernel32.dll") ;example how to load only required dll(s) not using any mapping
    MsgBox % _.GetProcAddress(_.LoadLibrary.("AutoHotkey.dll"),"ahkReady")

    3. Enable only certain functions
    Code:
    _:=WinDlls("LoadLibrary GetProcAddress") ;example how to load only required functions not using any mapping
    MsgBox % _.GetProcAddress(_.LoadLibrary.("AutoHotkey.dll"),"ahkReady")

    4. Enable only certain functions and use abbreviation mapping.
    Code:
    _:=WinDlls("LoadLibrary=ll GetProcAddress=gpa") ;add/load only some functions and use abbreviation mapping
    MsgBox % _.gpa(_.ll("AutoHotkey.dll"),"ahkdll")

    You can also have a mix of 2/3/4

object:
    You can pass an object to WinDlls so the functions will be added to your existing object.
    Code:
    A:=Object() ;here an existing object will be passed to WinDlls and functions will be added.
    WinDlls("AnimateWindow=WinAni sleep",A) ;enable only 2 function and rename AnimateWindow to WinAni
    Gui,+LastFound
    hwnd:=WinExist()
    Gui,Show,Hide w400 h600
    A.WinAni(hwnd,1000,0x20000|0x10) ;show Window
    A.sleep(1000) ;sleep 1000 ms
    A.WinAni(hwnd,1000,0x10000|0x10) ;hide Window
    ExitApp



Of course I have not tested all functions, so please report any bugs.

Enjoy Wink
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink


Last edited by HotKeyIt on Sat Dec 24, 2011 1:09 pm; edited 14 times in total
Back to top
View user's profile Send private message
wiseley



Joined: 22 Apr 2009
Posts: 29

PostPosted: Tue Mar 09, 2010 11:56 pm    Post subject: Reply with quote

wow, this is great Shocked
Thanks HotKeyIt
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Tue May 04, 2010 12:53 pm    Post subject: Reply with quote

Looks great, thx.

I just wish DynaCall or some form of it is included in AHK_L.
_________________
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Wed Jun 02, 2010 12:17 am    Post subject: Reply with quote

Thanks guys Wink

I've fixed some and added even more functions, meanwhile 7103 functions Very Happy

Also fixed to load only required dlls and added additional parameter so you can add functions to existing object. (see examples above)
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Carcophan



Joined: 24 Dec 2008
Posts: 1308
Location: :noitacoL

PostPosted: Wed Jun 02, 2010 12:23 am    Post subject: Reply with quote

306 GDI32 calls. The gaming sector has some work to do!
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Thu Dec 22, 2011 2:30 pm    Post subject: Reply with quote

Update

- Recreated all functions and corrected all parameters and return types. (6160 functions in 28 dlls)
- All functions available as Unicode and Ansi (...W ...A) are now also available without W/A suffix.
- - For example CreateFileA and CreateFileW are also available as CreateFile
- - - CreateFile will be CreateFileA in ANSI builds and CreateFileW in UNICODE builds.

Enjoy Wink

EDIT:
Added missing functions
EDIT:
Removed duplicates and fixed some incorrect parameters
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group