






















#region "WinAPI" [DllImport("user32.dll")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll", EntryPoint = "GetWindow")] public static extern IntPtr GetWindow(IntPtr hwnd, int wCmd); #endregion //put the form onto DeskTop const int GW_CHILD = 5; //desktop hDeskTop = FindWindow("Progman", null); //get system handle hDeskTop = GetWindow(hDeskTop, GW_CHILD); //get desktop handle SetParent(this.Handle, hDeskTop); //set this form's parent as desktop
把窗体放在桌面上显示,也就是先找到 desktop窗口,设置其为程序的父窗口。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。