Windows Style-constant calculator.

I have very dim and foggy memories of there being a small tool that came with 'Visual C++ v4.0' for calculating window style values.

If I remember correctly it was a simple dialogue-based application that offered two list boxes, one for styles and one for extended styles. These displayed a full catalogue of the various WS_... and WS_EX_... constants respectively. I think there may also have been radio buttons to specify you wanted to view the styles specific to the various common controls as well. The user chose the styles he was interested in and a sum representing the numerical bitwise-OR combination of these selections was displayed beneath each list box. Very handy!

As with the old Win32 message documentation, in their wisdom it seems MS have neglected to include this tool with the newest release of VisualStudio. I wonder if anyone recognizes my--very woolly!--description and could point me in the direction of where I could download it?

It is certainly possible I am misremembering this thing altogether, but if it never existed it certainly should have! If I cannot find it again I may have a bash at programming my own rendition as an exercise.
I found a tool that has similar functionality. It lets to choose all the params for window creation and show a preview and creates a file with the code. Have a look at:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9085&lngWId=3

Input:
https://pasteboard.co/GOgVDWd.jpg

Output file:

HWND Window;
WNDCLASS WndClass;
MSG Msg;

ZeroMemory(&WndClass, sizeof(WNDCLASS));
WndClass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(255, 217, 217));
WndClass.hInstance = Instance;
WndClass.lpfnWndProc = WindowProc;
WndClass.lpszClassName = "WindowClass";
WndClass.lpszMenuName = "";
WndClass.hIcon = LoadIcon(NULL, IDI_ASTERISK);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);

if(!RegisterClass(&WndClass))
	return(0);

Window = CreateWindow( "WindowClass", "Hello world", WS_BORDER | WS_SIZEBOX | 
WS_THICKFRAME, CW_USDEFAULT, CW_USDEFAULT, CW_USDEFAULT, 
CW_USDEFAULT, NULL, NULL, Instance, 0);
ShowWindow(Window, SW_SHOWNORMAL);

while(GetMessage(&Msg, NULL, 0, 0))
{
	TranslateMessage(&Msg);
	DispatchMessage(&Msg);
}

Last edited on
Many thanks indeed Thomas1965!!!

That looks very close indeed to what I am after! I shall give compiling the source code a try.

My interest is because I have started to make my own controls and the VS dialogue editor insists you supply the style and extended style values for custom controls as numerical hexadecimal values rather than the familiar constants.

Update:

I never managed to find the exact application I was looking for so wrote one for myself instead!
Last edited on
Topic archived. No new replies allowed.