Il fonctionne correctement mais renvoie une erreur quand je tente
de lancer une commande avec paramètre ( CommandLine)
exemple "C:\winnt\notepad.exe c:\test.txt"
Code : Tout sélectionner
*lpUserName = AllocateMemory(0, 1000, 0)
*lpDomainName = AllocateMemory(1, 1000, 0)
*lpPassword = AllocateMemory(2, 1000, 0)
*lpApplication = AllocateMemory(3, 1000, 0)
*lpCommandLine = AllocateMemory(4, 1000, 0)
lpProcessInfo.PROCESS_INFORMATION
lpStartUpInfo.STARTUPINFO
;convert ansi strings to unicode
MultiByteToWideChar_(#CP_ACP, 0, "UserName", -1, *lpUserName, 1000)
MultiByteToWideChar_(#CP_ACP, 0, "DomainOrLocalMachine", -1, *lpDomainName, 1000)
MultiByteToWideChar_(#CP_ACP, 0, "Password", -1, *lpPassword, 1000)
MultiByteToWideChar_(#CP_ACP, 0, "CommandLine", -1, *lpApplication, 1000)
MultiByteToWideChar_(#CP_ACP, 0, "", -1, *lpCommandLine, 1000)
If OpenLibrary(0, "ADVAPI32.DLL")
*F = IsFunction(0, "CreateProcessWithLogonW")
If *F
If CallFunctionFast(*F, *lpUserName, *lpDomainName, *lpPassword, 0, *lpApplication,*lpCommandLine,0,0,0,@lpStartUpInfo,@lpProcessInfo) = 0
Buffer.s = Space(200)
LastError.l = GetLastError_()
FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, 0, LastError, #LANG_NEUTRAL, @Buffer, 200, 0)
MessageRequester("Error",Str(LastError)+" "+Buffer,0)
EndIf
Else
MessageRequester("","Sorry - This function is not available.",0)
EndIf
CloseLibrary(0)
EndIf
Si quelqu'un pouvais m'aider
merci