CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2010
    Posts
    34

    TRACKMOUSEEVENT (error C2065)

    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


    Code:
    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);
    }

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: TRACKMOUSEEVENT (error C2065)

    1. Check out your project settings correspond the requirements for TRACKMOUSEEVENT Structure
    2. Have a look at http://www.google.com/search?sourcei...red+identifier
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2010
    Posts
    34

    Re: TRACKMOUSEEVENT (error C2065)

    ohhhhhh...


    I need to have

    Code:
    #define _WIN32_WINNT 0x0400"
    before the "#include <windows.h>".


    Why this requirement is not documented in the MSDN

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: TRACKMOUSEEVENT (error C2065)

    It was documented in old previous versions of MSDN (there was a link in Requirements section)
    Victor Nijegorodov

  5. #5
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: TRACKMOUSEEVENT (error C2065)

    Well, it is documented, but I agree it could be better. If you look at the page for TRACKMOUSEEVENT, at the bottom you'll see:
    Quote Originally Posted by MSDN
    Minimum supported client: Windows 2000 Professional
    If you then take a look at Using the Windows Headers, 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
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: TRACKMOUSEEVENT (error C2065)

    Quote Originally Posted by Marc G View Post
    If you then take a look at Using the Windows Headers, 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
    It 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
    Victor Nijegorodov

  7. #7
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: TRACKMOUSEEVENT (error C2065)

    Mmmm, that's interesting, didn't know that.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: TRACKMOUSEEVENT (error C2065)

    No problem!
    I know it only because I'm still using VC++6.0
    Victor Nijegorodov

  9. #9
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: TRACKMOUSEEVENT (error C2065)

    Ah, I was wondering why you would be keeping a decade old MSDN lying around
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: TRACKMOUSEEVENT (error C2065)

    Quote Originally Posted by Marc G View Post
    Ah, I was wondering why you would be keeping a decade old MSDN lying around
    Only because it was integrated into IDE!
    Victor Nijegorodov

  11. #11
    Join Date
    Jun 2010
    Posts
    34

    Re: TRACKMOUSEEVENT (error C2065)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured