Translate Window Style to strings | CodeGuru

Translate Window Style to strings

In many cases, the programmer needs to understand what a value means. It’s about window styles. For him 0x500000C2 means nothing as window styles. Of course, Spy++ solve this problem, but you must lookup for a window with that styles. It’s easy, to drag a cursor over the window, and then windows style can be […]

Written By
CodeGuru Staff
CodeGuru Staff
Sep 29, 1998
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

In many cases, the programmer needs to understand what a value means.
It’s about window styles. For him 0x500000C2 means nothing as window
styles. Of course, Spy++ solve this problem, but you must lookup for a
window with that styles. It’s easy, to drag a cursor over the window,
and then windows style can be founded from one of the properties pages.
Spy++ do not recognize the latest styles of some windows. For sample let
take a header control with styles set to 0x500000C2. Spy++ will give you
the styles WS_CHILD | WS_VISIBLE | HDS_HORZ | HDS_BUTTONS | 0xC0. It’s
right. What 0xC0 represent. The 0xC0 style’s sysheader32 control
represent HDS_DRAGDROP | HDS_FULLDRAG. So, I designed a short class for
translate style, extended styles, and class styles to strings. Let’s see
a short snippet code for using this class:

CTranslateWindowStyle tws;		// declare a tws member for translation styles

tws.SetStyle(pWnd);			// prepare a styles of window pWnd for translate
CString sStyles = tws.Translate();	// In sStyle will be retrieve the string as window style.

tws.SetExStyle(pWnd);
CString sExStyles = tws.Translate();	// in sExStyles, will have the extended window style.

tws.SetClassStyle(pWnd);
CString sClassStyles = tws.Translate();	// in sClassStyles, will have the class window style.

Translate(), public function of CTranslateWindowStyle class, will
translate the latest styles set (by calling one of the following
functions: SetStyle, SetExStyle, SetClassStyle.) as normal, extended,
class window style.

If you have a new window control, you can add your own style. Just see
into the header file of CTranslateWindowStyle class.

Download demo project – 46KB

Download source – 5KB

Date Posted: 09/29/98

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.