Sign in to follow this  
Followers 0
StungStang

Dll question

8 posts in this topic

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

$sPath = '"C:program filesTEST.exe" -nogui'
MsgBox(0,"",PathRemoveArgs($sPath))

Func PathRemoveArgs($sPath)
     Local $aRet = DllCall("shlwapi.dll","none","PathRemoveArgs","str",$sPath)
     If @error Then
        SetError(1,0,False)
     Else
        Return $aRet[1]
     EndIf
EndFunc


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Share this post


Link to post
Share on other sites

Ok thanks to all, problem solved ;)

Hi!

Share this post


Link to post
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
Sign in to follow this  
Followers 0