Dim ScanCode As String
ScanCode = Hex(MapVirtualKey(KeyCode, 0)) ' Get scancode for key
ScanCode = String(2 - Len(ScanCode), "0") & ScanCode ' Pad with zeros to get 2 digit number...
ScanCode = Hex(MapVirtualKey(KeyCode, 0)) ' Get scancode for key
ScanCode = String(2 - Len(ScanCode), "0") & ScanCode ' Pad with zeros to get 2 digit number...
Dim ScanCode As String
hWnd = FindWindow(vbNullString, "Red Faction Dedicated Server")
ScanCode = Hex(MapVirtualKey(KeyCode, 0)) ' Get scancode for key
ScanCode = String(2 - Len(ScanCode), "0") & ScanCode ' Pad with zeros to get 2 digit number...
PostMessage hWnd, WM_KEYDOWN, KeyCode, CLng("&H00" & ScanCode & "0001")
PostMessage hWnd, WM_KEYUP, KeyCode, CLng("&HC0" & ScanCode & "0001")
CString strDest.Format(_T("%x"),MapVirtualKey(KeyCode, 0);
strDest = strDest + _T("00") ;
PostMessage(hWnd,WM_KEYDOWN, KeyCode,atol(strDest));
PostMessage(hWnd,WM_KEYUP, KeyCode,atol(strDest));