我做了個服務端程式,要求每次啟動計算機就自動運行;我通過 windows計劃任務創建了一個任務項:
1、每次開機自動運行
2、運行身份Administrator
通過測驗發現,系統啟動后(未登陸系統),程式已經被正常啟動運行了;我用Administrator用戶進入系統,可以在行程串列內看到這個運行的行程,但我訪問不到它的界面;
請問如何才能將這種方式運行的行程的界面調出來?最好是能單獨寫個程式,運行下就能把這個行程的界面show出來。
uj5u.com熱心網友回復:
分我大大的有,可以開帖不斷追分,希望能指點指點uj5u.com熱心網友回復:
這個我以前做過,等我找找代碼發給你。uj5u.com熱心網友回復:
莫非你先發給我的代碼不是?而且你那代碼貌似沒什么用啊!!!!!!!!!我抓了個圖,行程的情況。
uj5u.com熱心網友回復:
在未登入系統時創建行程,行程應該是由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.
uj5u.com熱心網友回復:
@Avan_Lau多謝給出線索,我先看看,陰文的啊,我仔細看看
uj5u.com熱心網友回復:
你這個是服務還是普通的EXE,我寫的程式放在開始選單的啟動項里,登錄后可以顯示界面,沒發現你說的問題。uj5u.com熱心網友回復:
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/101780.html
