darkjohn20 Posted December 3, 2009 Posted December 3, 2009 Hi, I am using Windows 7, and I have a dll with MultiThreaded support (not for AutoIt) that I am trying to call a function from. I use: $Dll = DllOpen("DLL.dll") $Start = DllCall($Dll, "int", "Start", "int", "1", "int", "1") MsgBox(0, "Start:", $Start) Where the function is int Start(int Instances, int Threads) When the Dll is called, the program freezes. The only way I can figure this is that MsgBox is never called. No message comes up at all. The script freezes and a "Windows Error Reporting" process is created (yet nothing actually shows up). I have the dll in the same location as the script, and I have even tried compiling and running the script. Any ideas what to do/can it be fixed/give up now? Any more info needed can be provided.
trancexx Posted December 3, 2009 Posted December 3, 2009 It's impossible to say without the file, but do try different calling method (that would be cdecl). ♡♡♡ . eMyvnE
darkjohn20 Posted December 3, 2009 Author Posted December 3, 2009 trance, adding cdecl stops the freezing, but the call now returns nothing. not an int, not a string, nothing. From the header: int mnStart(int Number_of_instances, int Number_of_threads); My line: $Start = DllCall($DLL, "int:cdecl", "mnStart", "int", "1", "int", "0") $DLL returns a "1" when opened, so it's opening. Any more ideas? The Dll isn't mine and I cannot reproduce it or anything.
Authenticity Posted December 3, 2009 Posted December 3, 2009 How do you access the $Start variable? It should be an array type when the function succeeds.
trancexx Posted December 3, 2009 Posted December 3, 2009 (edited) DllCall() returns an array on success. Check $Start[0] edit: Authenticity was faster. Edited December 3, 2009 by trancexx ♡♡♡ . eMyvnE
darkjohn20 Posted December 3, 2009 Author Posted December 3, 2009 Thank you very much. Even if it doesn't work (the DLL that is), it at least returns something. Thanks again!
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