devilyn Posted March 9, 2009 Posted March 9, 2009 Hello all, thanks for reading, i need to execute a DLLCALL but i cannot figure out how too translate it to autoit (Func Description is attached). Thanks in advance.Func.txt
James Posted March 9, 2009 Posted March 9, 2009 What have you tried? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Authenticity Posted March 9, 2009 Posted March 9, 2009 ; + 2 is useless I believe but anyway, just for sure. Dim $sDirectory = 'Directory' Dim $sPlayer = 'Player1' Dim $tDirectory = DllStructCreate('wchar[' & StringLen($sDirectory) + 2 & ']') DllStructSetData($tDirectory, 1, $sDirectory) Dim $tPlayer = DllStructCreate('wchar[' & StringLeft($sPlayer) + 2 & ']') DllStructSetData($tPlayer, 1, $sPlayer) Dim $Ret = DllCall('OmPlr.dll', 'ptr', 'OmPlrOpen', 'wchar', DllStructGetData($tDirectory, 1), _ 'wchar', DllStructGetData($tPlayer, 1), 'ptr', $pPlayerHandle) That is how it should be if the *pPlayerHandle and the return value are truly handles.
devilyn Posted March 9, 2009 Author Posted March 9, 2009 What have you tried?$PlayerHandle = DllCall("omplrlib.dll", "int", "OmPlrOpen", "some_ip","some_name") - returns 0and $PlayerHandle = DllCall("omplrlib.dll", "int", "OmPlrOpen", "some_ip","some_name","hwnd" ,$hwnd) - returns 0thanks
ProgAndy Posted March 9, 2009 Posted March 9, 2009 to pass a wchar*, just use "wstr", "The string" to get the handle: use "ptr*" as param, 0 as value. -> It is the third parameter, so the result will be in $ret[3] *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
devilyn Posted March 9, 2009 Author Posted March 9, 2009 ; + 2 is useless I believe but anyway, just for sure. Dim $sDirectory = 'Directory' Dim $sPlayer = 'Player1' Dim $tDirectory = DllStructCreate('wchar[' & StringLen($sDirectory) + 2 & ']') DllStructSetData($tDirectory, 1, $sDirectory) Dim $tPlayer = DllStructCreate('wchar[' & StringLeft($sPlayer) + 2 & ']') DllStructSetData($tPlayer, 1, $sPlayer) Dim $Ret = DllCall('OmPlr.dll', 'ptr', 'OmPlrOpen', 'wchar', DllStructGetData($tDirectory, 1), _ 'wchar', DllStructGetData($tPlayer, 1), 'ptr', $pPlayerHandle) That is how it should be if the *pPlayerHandle and the return value are truly handles. Still getting "0". what am i doing wrong? dim $pPlayerHandle Dim $sDirectory = 'IP' Dim $sPlayer = 'Name' Dim $tDirectory = DllStructCreate('wchar[' & StringLen($sDirectory) & ']') DllStructSetData($tDirectory, 1, $sDirectory) Dim $tPlayer = DllStructCreate('wchar[' & StringLen($sPlayer) & ']') DllStructSetData($tPlayer, 1, $sPlayer) Dim $Ret = DllCall('omplrlib.dll', 'ptr', 'OmPlrOpen', 'wchar', DllStructGetData($tDirectory, 1), _ 'wchar', DllStructGetData($tPlayer, 1), 'ptr', $pPlayerHandle) MsgBox(0,"Show Handle" ,$pPlayerHandle)
Authenticity Posted March 9, 2009 Posted March 9, 2009 (edited) Use what ProgAndy suggested. use 'ptr*' as the parameter and return type.Edit: Also, my mistake, don't send it using wchar param. Use wstr instead. Edited March 9, 2009 by Authenticity
devilyn Posted March 9, 2009 Author Posted March 9, 2009 to pass a wchar*, just use "wstr", "The string" to get the handle: use "ptr*" as param, 0 as value. -> It is the third parameter, so the result will be in $ret[3] Like this? - ($PlayerHandle = DllCall("omplrlib.dll", "ptr*", "OmPlrOpen","ip","name"). can you please add an example? Thanks again.
Authenticity Posted March 9, 2009 Posted March 9, 2009 (edited) Dim $Ret = DllCall('OmPlr.dll', 'ptr*', 'OmPlrOpen', 'wstr', "DirectoryName", _ 'wstr', "PlayerName", 'ptr*', $pPlayerHandle) If there was no error during the call then $Ret[0] is the returned pointer and $Ret[3] is the pointer you've passed as the third parameter. Edited March 9, 2009 by Authenticity
trancexx Posted March 9, 2009 Posted March 9, 2009 Use what ProgAndy suggested. use 'ptr*' as the parameter and return type.Where did he suggested latter? ♡♡♡ . eMyvnE
trancexx Posted March 9, 2009 Posted March 9, 2009 Oh sorry, correct, it returns int...So it would be (wstr for unicode): $aCall = DllCall("OmPlr.dll", "dword", "OmPlrOpen", _ "str", $sDirectoryName, _ "str", $sPlayerName, _ "ptr*", 0) If @error Or $aCall[0] Then ;Return SetError(1, 0, 0) ; failure EndIf $hPlayer = $aCall[3] ♡♡♡ . eMyvnE
devilyn Posted March 9, 2009 Author Posted March 9, 2009 So it would be (wstr for unicode): $aCall = DllCall("OmPlr.dll", "dword", "OmPlrOpen", _ "str", $sDirectoryName, _ "str", $sPlayerName, _ "ptr*", 0) If @error Or $aCall[0] Then ;Return SetError(1, 0, 0) ; failure EndIf $hPlayer = $aCall[3] Thank you all for your help. when I'm running the example above autoit is crashing and console says : >Running:(3.2.12.1):C:\Program Files\AutoIt3\autoit3.exe "D:\Desktop\Lior Bkp\Tools\DaletPlus\AU3 Scripts\OmniTest\Main.au3" !>16:01:33 AutoIT3.exe ended.rc:-1073741819 +>16:01:34 AutoIt3Wrapper Finished >Exit code: -1073741819 Time: 3.391
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