Sign in to follow this  
Followers 0
corgano

direct ui dll calls

7 posts in this topic

One thing led to another, and eventually I found thease 2 direct ui files. one is an example, the other is the sorce (But I don't know C++). I want to learn to use dllcall() but I can't figure it out. I want to use some of the functions and effects shown in the example. Please see attached files.

Help with this or a C++ to autoit converter would be nice.


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you could choose a specific function in the dll you want to call and post how it is defined (it'll be in one of those header files) It'd be a great help. Otherwise I can post part of a project I'm working on and explain how DllCall() works... (or a third option would be to wait for someone who knows C++ and can help you more directly I spose)

Cheers,

Matt

Edited by MattyD

Share this post


Link to post
Share on other sites

If you could choose a specific function in the dll you want to call and post how it is defined (it'll be in one of those header files) It'd be a great help. Otherwise I can post part of a project I'm working on and explain how DllCall() works... (or a third option would be to wait for someone who knows C++ and can help you more directly I spose)

Cheers,

Matt

If you looked at the example, doing anything (like the animated stuff) would be cool. I also like the second choice.


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

Okeydoke - if you feel i'm hijacking your thread please let me know... (not much to do with animation im sorry)

It requires the Windows Zero Configuration service to be running

Lesson 1 - simple dll call (opening a handle to control a wireless card)

CODE
#cs

From wlanapi.h

DWORD WINAPI WlanOpenHandle(

__in DWORD dwClientVersion,

__reserved PVOID pReserved,

__out PDWORD pdwNegotiatedVersion,

__out PHANDLE phClientHandle

);

First DWORD is the return data type

#ce

;If DllOpen() has not been called then the dll will close again after the call. Try moving line 27 to 44 and watch the output

;In this case DllOpen() is only nescessay to access more than 1 wlan handle

DllCall("WlanAPI.dll", _ ;Name of the dll to call OR dll handle returned by DllOpen()

"dword", _ ;Return data type

"WlanOpenHandle", _ ;Name of the function to call in the dll

"dword", 1, _ ;paramater 1 - DWORD dwClientVersion - value is defined in MSDN documentation (1 XP, 2 VISTA)

"ptr", 0, _ ;paramater 2 - PVOID pReserved - value of 0 (because it is reserved) - technically ptr can be interchanged with hwnd and dword as they are all 32 bit integers-> See Ln 37

"dword*", 0, _ ;paramater 3 - PDWORD pdwNegotiatedVersion - dword by reference (pointer to a dword)

"hwnd*", 0) ;paramater 4 - PHANDLE phClientHandle - handle by reference (pointer to a handle)

;--------------------------------------------------------------------------------------------------------

$DLL = DllOpen("WlanAPI.dll") ; Try moving this line to line 44

$aCall = DllCall("WlanAPI.dll", "dword", "WlanOpenHandle", "dword", 1, "ptr", 0, "dword*", 0, "hwnd*", 0)

ConsoleWrite("Ret: " & $aCall[0] & @CRLF) ;- Return value

ConsoleWrite("i_para1: " & $aCall[1] & @CRLF) ;- dwClientVersion

ConsoleWrite("r_para2: " & $aCall[2] & @CRLF) ;- pReseved

ConsoleWrite("o_para3: " & $aCall[3] & @CRLF) ;- pdwNegotiatedVersion

ConsoleWrite("o_para4: " &$aCall[4] & @CRLF) ;- phClientHandle

ConsoleWrite(@CRLF)

$aCall = DllCall("WlanAPI.dll", "dword", "WlanOpenHandle", "ptr", 1, "dword", 0, "hwnd*", 0, "ptr*", 0);data types switched!

ConsoleWrite("Ret: " & $aCall[0] & @CRLF)

ConsoleWrite("i_para1: " & $aCall[1] & @CRLF)

ConsoleWrite("r_para2: " & $aCall[2] & @CRLF)

ConsoleWrite("o_para3: " & $aCall[3] & @CRLF)

ConsoleWrite("o_para4: " &$aCall[4] & @CRLF)

ConsoleWrite(@CRLF)

$aCall = DllCall($DLL, "dword", "WlanOpenHandle", "dword", 1, "ptr", 1, "dword*", 0, "hwnd*", 0) ;returns error code 87 (invalid parameter) because pVOID is not NULL

ConsoleWrite("Ret: " & $aCall[0] & @CRLF)

ConsoleWrite("i_para1: " & $aCall[1] & @CRLF)

ConsoleWrite("r_para2: " & $aCall[2] & @CRLF)

ConsoleWrite("o_para3: " & $aCall[3] & @CRLF)

ConsoleWrite("o_para4: " &$aCall[4] & @CRLF)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Okeydoke - if you feel i'm hijacking your thread please let me know... (not much to do with animation im sorry)

It requires the Windows Zero Configuration service to be running

Lesson 1 - simple dll call (opening a handle to control a wireless card)

CODE
#cs

From wlanapi.h

DWORD WINAPI WlanOpenHandle(

__in DWORD dwClientVersion,

__reserved PVOID pReserved,

__out PDWORD pdwNegotiatedVersion,

__out PHANDLE phClientHandle

);

First DWORD is the return data type

#ce

;If DllOpen() has not been called then the dll will close again after the call. Try moving line 27 to 44 and watch the output

;In this case DllOpen() is only nescessay to access more than 1 wlan handle

DllCall("WlanAPI.dll", _ ;Name of the dll to call OR dll handle returned by DllOpen()

"dword", _ ;Return data type

"WlanOpenHandle", _ ;Name of the function to call in the dll

"dword", 1, _ ;paramater 1 - DWORD dwClientVersion - value is defined in MSDN documentation (1 XP, 2 VISTA)

"ptr", 0, _ ;paramater 2 - PVOID pReserved - value of 0 (because it is reserved) - technically ptr can be interchanged with hwnd and dword as they are all 32 bit integers-> See Ln 37

"dword*", 0, _ ;paramater 3 - PDWORD pdwNegotiatedVersion - dword by reference (pointer to a dword)

"hwnd*", 0) ;paramater 4 - PHANDLE phClientHandle - handle by reference (pointer to a handle)

;--------------------------------------------------------------------------------------------------------

$DLL = DllOpen("WlanAPI.dll") ; Try moving this line to line 44

$aCall = DllCall("WlanAPI.dll", "dword", "WlanOpenHandle", "dword", 1, "ptr", 0, "dword*", 0, "hwnd*", 0)

ConsoleWrite("Ret: " & $aCall[0] & @CRLF) ;- Return value

ConsoleWrite("i_para1: " & $aCall[1] & @CRLF) ;- dwClientVersion

ConsoleWrite("r_para2: " & $aCall[2] & @CRLF) ;- pReseved

ConsoleWrite("o_para3: " & $aCall[3] & @CRLF) ;- pdwNegotiatedVersion

ConsoleWrite("o_para4: " &$aCall[4] & @CRLF) ;- phClientHandle

ConsoleWrite(@CRLF)

$aCall = DllCall("WlanAPI.dll", "dword", "WlanOpenHandle", "ptr", 1, "dword", 0, "hwnd*", 0, "ptr*", 0);data types switched!

ConsoleWrite("Ret: " & $aCall[0] & @CRLF)

ConsoleWrite("i_para1: " & $aCall[1] & @CRLF)

ConsoleWrite("r_para2: " & $aCall[2] & @CRLF)

ConsoleWrite("o_para3: " & $aCall[3] & @CRLF)

ConsoleWrite("o_para4: " &$aCall[4] & @CRLF)

ConsoleWrite(@CRLF)

$aCall = DllCall($DLL, "dword", "WlanOpenHandle", "dword", 1, "ptr", 1, "dword*", 0, "hwnd*", 0) ;returns error code 87 (invalid parameter) because pVOID is not NULL

ConsoleWrite("Ret: " & $aCall[0] & @CRLF)

ConsoleWrite("i_para1: " & $aCall[1] & @CRLF)

ConsoleWrite("r_para2: " & $aCall[2] & @CRLF)

ConsoleWrite("o_para3: " & $aCall[3] & @CRLF)

ConsoleWrite("o_para4: " &$aCall[4] & @CRLF)

I am on a pc. No wireless card........

There is a dll in one of the attachments on the op. How would I use dllcall() on that?

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You can't.

I looked at the source and saw that the DLL uses classes. This is possible in C++, but AutoIt can not use calsses exportet from DLLs. Only plain functions are supported.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

You can't.

I looked at the source and saw that the DLL uses classes. This is possible in C++, but AutoIt can not use calsses exportet from DLLs. Only plain functions are supported.

aww.......

Dam. If this is ever added they coulf use this to add direct UI support / functions. Maby some day.......

if someone knew about c++ and dll's, they may be able to convert it and write a dll useing resorce viewer


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0