您的位置:首页 > 编程语言 > Delphi

DELPHI 让窗体不在任务栏显示

2010-02-19 13:40 609 查看
需要用到的一个函数:

LONG SetWindowLong(
HWND hWnd,
int nIndex,
LONG dwNewLong
);


其中nIndex GWL_EXSTYLE Retrieves the extended window styles.
dwNewLong WS_EX_TOOLWINDOW Creates a tool window; that is, a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE.
有关dwNewLong的更多预定义值的含义,请自行查阅CreateWindowEx的帮助信息

在窗体创建事件中加入:

SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);


如果要整个程序不在任务栏显示,可以在dpr工程文件中加入以上代码,例如:(需要引用Windows单元)

begin
Application.Initialize;
SetWindowLong(Application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: