Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CreateProcessWithLogonW returns error
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00875077
Message ID:
00875081
Vues:
21
I did:

How to Start a Process as Another User (NT/XP/2K)
http://www.news2news.com/vfp/?example=426&function=696

Here is your solution -- convert strings to Unicode, cheer up :)
LOCAL cProcInfo, cStartInfo, nResult, hProcess, hThread
cProcInfo = REPLICATE(CHR(0), PROC_INFO_SIZE)
cStartInfo = PADR(CHR(START_INFO_SIZE), START_INFO_SIZE, CHR(0))
cDomain = ConvStr(cDomain)
cUsr = ConvStr(cUsr)
cPwd = ConvStr(cPwd)
cApp = ConvStr(cApp)
cCmd = ConvStr(" " + ALLTRIM(cCmd))  && note a leading space
cDir = ConvStr(cDir)

	nResult = CreateProcessWithLogonW(cUsr, cDomain, cPwd,;
		LOGON_WITH_PROFILE, cApp, cCmd, CREATE_DEFAULT_ERROR_MODE,;
		0, cDir, @cStartInfo, @cProcInfo)
...
FUNCTION ConvStr(cStr)
#DEFINE STRCONV_UNICODE  5
RETURN STRCONV(cStr+CHR(0), STRCONV_UNICODE)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform