CWindow::ModifyStyleEx

修改 CWindow 对象的扩展窗口样式。

BOOL ModifyStyleEx( 
   DWORD dwRemove, 
   DWORD dwAdd, 
   UINT nFlags = 0  
) throw();

参数

  • dwRemove
    [in]用于指定在样式修改时要移除的扩展样式。

  • dwAdd
    [in]用于指定在样式修改时要添加的扩展样式。

  • nFlags
    [in]窗口定位标志。 有关可能值列表,请参见。Windows SDK的 SetWindowPos 功能。

返回值

TRUE,如果修改扩展窗口样式;否则,FALSE

备注

将添加或删除了样式可以按位组合使用或(|)运算符。 有关可用的扩展样式的信息,请参见。Windows SDK的 CreateWindowEx 功能。

如果 nFlags 不为零,ModifyStyleEx 调用Win32函数 SetWindowPos,并将 nFlags 重绘窗口与以下四个标志:

  • SWP_NOSIZE 保留当前范围。

  • SWP_NOMOVE 保留当前位置。

  • SWP_NOZORDER 保留当前的Z顺序。

  • SWP_NOACTIVATE 不窗口被激活。

使用普通窗口样式,若要修改窗口,请调用 ModifyStyle

示例

//The following example attaches an HWND to the CWindow object and  
//calls CWindow::ModifyStyleEx() to add and remove the extended  
//window styles

CWindow myWindow;
myWindow.Attach(hWnd);

//The following line removes WS_EX_CONTEXTHELP extended style from  
//the window and adds WS_EX_TOOLWINDOW extended style to the window 

myWindow.ModifyStyleEx(WS_EX_CONTEXTHELP, WS_EX_TOOLWINDOW);

要求

Header: atlwin.h

请参见

参考

CWindow Class

CWindow::GetExStyle