Are XBUTTON1 and XBUTTON2 not defined?

This topic is 4118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

MSDN says :
Quote:
 MSLLHOOKSTRUCT Structure Syntax typedef struct { POINT pt; DWORD mouseData; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo; } MSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT; Members pt ... mouseData If the message is WM_MOUSEWHEEL, the high-order word of this member is the wheel delta. The low-order word is reserved. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120. If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released, and the low-order word is reserved. This value can be one or more of the following values. Otherwise, mouseData is not used. XBUTTON1 The first X button was pressed or released. XBUTTON2 The second X button was pressed or released. ... flags time dwExtraInfo Declared in Winuser.h, include Windows.h
There is nothing defined for XBUTTON1 or XBUTTON2. But, VK_XBUTTON1, VK_XBUTTON2, MK_XBUTTON1 and MK_XBUTTON2 are all defined in winuser.h though. Yet they don't work for the same purpose.

Share on other sites
In the most recent version of the Platform SDK (and this should be the case for any Platform SDK from Win2K on up) XBUTTON1 and XBUTTON2 are both defined. To use them you must first #define _WIN32_WINNT 0x0500 before including windows.h.

Share on other sites
#define _WIN32_IE	0x0601#define _WIN32_WINNT	0x0501
on the top of my code.
Isn't that enough? The problem must be something else I believe.

I'm using DevCPP. Once I experienced that WM_INPUT message wasn't defined in the headers of DevCPP, but was defined in VS 2005. I defined it by hand in my project. Is it again something like that?

Share on other sites
You say its "at the top", by that do you mean before #include "windows.h" ? If not, that is your problem, unless your DevCPP is using a really old Windows SDK.

Share on other sites
Like this :
#define _WIN32_IE	0x0601#define _WIN32_WINNT	0x0501#include <cstdlib>#include <iostream>#include <windows.h>#include <commctrl.h>using namespace std;#include "ErrorHandling.h"#include "UsefulFunctions.h"#include "WindowClasses.h"#include "DiskFile.h"#include "TrayIcon.h"#include "Key Index.h"HINSTANCE hInstance;MSG Msg;LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);void ConstructGUIControls(int nFunster);void ConvertVKey(USHORT VKey, CHAR * szInput);void CheckParameter(char * szParam);//... (code goes on like this)

Share on other sites

Here is the code from WinUser.h (which is included from windows.h):

#if(_WIN32_WINNT >= 0x0500)
#define VK_XBUTTON1 0x05 /* NOT contiguous with L & RBUTTON */
#define VK_XBUTTON2 0x06 /* NOT contiguous with L & RBUTTON */
#endif /* _WIN32_WINNT >= 0x0500 */

Now, if you're using DevCpp, make sure you have a recent Platform SDK installed. Do a "grep XBUTTON" in your psdk/include directory to make sure those lines are in there.

Share on other sites
Then what is the difference between VK_XBUTTON1, MK_XBUTTON1 and XBUTTON1?
Why MSDN says XBUTTON1, but not VK_XBUTTON1 or MK_XBUTTON1?

Share on other sites
Search MSDN for all three (VK_XBUTTON1, MK_XBUTTON1, and XBUTTON1). It documents them all.

Two of them are used for mouse buttons, but they mean slightly different things. One has nothing to do with mouse buttons but is used for special keyboard keys instead.

All three constants are also defined in winuser.h.

Share on other sites
hplus0603 has quoted the wrong part of the file. VK_XBUTTON1, MK_XBUTTON1, and XBUTTON1 are not the same. VK_XBUTTON1 is a virtual key constant. MK_XBUTTON1 is used is the low-order word of the wParam that comes from various WM_XBUTTON* messages, XBUTTON1 is used in the high-order word of the wParam of the same various WM_XBUTTON* messages as well as in low-level hooks.

Your problem is that the Platform SDK that comes with Dev-C++ is either older or not in sync with the official Microsoft Platform SDK. I do not know if you can download a gcc port of the SDK or if you can use MS's official copy, you'll need to find that out.

Alternatively, you can use Visual C++ Express when designing Windows applications.

Share on other sites
C:\Prog\wxDevCPP\include\winuser.h --> 134kb
C:\Prog\Visual Studio\VC\PlatformSDK\Include\WinUser.h --> 288kb

The problem is solved, XBUTTONn is not defined in DevCPP's header files.
Visual Studio is indeed superior to Dev-C++, but it requires the target PC to have Framework installed on it. That is the reason I stopped using VS. But using Dev-C++, I time to time encounter this kind of difficulties.

1. 1
Rutin
19
2. 2
3. 3
JoeJ
15
4. 4
5. 5

• 22
• 19
• 11
• 13
• 17
• Forum Statistics

• Total Topics
631698
• Total Posts
3001768
×