Jump to content

Dll question


Recommended Posts

Hi to all i'm trying to made this function: PathRemoveArgs in autoit, but this not work (it surely my fault). Here is my code:

#include <Array.au3>
$Path = '"C:\program files\TEST.exe" -nogui'
$d_call = DllCall("shlwapi.dll", "int", "PathRemoveArgs", "wstr", $Path)
If Not @error Then
_ArrayDisplay($d_call)
EndIf

That will always return the same path, but i want to know only the real path whitout it's arguments. How i can fix that?

Hi!

Link to comment
Share on other sites

Link to comment
Share on other sites

Thanks Yashied thanks a lot, but i've seen this: "This function should not be used on generic command path templates (from users or the registry)".

I'm currently reading from the values from startup key: (HKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionRun"), then i read the file path and check if the .exe exists.

Do you suggest me to use this function or what?

Hi and thank you so much.

Edited by StungStang
Link to comment
Share on other sites

Well it works just fine.

#include <WinAPIEx.au3>

$Path = '"C:\program files\TEST.exe" -nogui'

$rtn = _WinAPI_PathRemoveArgs($Path)

If Not @error Then
  ConsoleWrite($rtn & @LF)
EndIf

Exit

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

Yes this surely work fine but the dubt is about that:

"This function should not be used on generic command path templates (from users or the registry)"

As i said before I'm currently reading the values from startup key: (HKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionRun"), then i read the file path and check if the .exe exists.

If this function should not should not be used on the registry, there is a good alternative?

Hi!

Link to comment
Share on other sites

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