Sign in to follow this  
Followers 0
SDX2000

DLL HELP!

7 posts in this topic

Hi,

I would be grateful if some body could tell me how to pass a pre-allocated buffer to a DLL function?

Eg.

DllCall("user32.dll", "int", "wsprintf", "str", "", "str", "%s", "str", "Hello World")

Note:

1)I need to pass the pre-allocated buffer as the first argument.

2)How do I call a Dll function with a calling convention other than __stdcall


Drive C:\ is not ready, close the door!

Share this post


Link to post
Share on other sites



Thanks for the extremely prompt reply. Though I could not find the aforementioned functions within the version of autoit I have with me (v3). Let me download the latest and get back to you.

for 2:

cdecl ?

Yes cdecl would be good. If this were possible we might be able to use a variable number of arguments.


Drive C:\ is not ready, close the door!

Share this post


Link to post
Share on other sites

cdecl is supported, all sqlite exports are cdecl ;)

from helpfile:

By default, AutoIt uses the 'stdcall' calling method. To use the 'cdecl' method place ':cdecl' after the return type.
DllCall("SQLite.dll", "int:cdecl", "sqlite3_open", "str", $sDatabase_Filename , "long_ptr", 0).

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Thanks again. That was most helpful.


Drive C:\ is not ready, close the door!

Share this post


Link to post
Share on other sites

your welcome ;)

if its wsprintf you want to use make sure you read the warnings on msdn.

and btw. did you look at the StringFormat() function?

its like sprintf maybe your satisfied with that...


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Nah, wsprintf was only meant as an example. Actually I developed a wrapper around the Win Sock API and exported my functions from a dll. I Needed some way to pass a pre-allocated buffer to the recv() (WinSock API)

But I was rather surprised to see the same functionality as part of the AutoIt function set in the latest version (v3.2)


Drive C:\ is not ready, close the door!

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