Jump to content

Unable to open DLL files


Satvik
 Share

Recommended Posts

Hi 

I am trying to open a dll using DLLOpen, however everytime i try to do so the function fails and returns -1 result. 

I have the dll in the same folder as the auto it script. 

Local $hDLL = DllOpen("C:\Users\310255155\Downloads\COMMGvv2\commg.dll")
DllCall($hDLL, "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)
DllClose($hDLL)
MsgBox(0,'result',$hDLL)

 

Link to comment
Share on other sites

Using nirsoft's free DLL Export Viewer @ http://www.nirsoft.net/utils/dll_export_viewer.html, I could not find the export function, "MessageBox" in the "commg.dll" file.

To dllcall a message box, see the  _WinAPI_MessageBoxIndirect function.

First, look up _WinAPI_MessageBoxIndirect in the AutoIt help file and try the example, then;
Secondly, open the include file, WinAPIDlg.au3, and look at the actual workings of the _WinAPI_MessageBoxIndirect function.
You'll see "MessageBoxIndirectW" is the export function used from the "user32.dll" file.

Note : The return values of  the _WinAPI_MessageBoxIndirect function is the same as the return values of  the MsgBox function, which depends on which button is pressed in the message box.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...