tschallb Posted October 13, 2008 Posted October 13, 2008 Hi Folks, Thanks for all those who answer questions here in the forums, they are a wealth of information for AutoIT newbies like me. I have been struggling with a DLLCall issue for the last couple of days as this is the first time I have ever called a DLL... Here the API Definition for the call: PRC_API_Open Method name: PRC_API_Open Format: PRCAPI_RESULT PRC_API_Open (PRC_HANDLE* phRc) Inputs PRC_HANDLE* phRc : Pointer to a Handle for later use in communicating thru PRC. Will be set by the API. Outputs PRCAPI_RESULT indicating success or failure. See the return codes section for more details. Description Opens the communication path and sets a handle to use for issuing commands back and forth to thru the API. When you are finished with the handle you must call PRC_API_Close() on it. Here is my simple code that so far is not working: $dll = DllOpen("PRCApiCli.dll") $p = DllStructCreate ("dword") $result = DllCall($dll, "int", "PRC_API_Open", "ptr", DllStructGetPtr ($p,1)) $data = DllStructGetData($p, 1) msgbox(0, "", $dll) ;Display DLL Open result msgbox(0, "", $p); Display the Dll StructCreate msgbox(0, "", $data) ;Display PRC_HANDLE msgbox(0, "", $result[0]) ;Display PRC_API_Open result DllClose($dll) Results are: $dll=1 $p=nothing $data=0 $result[0]=Error subscript used with non-Array Variable Is my DllCall line correct? Is there anything else that appears to be wrong? Thanks, Tim
LarryDalooza Posted October 13, 2008 Posted October 13, 2008 try... $dll = DllOpen("PRCApiCli.dll") $result = DllCall($dll, "int", "PRC_API_Open", "int*",0) MsgBox(0,"",$result[1]) or $dll = DllOpen("PRCApiCli.dll") $result = DllCall($dll, "int:cdecl", "PRC_API_Open", "int*",0) MsgBox(0,"",$result[1]) AutoIt has helped make me wealthy
tschallb Posted October 14, 2008 Author Posted October 14, 2008 try... $dll = DllOpen("PRCApiCli.dll") $result = DllCall($dll, "int", "PRC_API_Open", "int*",0) MsgBox(0,"",$result[1]) or $dll = DllOpen("PRCApiCli.dll") $result = DllCall($dll, "int:cdecl", "PRC_API_Open", "int*",0) MsgBox(0,"",$result[1]) Hi Larry, Thanks for the help. Unfortunately, I receive the following error for both: C:\Documents and Settings\Test Machine\My Documents\DllCall_Test.au3 (17) : ==> Subscript used with non-Array variable.: MsgBox(0,"",$result[1]) MsgBox(0,"",$result^ ERROR Any other ideas?
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