亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

windows中允許服務(wù)與桌面交互的更改方法示例

 更新時間:2014年02月25日 14:53:04   作者:  
這篇文章主要介紹了windows中允許服務(wù)與桌面交互的更改方法,需要的朋友可以參考下

在Windows服務(wù)的安裝類ProjectInstaller中加入以下方法:

復(fù)制代碼 代碼如下:

protected override void OnCommitted(System.Collections.IDictionary savedState)
{
base.OnCommitted(savedState);
//將服務(wù)更改為允許桌面交互模式
ConnectionOptions coOptions = new ConnectionOptions();
coOptions.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope mgmtScope = new System.Management.ManagementScope(@"root\CIMV2", coOptions);
mgmtScope.Connect();
ManagementObject wmiService;
wmiService = new ManagementObject("Win32_Service.Name='這里是當(dāng)前服務(wù)名'");
ManagementBaseObject InParam = wmiService.GetMethodParameters("Change");
InParam["DesktopInteract"] = true;
ManagementBaseObject OutParam = wmiService.InvokeMethod("Change", InParam, null);
}

相關(guān)文章

最新評論