Tafkadasom2k5 Posted April 7, 2006 Share Posted April 7, 2006 Hi @ all! I am a Auto-It newbie, and so i created some functions for me in an external dll. The DLL is written in PowerBasic, and the DLL is called "OEMConvert.dll". FUNCTION OEMConv(path AS STRING) AS LONG (..codesnippets...) END FUNCTION Now I try to call the function in AU3 now: global $Path = @ScriptDir & "\OEMConvert.dll" $DLLVar = DllCall ($Path, "long", "OEMConv","Str","TODO.dat" ) But $DLLVar is "0", and nothing happens. (But in the dll are at least 1 MsgBox, which shows some variables for debugging) Whats wrong here? Thanks for help and for reading my bad english grammar-text. Gr33tz Tafkadasom2k5 Link to comment Share on other sites More sharing options...
Lazycat Posted April 7, 2006 Share Posted April 7, 2006 Hi @ all! I am a Auto-It newbie, and so i created some functions for me in an external dll. The DLL is written in PowerBasic, and the DLL is called "OEMConvert.dll". FUNCTION OEMConv(path AS STRING) AS LONG (..codesnippets...) END FUNCTION Now I try to call the function in AU3 now: global $Path = @ScriptDir & "\OEMConvert.dll" $DLLVar = DllCall ($Path, "long", "OEMConv","Str","TODO.dat" ) But $DLLVar is "0", and nothing happens. (But in the dll are at least 1 MsgBox, which shows some variables for debugging) Whats wrong here? Thanks for help and for reading my bad english grammar-text. Gr33tz Tafkadasom2k5 You have to check @error macro if DllCall was successful. Also note, if dll was called successfuly, $DLLVar will be array, where first element is result of called function, other - parameters passed to the dll. Btw, if your goal is converting Ascii to Ansi - this can be done in pure Autoit with one call. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Tafkadasom2k5 Posted April 7, 2006 Author Share Posted April 7, 2006 (edited) OK, thanks first. But why doesn't the dll work? The First line in the dll is a MessageRequester which shows all variables, which are given to it. Should i do something like this? while @error $DLLVar = DllCall ("OEMConve.dll", "long", "OEMConv","Str","TODO.dat" ) wend I don't think that this makes sense. Whats wrong with the DLLCall in my source?! Or how can i change a complete File from Ascii to Ansi? Youre right, thats my goal. But normally that should work with my self created function, too. Edited April 7, 2006 by Tafkadasom2k5 Link to comment Share on other sites More sharing options...
Lazycat Posted April 7, 2006 Share Posted April 7, 2006 OK, thanks first. But why doesn't the dll work? Whats wrong with the DLLCall in my source?! But normally that should work with my self created function, too.Hm, call looks correct. What value @error have just after call? Maybe problem with your dll export, do you checked if dll have exactly OEMConv function (not suffixed by something like @nn)? Or how can i change a complete File from Ascii to Ansi?For beta version, though. $asciiText = FileRead($sFileName, FileGetSize($sFileName)) $ansiText = Ascii2ansi($asciiText) FileWrite($sOutFileName, $ansiText) Func Ascii2ansi($sText) Local $src = DllStructCreate("char[" & StringLen($sText) + 1 & "]") Local $dst = DllStructCreate("char[" & StringLen($sText) + 1 & "]") DllStructSetData($src, 1, $sText) DllCall("user32.dll", "int", "OemToCharA", "ptr", DllStructGetPtr($src), "ptr", DllStructGetPtr($dst)) Return DllStructGetData($dst, 1) EndFunc Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Tafkadasom2k5 Posted April 7, 2006 Author Share Posted April 7, 2006 (edited) Merci! $DLLVar = DllCall ("OEMConve.dll", "long", "OEMConv","Str","TODO.dat" ) msgbox(0,"DEBUG:",@error) ....MsgBox: "0" Edited April 7, 2006 by Tafkadasom2k5 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