这是出错代码的片段:
if CreateProcessWithLogonW(PWideChar(AUser), PWideChar(ADomain),
PWideChar(APass),
LOGON_WITH_PROFILE, nil, PWideChar(AExe),
NORMAL_PRIORITY_CLASS, nil, nil, STARTUPINFO, ProcessInfo) then
begin
Application.Terminate
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide)
end
else
begin
showmessage('程序出错');
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide)
Application.Terminate
end
编译后 出现
[错误] Missing operator or semicolon
[错误] Missing operator or semicolon
请问这是那点除了问题?谢谢
if CreateProcessWithLogonW(PWideChar(AUser), PWideChar(ADomain),
PWideChar(APass),
LOGON_WITH_PROFILE, nil, PWideChar(AExe),
NORMAL_PRIORITY_CLASS, nil, nil, STARTUPINFO, ProcessInfo) then
begin
Application.Terminate
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide)
end
else
begin
showmessage('程序出错');
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide)
Application.Terminate
end
编译后 出现
[错误] Missing operator or semicolon
[错误] Missing operator or semicolon
请问这是那点除了问题?谢谢
if CreateProcessWithLogonW(PWideChar(AUser), PWideChar(ADomain),
PWideChar(APass),
LOGON_WITH_PROFILE, nil, PWideChar(AExe),
NORMAL_PRIORITY_CLASS, nil, nil, STARTUPINFO, ProcessInfo) then
begin
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide);
Application.Terminate;
end
else
begin
showmessage('程序出错');
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide);
Application.Terminate;
end
Form1.AlphaBlend:=true;
Form1.AlphaBlendValue:=0;
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 9066 /add',nil,SW_hide);
FillChar(STARTUPINFO, SizeOf(StartupInfoW), #0);
STARTUPINFO.cb := SizeOf(StartupInfoW);
STARTUPINFO.dwFlags := STARTF_USESHOWWINDOW;
STARTUPINFO.wShowWindow := SW_SHOW;
AUser :='shelluser9066';
APass :='9066';
AExe :='test.exe';if CreateProcessWithLogonW(PWideChar(AUser), PWideChar(ADomain),
PWideChar(APass),
LOGON_WITH_PROFILE, nil, PWideChar(AExe),
NORMAL_PRIORITY_CLASS, nil, nil, STARTUPINFO, ProcessInfo) then
begin
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide);
Application.Terminate;
end
else
begin
showmessage('程序出错');
ShellExecute(Handle,nil,'cmd.exe','/c net user shelluser9066 /del',nil,SW_hide);
Application.Terminate;
end
end;
end.
为什么以后程序运行后弹出提示框都是“程序出错”?
test.exe位置绝对正确。
begin
ShellExecute(GetDesktopWindow,'cmd.exe','/c net user shelluser9066 9066 /add',nil,SW_hide);
end;
错误: Incompatible types:'Integer' and 'PAnsiChar'
麻烦解决以下谢谢了给分
不过又出来了个错误:
错误:XXX.pas(46): Declaration expected but end of file found
不过 程序运行还是直接出先提示框“程序出错”(showmessage)
有时候可以正常启动那个test程序 但是有时候出现提示框“程序出错”(showmessage)
莫名其妙~~唉