Search your headers for it. If you don't have, then you'll need to download the latest Core SDK.
Here is how it is defined in the latest SDK:
You could also try keybd_event().
#if(_WIN32_WINNT >= 0x0500)
#define KEYEVENTF_UNICODE 0x0004
#define KEYEVENTF_SCANCODE 0x0008
#endif /* _WIN32_WINNT >= 0x0500 */
If that doesn't work, then you'll need to read the following technical article:
You'll be interested in the WH_JOURNALPLAYBACK hook.
From Win32 Hooks:
Applications have used hooks to:
- Simulate mouse and keyboard input (WH_JOURNALPLAYBACK). Hooks provide the only reliable way to simulate these activities. If you try to simulate these events by sending or posting messages, Windows internals do not update the keyboard or mouse state, which can lead to unexpected behavior. If hooks are used to play back keyboard or mouse events, these events are processed exactly like real keyboard or mouse events. Microsoft Excel uses hooks to implement its SEND.KEYS macro function.