Click to See Complete Forum and Search --> : TRACKMOUSEEVENT (error C2065)


Irwan
July 11th, 2010, 01:15 AM
Guy,


In a child window WndProc(), I would like to use TrackMouseEvent(), inside WM_MOUSEMOVE block so I can fired up message on WM_MOUSELEAVE.

To use TrackMouseEvent(), i need to declare TRACKMOUSEEVENT structure and fill up its data members. However, my MS Visual Studio 2005, keep telling me it I have error C2065: undeclared identifier.

I have include windows.h in the header file.

It is have been outdated?


Thanks



LRESULT CALLBACK SplitterPanel::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
static HCURSOR hcursor1, hcursor2;
static bool isHovering;
TRACKMOUSEEVENT tm; //the error pointing to


switch(iMsg){
case WM_CREATE :
hcursor1 = ::LoadCursor(NULL, IDC_SIZEWE);
hcursor2 = ::LoadCursor(NULL, IDC_ARROW);
break;

case WM_MOUSEMOVE:
break;

case WM_CLOSE :
DestroyWindow(hwnd);
break;

case WM_DESTROY :
PostQuitMessage(0);
break;
}



return ::DefWindowProc(hwnd, iMsg, wParam, lParam);
}

VictorN
July 11th, 2010, 04:25 AM
1. Check out your project settings correspond the requirements for TRACKMOUSEEVENT Structure (http://msdn.microsoft.com/en-us/library/ms645604(VS.85).aspx)
2. Have a look at http://www.google.com/search?sourceid=navclient&ie=UTF-8&rlz=1T4GGLJ_enCH344&q=TRACKMOUSEEVENT+error+C2065%3a+undeclared+identifier

Irwan
July 13th, 2010, 09:44 PM
ohhhhhh...


I need to have


#define _WIN32_WINNT 0x0400"

before the "#include <windows.h>".


Why this requirement is not documented in the MSDN

VictorN
July 14th, 2010, 01:08 AM
It was documented in old previous versions of MSDN (there was a link in Requirements section)

Marc G
July 14th, 2010, 06:47 AM
Well, it is documented, but I agree it could be better. If you look at the page for TRACKMOUSEEVENT (http://msdn.microsoft.com/en-us/library/ms645604(VS.85).aspx), at the bottom you'll see:
Minimum supported client: Windows 2000 Professional
If you then take a look at Using the Windows Headers (http://msdn.microsoft.com/en-us/library/aa383745(VS.85).aspx), you can find out what values you should use.
It's strange though that it works for you with 0x0400, because according to the docs it should be 0x0500

VictorN
July 14th, 2010, 06:55 AM
If you then take a look at Using the Windows Headers (http://msdn.microsoft.com/en-us/library/aa383745(VS.85).aspx), you can find out what values you should use.
It's strange though that it works for you with 0x0400, because according to the docs it should be 0x0500It is because MSFT cancelled any support of all OS versions prior to 2000 (such as Win98, NT4,...)
and now it appears to just "forget" these versions ever exist! :(

In my MSDN from Oct. 2000 the requirements are:Requirements
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 98.
Header: Declared in Winuser.h; include Windows.h.
which means:
_WIN32_WINDOWS=0x0410 and WINVER=0x0400

Marc G
July 14th, 2010, 07:10 AM
Mmmm, that's interesting, didn't know that.

VictorN
July 14th, 2010, 07:14 AM
No problem!
I know it only because I'm still using VC++6.0 :D

Marc G
July 14th, 2010, 07:24 AM
Ah, I was wondering why you would be keeping a decade old MSDN lying around ;)

VictorN
July 14th, 2010, 07:26 AM
Ah, I was wondering why you would be keeping a decade old MSDN lying around ;)
Only because it was integrated into IDE! ;)

Irwan
July 15th, 2010, 02:39 AM
Thanks Guys.

I don't know that I have to define the Win version. I only think the window required for the PC that the application will be declare.