Jump to content

DllOpen returens -1 dllcall fail


Recommended Posts

@JohnOne his Problem is that his Code won't work if he uses it but if he uses mine it work. °-°

That's the main Problem.

Edit:  That it inside of func won't work (because he Forget func2() maybe)

Please be clear since you seem know what TheShap problems are.

Is it your dll file that is working for him, or his dll file with your AutoIt code?

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

If his Posts are the truth than only both of mine °-° Maybe there is some bug with the dll .

Maybe he wrote something wrong within the dll which didn't got detected as an error and compiled within the dll and cause that it can't be opened or the AutoIt Code of him since the begin don't "want" to open it. but we should wait till he's back and answer it.

Edited by RaiNote
  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Link to comment
Share on other sites

ok so I see a little confusion here. Let me make it clear.

I am am able to Run DLLCall.exe and DllCall.au3 and get a MSgBox. 

but if I make DllCall into a function, for example lets say func2 (like before) and then call the function form my main program, The MsgBox will not appeare. And  DllOpen will return -1. 

(I am using DLLCall.au3  RaiNote provided with)

My main function has while 1 loop that calls func2 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Func func2()
$dll1 = DllOpen("DllBasics.dll")
DllCall($dll1,"none","Function")
DllCall($dll1,"none","Function")
EndFunc

Thanks for the help  

Edited by TheShaps
Link to comment
Share on other sites

If your "main program" is in the same folder as the dll you were provided, then I am lost.

The fact that it works globally (outside of a function) but not locally (inside of a function) makes absolutely no sense to me.

Can you just confirm that a call to user32.dll works globally and locally?

Just try help file example of _WinAPI_FlashWindow or something to confirm.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

so u used func2() in main ?

DLL()
Func DLL()
    $dll1 = DllOpen("DllBasics.dll")
    DllCall($dll1, "none", "Function")
    $Value = ConsoleRead()
    $Value1 = StdoutRead(@ScriptName)
    MsgBox(0, "x", $Value & "   " & $Value1)
    Sleep(2500)
EndFunc   ;==>DLL just like this?

 

Edited by RaiNote
  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Link to comment
Share on other sites

RaiNote

func2 is within DLLCall.au3 you gave me. 

I called func2 form main program. 

JohnOne

the main function is in another folder. but I included DLLCall.au3 so I am able to call func2

calling user32.dll works Globally ,

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

;$dll1 = DllOpen("DllBasics.dll")
;DllCall($dll1,"none","Function")
;DllCall($dll1,"none","Function")
Local $hDLL = DllOpen("user32.dll")
DllCall($hDLL, "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)
DllClose($hDLL)
;SetLog("whaat")

changed DLLCall.au3 to this, and then run DLLCall.au3 by double clicking, and got a MsgBox that says "Some text" 

image.png

 

Edited by TheShaps
Link to comment
Share on other sites

If i understood it right the func2 don't work, right?

But if you do the Code without Func it work in the main ?

Could it be that the DLLCall.au3 and the main not in the same Folder?

If i understood something wrong please correct me ^-^

  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Link to comment
Share on other sites

Don't use DLLCall.au3, don't copy user32.dll to any folder, run script from SciTE (SciTE4AutoIt3) if you want #AutoIt3Wrapper directives to work, show SciTE console output, make sure you are running correct AutoIt (x86/x64).
This is all very simple but you've managed to make 3 pages on the forum.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

@trancexx

 If it was that simple why it took so Long for you to help? and i think also after your Resolution there still some questions..

  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...