UGG Ireland

,Dre Beats
????MSDN?.NET Windows??????(14)?Windows ?? (Level 200)?
public partial class Server1 : ServiceBase { Thread threadForm = null; public Server1() { InitializeComponent(); } [DllImport("user32.dll")] static extern int GetDesktopWindow(); [DllImport("user32.dll")] static extern IntPtr GetProcessWindowStation(); [DllImport("kernel32.dll")] static extern IntPtr GetCurrentThreadId(); [DllImport("user32.dll")] static extern IntPtr GetThreadDesktop(IntPtr dwThread); [DllImport("user32.dll")] static extern IntPtr OpenWindowStation(string a, bool b, int c); [DllImport("user32.dll")] static extern IntPtr OpenDesktop(string lpszDesktop, uint dwFlags, bool fInherit,Monster Beats Tour, uint dwDesiredAccess); [DllImport("user32.dll")] static extern IntPtr CloseDesktop(IntPtr p); [DllImport("rpcrt4.dll",Moncler Jackets, SetLastError = true)] static extern IntPtr RpcImpersonateClient(int i); [DllImport("rpcrt4.dll", SetLastError = true)] static extern IntPtr RpcRevertToSelf(); [DllImport("user32.dll")] static extern IntPtr SetThreadDesktop(IntPtr a); [DllImport("user32.dll")] static extern IntPtr SetProcessWindowStation(IntPtr a); [DllImport("user32.dll")] static extern IntPtr CloseWindowStation(IntPtr a); protected override void OnStart(string[] args) { threadForm = new Thread(new ThreadStart(FormShow)); threadForm.Start(); } protected override void OnStop() { if (threadForm ,Monster Headphones!= null) { if (threadForm.IsAlive) { threadForm.Abort(); threadForm = null; } } } void FormShow() { GetDesktopWindow(); IntPtr hwinstaSave = GetProcessWindowStation(); IntPtr dwThreadId = GetCurrentThreadId(); IntPtr hdeskSave = GetThreadDesktop(dwThreadId); IntPtr hwinstaUser = OpenWindowStation("WinSta0", false, 33554432); if (hwinstaUser == IntPtr.Zero) { RpcRevertToSelf(); return; } SetProcessWindowStation(hwinstaUser); IntPtr hdeskUser = OpenDesktop("Default", 0, false, 33554432); RpcRevertToSelf(); if (hdeskUser == IntPtr.Zero) { SetProcessWindowStation(hwinstaSave); CloseWindowStation(hwinstaUser); return; } SetThreadDesktop(hdeskUser); IntPtr dwGuiThreadId = dwThreadId; Form1 f = new Form1(); //?FORM1???notifyIcon,UGG Ireland??????????????????????? System.Windows.Forms.Application.Run(f); dwGuiThreadId = IntPtr.Zero; SetThreadDesktop(hdeskSave); SetProcessWindowStation(hwinstaSave); CloseDesktop(hdeskUser); CloseWindowStation(hwinstaUser); } }
Related articles?
http://www.czs.gov.cn:8082/forumdisplay.php?fid=5
????MSDN?.NET Windows??????(14)?Windows ?? (Level 200)?
public partial class Server1 : ServiceBase { Thread threadForm = null; public Server1() { InitializeComponent(); } [DllImport("user32.dll")] static extern int GetDesktopWindow(); [DllImport("user32.dll")] static extern IntPtr GetProcessWindowStation(); [DllImport("kernel32.dll")] static extern IntPtr GetCurrentThreadId(); [DllImport("user32.dll")] static extern IntPtr GetThreadDesktop(IntPtr dwThread); [DllImport("user32.dll")] static extern IntPtr OpenWindowStation(string a, bool b, int c); [DllImport("user32.dll")] static extern IntPtr OpenDesktop(string lpszDesktop, uint dwFlags, bool fInherit,Monster Beats Tour, uint dwDesiredAccess); [DllImport("user32.dll")] static extern IntPtr CloseDesktop(IntPtr p); [DllImport("rpcrt4.dll",Moncler Jackets, SetLastError = true)] static extern IntPtr RpcImpersonateClient(int i); [DllImport("rpcrt4.dll", SetLastError = true)] static extern IntPtr RpcRevertToSelf(); [DllImport("user32.dll")] static extern IntPtr SetThreadDesktop(IntPtr a); [DllImport("user32.dll")] static extern IntPtr SetProcessWindowStation(IntPtr a); [DllImport("user32.dll")] static extern IntPtr CloseWindowStation(IntPtr a); protected override void OnStart(string[] args) { threadForm = new Thread(new ThreadStart(FormShow)); threadForm.Start(); } protected override void OnStop() { if (threadForm ,Monster Headphones!= null) { if (threadForm.IsAlive) { threadForm.Abort(); threadForm = null; } } } void FormShow() { GetDesktopWindow(); IntPtr hwinstaSave = GetProcessWindowStation(); IntPtr dwThreadId = GetCurrentThreadId(); IntPtr hdeskSave = GetThreadDesktop(dwThreadId); IntPtr hwinstaUser = OpenWindowStation("WinSta0", false, 33554432); if (hwinstaUser == IntPtr.Zero) { RpcRevertToSelf(); return; } SetProcessWindowStation(hwinstaUser); IntPtr hdeskUser = OpenDesktop("Default", 0, false, 33554432); RpcRevertToSelf(); if (hdeskUser == IntPtr.Zero) { SetProcessWindowStation(hwinstaSave); CloseWindowStation(hwinstaUser); return; } SetThreadDesktop(hdeskUser); IntPtr dwGuiThreadId = dwThreadId; Form1 f = new Form1(); //?FORM1???notifyIcon,UGG Ireland??????????????????????? System.Windows.Forms.Application.Run(f); dwGuiThreadId = IntPtr.Zero; SetThreadDesktop(hdeskSave); SetProcessWindowStation(hwinstaSave); CloseDesktop(hdeskUser); CloseWindowStation(hwinstaUser); } }
Related articles?
http://www.czs.gov.cn:8082/forumdisplay.php?fid=5