Getting window style

≯℡__Kan透↙ 提交于 2019-12-05 22:19:52

use the bitwise & operator to compare with that long type,

example

if (szLng & WS_CAPTION){
    // that window has caption
}
Mike

Most of the window styles WS_ are single-bit values; that is each of them occupies only one bit in dwStyles.

Here dwStyles can be obtained from: DWORD dwStyles = CWnd::GetStyle();

But some of the WS_ styles, such as WS_CAPTION, WS_OVERLAPPEDWINDOW, WS_POPUPWINDOW, combine a few single-bit styles.

The test code below is OK for single-bit window styles but not OK for combined styles.

DWORD dwSomeStyle = WS_... ;
BOOL bSomeStyleIsPresentForThisWnd;

if (dwStyles & dwSomeStyle)
  bSomeStyleIsPresentForThisWnd = TRUE;
else
  bSomeStyleIsPresentForThisWnd = FALSE;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!