CWindow::ModifyStyle

修改 CWindow 对象的windows样式。

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

参数

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

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

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

返回值

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

备注

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

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

  • SWP_NOSIZE 保留当前范围。

  • SWP_NOMOVE 保留当前位置。

  • SWP_NOZORDER 保留当前的Z顺序。

  • SWP_NOACTIVATE 不窗口被激活。

若要修改窗口的扩展的样式,请调用 ModifyStyleEx

示例

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

CWindow myWindow;
myWindow.Attach(hWnd);

//The following line removes the WS_CLIPCHILDREN style from the  
//window and adds the WS_CAPTION style to the window
myWindow.ModifyStyle(WS_CLIPCHILDREN, WS_CAPTION);

要求

Header: atlwin.h

请参见

参考

CWindow Class

CWindow::GetStyle