Capel Posted October 16, 2009 Share Posted October 16, 2009 (edited) I'm trying to launch a 3rd party application using a vendor supplied dll. Here are some details:MRWStartupThe purpose of this API is to launch the MEDITECH 32 Bit MAGIC Workstation and set up communication between the MAGIC Workstation and the scripting program.Syntaxint MRWStartup(lpszProgram,Boolean Minimize)example: MRWStartup("C:\Path\T.EXE",Null)Return-1 = Returned if error occurs during the launching of MAGIC Workstation.Comments: This API is called by the scripting application to launch the MEDITECH 32 Bit MAGIC Workstation.Here is my AutoIT script:$result = DllCall("mrwscript.dll","int", "MRWStartup", "C:\Program Files\MEDITECH\Workstation4.x\t.exe",False)When I run this it returns 0 but the application does not launch. What am I missing? [edit to correct typo] Edited October 16, 2009 by Capel Link to comment Share on other sites More sharing options...
FuryCell Posted October 16, 2009 Share Posted October 16, 2009 (edited) I think you need to call the actual dll not the import library for it. Edited October 16, 2009 by P5ych0Gigabyte HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Capel Posted October 16, 2009 Author Share Posted October 16, 2009 Oops! That was a typo on my part. I still get the same behavior when I reference the dll. Link to comment Share on other sites More sharing options...
FuryCell Posted October 16, 2009 Share Posted October 16, 2009 (edited) Oops! That was a typo on my part. I still get the same behavior when I reference the dll. Your dllcall syntax is wrong. You never specify the types for each parameter. DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] So maybe something like DllCall("mrwscript.dll","int", "MRWStartup","str", "C:\Program Files\MEDITECH\Workstation4.x\t.exe","?",False) I'm not sure which type boolean would use in au3 so I put a ?. Anyone wanna chime in with the type? Edited October 16, 2009 by P5ych0Gigabyte HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Capel Posted October 16, 2009 Author Share Posted October 16, 2009 Ok, but it is not clear what type I should use for the last parameter which is a boolean. Link to comment Share on other sites More sharing options...
FuryCell Posted October 16, 2009 Share Posted October 16, 2009 (edited) Ok, but it is not clear what type I should use for the last parameter which is a boolean.try BOOL and see if that works.Edit:Not sure if you need the latest beta Edited October 16, 2009 by P5ych0Gigabyte HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Capel Posted October 16, 2009 Author Share Posted October 16, 2009 $result = DllCall("mrwscript.dll","int", "MRWStartup", "str","C:\Program Files\MEDITECH\Workstation4.x\t.exe","bool",False) Nope, still nothing. Link to comment Share on other sites More sharing options...
FuryCell Posted October 16, 2009 Share Posted October 16, 2009 $result = DllCall("mrwscript.dll","int", "MRWStartup", "str","C:\Program Files\MEDITECH\Workstation4.x\t.exe","bool",False)Nope, still nothing.Are you using the latest beta? HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Capel Posted October 16, 2009 Author Share Posted October 16, 2009 Yes Link to comment Share on other sites More sharing options...
FuryCell Posted October 16, 2009 Share Posted October 16, 2009 Also try the type "BOOLEAN" and a value of zero for both bool and boolean HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Capel Posted October 16, 2009 Author Share Posted October 16, 2009 Nope, none of these worked either. Link to comment Share on other sites More sharing options...
Capel Posted October 16, 2009 Author Share Posted October 16, 2009 In the documentation it suggests passing a Null.example: MRWStartup("C:\Path\T.EXE",Null)How do I pass a null from AutoIT to this dll? Link to comment Share on other sites More sharing options...
ProgAndy Posted October 16, 2009 Share Posted October 16, 2009 A BOOLEAN is in reality an ordinary int.NULL should be just 0 (a zero) in autoit. *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 Link to comment Share on other sites More sharing options...
Capel Posted October 16, 2009 Author Share Posted October 16, 2009 Thanks. I've tried the following: $dll = DllOpen("mrwscript.dll") $result = DllCall($dll,"int", "MRWStartup", "str","C:\Program Files\MEDITECH\Workstation4.x\t.exe","int",0) to no avail. The app still won't launch. Link to comment Share on other sites More sharing options...
Malkey Posted October 17, 2009 Share Posted October 17, 2009 This little routine after the DllCall may give you information that will indicate what needs to be rectified.See the help file - DllCall for the meaning of the return error values.; $result = DllCall("mrwscript.dll", "int", "MRWStartup", "str", "C:\Program Files\MEDITECH\Workstation4.x\t.exe", "int", False) Local $sRes = "MRWStartup @ERROR Return Value = " & @error & @CRLF For $x = 0 To UBound($result) - 1 $sRes &= $x & " " & $result[$x] Next ;ConsoleWrite($sRes & @CRLF) MsgBox(0, "", $sRes) ;When run, I get:-MRWStartup @ERROR Return Value = 1Because I don't have mrwscript.dll on my system. (@error = 1 unable to use the DLL file,) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 17, 2009 Moderators Share Posted October 17, 2009 The example wrapper I saw ( here: http://www.toop.ca/muse2007/ ) points to the dll here: "C:\Program Files\Meditech\Workstation3.x\mrwscript.dll" However, you seem to be calling the dll from the system directory or the script directory. Are you sure the path is correct? Based on the wrapper I looked at: ; This may work, or the dll may still need to be registered if it doesn't #Region find dll Global $s_mrw_dll = "mrwscript.dll" Global $s_mrw_dir = @ProgramFilesDir & "\Meditech\Workstation3.x" If FileExists($s_mrw_dll) = 0 Then If FileExists($s_mrw_dir & "\" & $s_mrw_dll) = 0 Then MsgBox(16, "Error", "Cannot find mrwscript.dll") Exit EndIf $s_mrw_dll = $s_mrw_dir & "\" & $s_mrw_dll EndIf #EndRegion find dll Global $i_mrw_startup = MRWStartup($s_mrw_dir & "\T.exe", False) MsgBox(64, "Info", "Return value = " & $i_mrw_startup) Func MRWStartup($s_str, $f_minimize) Local $a_mrw_startup = DllCall($s_mrw_dll, "int", "MRWStartup", "str", $s_str, "int", $f_minimize) If Not @error And $a_mrw_startup[0] <> 0 Then Return 1 Return 0 EndFuncMay work. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Capel Posted October 17, 2009 Author Share Posted October 17, 2009 (edited) Ok, here is what I tried:$dll = DllOpen("mrwscript.dll") $result = DllCall($dll,"int", "MRWStartup", "str","C:\Program Files\MEDITECH\Workstation4.x\t.exe","int",0) ConsoleWrite( "MRWStartup @ERROR Return Value = " & @error & @CRLF) For $x = 0 To UBound($result) - 1 ConsoleWrite("return[" &$x & "]= " & $result[$x] & @CRLF) NextThis yielded the following output:MRWStartup @ERROR Return Value = 0return[0]= -1return[1]= C:\Program Files\MEDITECH\Workstation4.x\t.exereturn[2]= 0I was confusing the AutoIT return value with the function return value. The only documentation I have says "-1 = Returned if error occurs during the launching of Remote Workstation."The dll is in both the sytem and script directory. Since AutoIT returns 0, it must be finding the dll, however the function is returning an error. The odd thing is that I can get this dll to work when I call it from vb.net. (both Workstation3.x and Workstation4.x) Do I need to put AutoIT in some sort of wait loop? Also, this dll can not be registered with regsvr32. Edited October 17, 2009 by Capel Link to comment Share on other sites More sharing options...
Inverted Posted October 17, 2009 Share Posted October 17, 2009 What calling method does that library use ? Link to comment Share on other sites More sharing options...
Capel Posted October 17, 2009 Author Share Posted October 17, 2009 I don't know. How would I determine this. I know it's not COM. Link to comment Share on other sites More sharing options...
Inverted Posted October 17, 2009 Share Posted October 17, 2009 I don't know. How would I determine this. I know it's not COM.Can you post the dll ? I can try to call it or debug it. 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