This is a pure win32 program. I've defined the winver and included windows.h but I still get the error.
error C2065: 'KEYBDINPUT' : undeclared identifier
error C2065: 'KEYBDINPUT' : undeclared identifier
Code:
#define _WIN32_WINNT 0x0500
#define WINVER 0x0500
#include <windows.h>
#include "stdafx.h"
#include "resource.h"
BOOL CALLBACK LanTalkProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
LoadLibrary("riched32.dll");
DialogBox(hInstance, (char*)IDD_MAINDLG, NULL, LanTalkProc);
return 0;
}
BOOL CALLBACK LanTalkProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hEditSend = GetDlgItem(hDlg, IDC_EDITSEND);
HWND hChat = GetDlgItem(hDlg, IDC_CHAT);
KEYBDINPUT ki;
ki.wVk = VK_RETURN;
ki.wScan = MapVirtualKeyEx(VK_RETURN, 0, GetKeyboardLayout(0));
ki.dwFlags = KEYEVENTF_EXTENDEDKEY;
ki.time = 0;
ki.dwExtraInfo = 0;
INPUT ipEvent;
ipEvent.type = INPUT_KEYBOARD;
ipEvent.ki = ki;
UINT nNumEvents = SendInput(1, &ipEvent, sizeof(INPUT));
switch(message)
{
case WM_INITDIALOG :
SetFocus(hEditSend);
return FALSE;
case WM_COMMAND :
switch (LOWORD(wParam))
{
case IDOK :
case IDCANCEL :
EndDialog(hDlg, 0);
return TRUE;
case IDC_SEND :
return TRUE;
}
break;
}
return FALSE;
}