SDX2000 Posted November 24, 2006 Share Posted November 24, 2006 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! Link to comment Share on other sites More sharing options...
piccaso Posted November 24, 2006 Share Posted November 24, 2006 for 2: cdecl ? for 1: DllStructCreate() DllStructGetPtr() or so... CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
SDX2000 Posted November 24, 2006 Author Share Posted November 24, 2006 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! Link to comment Share on other sites More sharing options...
piccaso Posted November 24, 2006 Share Posted November 24, 2006 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 Link to comment Share on other sites More sharing options...
SDX2000 Posted November 24, 2006 Author Share Posted November 24, 2006 Thanks again. That was most helpful. Drive C:\ is not ready, close the door! Link to comment Share on other sites More sharing options...
piccaso Posted November 24, 2006 Share Posted November 24, 2006 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 Link to comment Share on other sites More sharing options...
SDX2000 Posted November 24, 2006 Author Share Posted November 24, 2006 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! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now