|
是想达到这个贴中的效果:http://leifree.spaces.live.com/blog/cns!f196f89a9a9a915!257.entry
<<用管理员身份后台运行程序的VB代码>>
这个是原型
;CreateProcessWithLogon Lib "advapi32" Alias "
;CreateProcessWithLogonW (ByVal lpUsername As Long, ByVal lpDomain As Long, ByVal lpPassword As Long, ByVal dwLogonFlags As Long, ByVal lpApplicationName As Long,ByVal lpCommandLine As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInfo As PROCESS_INFORMATION) As Long
$str="dword cb;ptr lpReserved;ptr lpDesktop;dword dwX;dword dwY;dword dxXSize;DWORD dwYSize;DWORD dwXCountChars;DWORD dwYCountChars;DWORD dwFillAttribute;DWORD dwFlags; dword wShowWindow;dword cbReserved2;ushort lpReserved2;hwnd hStdInput; hwnd hStdOutput;hwnd hStdError;"
$a = DllStructCreate($str)
if @error Then
MsgBox(0,"","Error in DllStructCreate " & @error);
exit
endif
$result = DllCall("advapi32.dll", "int", "CreateProcessWithLogonW", "long", ptr($strUsername), "str", "domain", "str", "test1", "long", 1,"str","notepad.exe","str","","long",0,"str","",ptr($a),s)
[ 本帖最后由 lus5d 于 2008-9-4 14:26 编辑 ] |
|