simulate keyboard events on windows xp

This is a discussion on simulate keyboard events on windows xp within the Windows Programming forums, part of the Platform Specific Boards category; hi i am trying to simulate keyboard and mouse events on windows xp, using c++/mfc. i have included Windows.h in ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    13

    simulate keyboard events on windows xp

    hi

    i am trying to simulate keyboard and mouse events on windows xp, using c++/mfc.

    i have included Windows.h in my code and compile/link with -mwindows.

    when trying to use the structure INPUT or the function SendInput()
    the compiler says that he doesnt know it.

    when i check the MFC library, it says to include windows.h, but that it needs windows 98,windows NT service pack 3

    but i only have windows xp service pack 2
    (does service pack 3 exist for xp? i tried searching, no results)

    is there another way to simulate these events?

    or what do i need to do do use SendInput() on my windows?

    thanks a lot!!!!!

    imran

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Windows-specific. Moved.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    OK, some basic info.

    One, you're not using MFC, you're using plain Win32 API. There's nothing wrong with that - in fact, since you also seem to be using MinGW (it's a good idea to specify your compiler if you say anything about it, like mentioning a switch), you cannot use MFC, as I'm pretty sure it requires VC++. (And anyway, it only comes bundled with that.)

    Two, Windows NT is the predecessor of Windows 2000, which was followed in turn by Windows XP. Thus, Windows XP, any service pack level, is more up to date than Windows NT 4.0 SP3.

    Three,
    http://blogs.msdn.com/oldnewthing/ar...0/2065725.aspx
    http://blogs.msdn.com/oldnewthing/ar...1/2079137.aspx

    Since MinGW does not, I think, use the official Platform SDK, you'll probably have to set _WIN32_WINNT to 0x0500 manually.
    Code:
    #define _WIN32_WINNT 0x0500
    #include <windows.h>
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    13
    i tried the redefinition.

    first of all, it gives a warning that _WIN32_WINNT is being redefined

    and secondly, it still doesnt compile

    p.s.: you are right, i am using mingw (eclipse)

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    13
    ok ok

    i got it!!

    thanks a lot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows XP (and Vista) shiney look and feel
    By lightatdawn in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 09-18-2005, 03:56 PM
  2. Problem with Windows XP login
    By Tostado in forum Tech Board
    Replies: 7
    Last Post: 08-14-2004, 09:59 PM
  3. Windows events
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 12-22-2001, 01:44 PM
  4. I just got Window's XP (Home Edition)
    By Generator in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 11-03-2001, 09:40 PM
  5. windows xp and aol (im's)
    By rickc77 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-26-2001, 07:50 PM

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