[winapi] WM_ messages not #defined

Started by
9 comments, last by GameDev.net 17 years, 9 months ago
Hello! I've noticed that some of the winapi's windows messages (starting by WM_) are not defined. This includes : WM_MOUSEWHEEL, WM_NCXBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, WM_XBUTTONDBLCLK, WM_XBUTTONDOWN, WM_XBUTTONUP as well as XBUTTON1, WHEEL_DELTA Now, I've looked into "winuser.h" and found that all the defines are in a #ifdef declaration like this (or something similar) : #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) I am compiling with visual studio 2003 under windows XP, it seems that the preprocessor doesn't define _WIN32_WINNT as being greater than 0x0400. What can I do? Should I define _WIN32_WINNT as 0x0500 ?
Advertisement
Quote:Original post by TrillianI am compiling with visual studio 2003 under windows XP, it seems that the preprocessor doesn't define _WIN32_WINNT as being greater than 0x0400.

What can I do? Should I define _WIN32_WINNT as 0x0500 ?


Yes, you will have to explicty define _WIN32_WINNT. For my input library I did:
#define _WIN32_WINNT 0x0501#include <windows.h>

As well as this for VS6, since setting _WIN32_WINNT would not add those defines to the outdated API files.
#if(_MSC_VER && _MSC_VER <= 1200)	#define WM_XBUTTONDOWN		0x020B	#define WM_XBUTTONUP		0x020C	#define WM_XBUTTONDBLCLK	0x020D	#define WM_XBUTTONDOWN		0x020B	#define WM_XBUTTONUP		0x020C	#define WM_XBUTTONDBLCLK	0x020D	#define MK_XBUTTON1			0x0020	#define MK_XBUTTON2			0x0040	#define GET_WHEEL_DELTA_WPARAM(wParam)  ((short)HIWORD(wParam))#endif

Also, I did not use XBUTTON1 or XBUTTON2 because those were just defines for 0 and 1 respectively (or 1 and 2), and VS6 does not have it.
Thanks Drew! I should be fine now.
why not use direct input?
Quote:Original post by Anonymous Poster
why not use direct input?


The best case one would want to use DI is when you have a specific need for Joystick and/or input device feedback. If you are not using either of those, it is reccomended to just use the Win32 API directly, which makes life a lot easier than going though DI. I don't have the link to what I'm referring to, but it's been posted around GD before. It was a MS blog entry that reccomended people to not use DI unless they needed the special features it had.

Another reason, see my sig, is you can take the Win32 API and make your own input library with lots of stuff that DI doesn't have [smile].
I'm not just handling keyboard input but also all kind of windows messages so directinput isn't the right choice. Also, directinput is nothing more than a windows message wrapper as far as I know, and I prefer designing my own.

If I ever get to use directinput, it will only be for joystick support.
Quote:Original post by Trillian
Also, directinput is nothing more than a windows message wrapper as far as I know, and I prefer designing my own.


So what about action key mapping and other such like features.

Quote:Original post by Anonymous Poster
So what about action key mapping and other such like features.


I don't know these functions so I guess I don't need them... Winapi suits perfectly my needs.

BTW, why are you trying to convince me that directinput is better than plain winapi?
So you just loop go through messages and deal with them? rather than having a game loop like
[sourec]
for(;;)
{
capture_input();
update_ai();
render();
}
[/source]
I am using winapi to build a library that will allow an ease of use as simple as you are describing... Actually, I have already built my libraries, and it's working perfectly fine.

I'm starting to understand why you prefer staying anonymous...

This topic is closed to new replies.

Advertisement