0
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

const int SW_SHOW =5;

string Tartgetfile = @"C:\BringLog.exe";
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.StartInfo.CreateNoWindow = false;
p.StartInfo.FileName = Tartgetfile;
try
 {
  if (p.Start() == true)
   {
     ShowWindow(p.Handle, SW_SHOW);
     WriteToLog("PROCESS STARTED");
   }
  else
   {
    WriteToLog("FAILED TO START PROCESS");
   }
 }
catch (Exception ex)
 {
  WriteToLog("FAILED TO START PROCESS" + ex.Message+ ex.Source);
 }                     

i have used this code in my service onsessionchange event, the service start my application on logon event but application is hidden but running. i couldn't view

4

1 回答 1

1

默认情况下,服务无权访问任何会话——登录会话,Vista 中的安全 UAC,甚至普通用户会话都没有。因此,他们没有地方可以展示他们的窗户。这很好。它周围有黑客,但正确的方法可能是在 Windows Station "Winsta0" 中创建进程。STARTUPINFO.lpDesktop ="winsta0\default";调用时设置CreateProcess( )

于 2009-05-15T15:11:39.510 回答