Jump to content

DllCall confusion


Go to solution Solved by funkey,

Recommended Posts

Hello all,

$open = DllOpen("Shell32.dll")
DllCall($open , "int" , "ShellExecuteW" , _
        "HWND" , "NONE" , _
        "wstr" , "open", _
        "wstr" , *filepath* , _
        "wstr" , "NONE" , _
        "wstr" , "NONE" , _
        "int" , "1")
DllClose($open)

So I've been tinkering with the code above, and for the most part it works, however, when the filepath leads to an au3 script, it doesnt run the script, it instead opens it in scite editor. Of course when I compile the script this is no longer a problem. 

I was just wondering why this happens when the script is not compiled.

Thanks in advance

Link to comment
Share on other sites

It's because when you ran the SciTE installer you set it to edit scripts instead of run them. :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Solution

Use this:

Global $open = DllOpen("Shell32.dll")
DllCall($open , "int" , "ShellExecuteW" , _
        "HWND" , 0, _
        "ptr" , 0, _    ;use default verb
        "wstr" , "Test.au3" , _
        "ptr" , 0, _
        "ptr" , 0, _
        "int" , 1)
DllClose($open)
Edit: Or this:

Global $open = DllOpen("Shell32.dll")
DllCall($open , "int" , "ShellExecuteW" , _
        "HWND" , 0 , _
        "wstr" , "Run", _
        "wstr" , "Test.au3" , _
        "ptr" , 0, _
        "ptr" , 0, _
        "int" , 1)
DllClose($open)
Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Thank you funkey, works perfectly

You are welcome, but why not use inbuild ShellExecute() function?

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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...