如何使程序创建的子窗口显示在任务栏上(强制)?
2006-12-26 16:01
441 查看
如,在程序中使用
CMyDialog *myDlg = new CMyDialog();
myDlg->Create(IDC_MYDIALOG,NULL);
myDlg->ShowWindow(SW_SHOW);
此时创建的子窗口并不在任务栏中显示,如想要强制其在任务栏上显示,需在子窗口的OnInitDialog()中更改窗体风格。
代码如下:
ModifyStyleEx(0,WS_EX_APPWINDOW); //强制窗体在任务栏上显示
其中扩展风格如下所列:
WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.
WS_EX_APPWINDOW Forces a top-level window onto the taskbar when the window is visible.
WS_EX_CLIENTEDGE Specifies that a window has a 3D look — that is, a border with a sunken edge.
WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message.
WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key.
WS_EX_DLGMODALFRAME Designates a window with a double border that may (optionally) be created with a title bar when you specify the WS_CAPTION style flag in the dwStyle parameter.
WS_EX_LEFT Gives window generic left-aligned properties. This is the default.
WS_EX_LEFTSCROLLBAR Places a vertical scroll bar to the left of the client area.
WS_EX_LTRREADING Displays the window text using left-to-right reading order properties. This is the default.
WS_EX_MDICHILD Creates an MDI child window.
WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style will not send the WM_PARENTNOTIFY message to its parent window when the child window is created or destroyed.
WS_EX_OVERLAPPEDWINDOW Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles
WS_EX_PALETTEWINDOW Combines the WS_EX_WINDOWEDGE and WS_EX_TOPMOST styles.
WS_EX_RIGHT Gives a window generic right-aligned properties. This depends on the window class.
WS_EX_RIGHTSCROLLBAR Places a vertical scroll bar (if present) to the right of the client area. This is the default.
WS_EX_RTLREADING Displays the window text using right-to-left reading order properties.
WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
WS_EX_TOOLWINDOW Creates a tool window, which 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 task bar or in the window that appears when the user presses ALT+TAB.
WS_EX_TOPMOST Specifies that a window created with this style should be placed above all nontopmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPos member function to add or remove this attribute.
WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.
WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.
CMyDialog *myDlg = new CMyDialog();
myDlg->Create(IDC_MYDIALOG,NULL);
myDlg->ShowWindow(SW_SHOW);
此时创建的子窗口并不在任务栏中显示,如想要强制其在任务栏上显示,需在子窗口的OnInitDialog()中更改窗体风格。
代码如下:
ModifyStyleEx(0,WS_EX_APPWINDOW); //强制窗体在任务栏上显示
其中扩展风格如下所列:
WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.
WS_EX_APPWINDOW Forces a top-level window onto the taskbar when the window is visible.
WS_EX_CLIENTEDGE Specifies that a window has a 3D look — that is, a border with a sunken edge.
WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message.
WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key.
WS_EX_DLGMODALFRAME Designates a window with a double border that may (optionally) be created with a title bar when you specify the WS_CAPTION style flag in the dwStyle parameter.
WS_EX_LEFT Gives window generic left-aligned properties. This is the default.
WS_EX_LEFTSCROLLBAR Places a vertical scroll bar to the left of the client area.
WS_EX_LTRREADING Displays the window text using left-to-right reading order properties. This is the default.
WS_EX_MDICHILD Creates an MDI child window.
WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style will not send the WM_PARENTNOTIFY message to its parent window when the child window is created or destroyed.
WS_EX_OVERLAPPEDWINDOW Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles
WS_EX_PALETTEWINDOW Combines the WS_EX_WINDOWEDGE and WS_EX_TOPMOST styles.
WS_EX_RIGHT Gives a window generic right-aligned properties. This depends on the window class.
WS_EX_RIGHTSCROLLBAR Places a vertical scroll bar (if present) to the right of the client area. This is the default.
WS_EX_RTLREADING Displays the window text using right-to-left reading order properties.
WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
WS_EX_TOOLWINDOW Creates a tool window, which 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 task bar or in the window that appears when the user presses ALT+TAB.
WS_EX_TOPMOST Specifies that a window created with this style should be placed above all nontopmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPos member function to add or remove this attribute.
WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.
WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.
相关文章推荐
- 如何使对话框程序启动以及主窗口最小化时不在任务栏上显示
- 如何使对话框程序启动以及主窗口最小化时不在任务栏上显示
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- 如何在VS2010中运行控制台程序时停留在控制台显示窗口
- 如何获取某个进程的主窗口以及创建进程的程序名?
- 如何隐藏显示在任务栏中的对话框程序
- 让程序主窗口不显示在任务栏中
- 如何获取某个进程的主窗口以及创建进程的程序名?
- 如何隐藏显示在任务栏中的对话框程序
- Win7任务栏右下角小三角按钮如何显示以便隐藏更多的程序图标
- 如何获取某个进程的主窗口以及创建进程的程序名(进程映像名)
- 如何获取某个进程的主窗口以及创建进程的程序名?
- 如何在其他程序的窗口上创建按钮并使之能响应
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- 如何在任务栏显示java程序图标
- (转)用eclipse创建一个j2ee的web工程后,左面projects窗口中的项目如何没有显示webRoot文件夹,除了src的文件夹,其他都不显示
- 如何解决窗口和程序最小化后在任务栏消失的问题
- 创建一个不显示窗口的程序(2006-03-30修订)
- 基于对话框的MFC程序中,实现非模态子窗口在任务栏显示图标以及窗口左上角加图标
- java swing编程时如何让程序窗口居中显示