'INPUT', undeclared identifier

This is a discussion on 'INPUT', undeclared identifier within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to use the structure INPUT with SendInput(), but it thinks it's undeclared. In the compiler (MS VC++ 6.0), ...

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    'INPUT', undeclared identifier

    I'm trying to use the structure INPUT with SendInput(), but it thinks it's undeclared. In the compiler (MS VC++ 6.0), I can list the members of the structure, and the type details of the structure, but even though I'm including windows.h, it won't recognise the structure.

    Is anyone familiar with this sort of problem?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    INPUT is declared in winuser.h within an #if (_WIN32_WINNT > 0x0400) ... #endif preprocessor conditional.

    >>Is anyone familiar with this sort of problem?<<

    Usually whenever I encounter such seeming contradictions I search the header for the function/struct/define in question. Usually it is declared within some sort of preprocessor conditional so the next step is to #define whatever the conditional requirement is or, alternatively, to put in some preprocessor conditionals of your own to declare/redefine what's missing (the latter is more common with, for example, the mingw compiler tool set).

    In your case I would suggest you #define _WIN32_WINNT 0x0500 prior to #include <windows.h>.

    But this msdn page contains the common defines and should help you make the best decision for your platform/target platform.

    Hope that helps.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    My WINVER is defined as 0x400, but I have Windows XP. Why is it so? _WIN32_WINNT isn't defined at all.

    It did work using the following:
    #define _WIN32_WINNT 0x0500

    But I'd like to know why I should have to add my own version defines.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>My WINVER is defined as 0x400, but I have Windows XP<<

    Lowest common denominator.

    >>But I'd like to know why I should have to add my own version defines.<<

    Read that msdn page on use of sdk headers.
    Certain functions that depend on a particular version of Windows are declared using conditional code. This enables you to use the compiler to detect whether your application uses functions that are not supported on its target version(s) of Windows.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Aaah, I see. Thank you.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 04:25 PM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 04:42 PM
  3. Declared identifier reported as undeclared
    By yougene in forum C Programming
    Replies: 3
    Last Post: 08-22-2006, 10:07 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. SHGetFolderPath undeclared identifier
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2003, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21