我做了个服务端程序,要求每次启动计算机就自动运行;我通过 windows计划任务创建了一个任务项:
1、每次开机自动运行
2、运行身份Administrator
通过测试发现,系统启动后(未登陆系统),程序已经被正常启动运行了;我用Administrator用户进入系统,可以在进程列表内看到这个运行的进程,但我访问不到它的界面;请问如何才能将这种方式运行的进程的界面调出来?最好是能单独写个程序,运行下就能把这个进程的界面show出来。

解决方案 »

  1.   

    在未登入系统时创建进程,进程应该是由winlogon桌面所管理。应该要在进入后通过自身或外部程序,将其改为当前桌面,才能看到界面。
    有关desktop说明,参考msdn:http://msdn.microsoft.com/en-us/library/windows/desktop/ms682573(v=vs.85).aspx
    A desktop has a logical display surface and contains user interface objects such as windows, menus, and hooks; it can be used to create and manage windows. Each desktop object is a securable object. When a desktop is created, it is associated with the current window station of the calling process and assigned to the calling thread. Window messages can be sent only between processes that are on the same desktop. In addition, the hook procedure of a process running on a particular desktop can only receive messages intended for windows created in the same desktop.The desktops associated with the interactive window station, Winsta0, can be made to display a user interface and receive user input, but only one of these desktops at a time is active. This active desktop, also known as the input desktop, is the one that is currently visible to the user and that receives user input. Applications can use the OpenInputDesktop function to get a handle to the input desktop. Applications that have the required access can use the SwitchDesktop function to specify a different input desktop.By default, there are three desktops in the interactive window station: Default, ScreenSaver, and Winlogon. 
    The Default desktop is created when Winlogon starts the initial process as the logged-on user. At that point, the Default desktop becomes active, and it is used to interact with the user. Whenever a secure screen saver activates, the system automatically switches to the ScreenSaver desktop, which protects the processes on the default desktop from unauthorized users. Unsecured screen savers run on Winsta0\Default.The Winlogon desktop is active while a user logs on. The system switches to the default desktop when the shell indicates that it is ready to display something, or after thirty seconds, whichever comes first. During the user's session, the system switches to the Winlogon desktop when the user presses the CTRL+ALT+DEL key sequence, or when the User Account Control (UAC) dialog box is open. 
      

  2.   

    @Avan_Lau
    多谢给出线索,我先看看,阴文的啊,我仔细看看
      

  3.   

    你这个是服务还是普通的EXE,我写的程序放在开始菜单的启动项里,登录后可以显示界面,没发现你说的问题。