Valhalla Legends Forums Archive | General Programming | Win 32 Api constants

AuthorMessageTime
FuZe
When I check on MSDN and other places, they always show the constants that API functions can return. Where/How can I find these values?
August 6, 2003, 3:14 AM
Maddox
Go look in the header file that is required, or search google.
August 6, 2003, 3:21 AM
Yoni
IMO, that's an important missing feature from MSDN (showing values as well as constant names). When I wrote the BNLS protocol specification I made sure to always write a value whenever a constant name appears, but Microsoft never learned this is sometimes important... Anyway, here are a few ways to find the constant values:

1) Check the appropriate header. For example, if you wanted to check what WM_SIZE is equal to, check Winuser.h.
The appropriate header is usually listed in MSDN, either in the documentation for the constant itself (if such exists), or the documentation for the function that uses it. For example, the WM_SIZE documentation says:
[quote]Header: Declared in Winuser.h, include Windows.h[/quote]
So Winuser.h is the correct header.

2) Write a quick program:
[code]#include <windows.h>
#include <stdio.h>
int main()
{
printf("0x%x\n", WM_SIZE);
return 0;
}[/code]

3) Check the VB "API Text Viewer" program, which comes with VB 5 and VB 6, and maybe more (I don't know any more versions of VB). This gives you many of the Win32 declarations and constants in VB code style, and is more useful if you're intending to call the API from VB.

4) Just don't. In most cases, the values of the constants aren't important. If you still need one, refer to one of the 3 methods above.
August 6, 2003, 9:59 AM
Grok
I prefer VC++ IDE's "Find in Files" feature for looking up symbolic constants.

When I find the one value, it is usually in a list of related values, so I grab the whole range and convert to VB's Private Const Blah = &Hnnnnnn formatting.
August 6, 2003, 11:30 AM
Skywing
If you use Visual Assist with Visual C++, just typing the constant somewhere in an IDE editor window will often be enough for it to find the value for you and populate the top info bar.
August 6, 2003, 6:07 PM

Search