64,639
社区成员
发帖
与我相关
我的任务
分享
WPARAM wParam1 = VK_CONTROL & 0xFF;
LPARAM lParam1 = 1;
lParam1 += MapVirtualKey(wParam1, MAPVK_VK_TO_VSC) << 16;
auto temp = VkKeyScan('v');
WPARAM wParam2 = temp & 0xFF;
LPARAM lParam2 = 1;
lParam2 += MapVirtualKey(wParam2, MAPVK_VK_TO_VSC) << 16;
::PostMessage(g_hwnd, WM_KEYDOWN, wParam1, lParam1);
::PostMessage(g_hwnd, WM_KEYDOWN, wParam2, lParam2);
lParam1 += 1 << 30;
lParam1 += 1 << 31;
lParam2 += 1 << 30;
lParam2 += 1 << 31;
::PostMessage(g_hwnd, WM_KEYUP, wParam2, lParam2);
::PostMessage(g_hwnd, WM_KEYUP, wParam1, lParam1);
------------------------------------------------------------------------------------------------------------
BYTE wParam1 = VK_CONTROL & 0xFF;
LPARAM lParam1 = MapVirtualKey(wParam1, MAPVK_VK_TO_VSC);
auto temp = VkKeyScan('v');
BYTE wParam2 = temp & 0xFF;
LPARAM lParam2 = MapVirtualKey(wParam2, MAPVK_VK_TO_VSC);
::keybd_event(wParam1, lParam1, 0, 0);
::keybd_event(wParam2, lParam2, 0, 0);
::keybd_event(wParam2, lParam2, KEYEVENTF_KEYUP, 0);
::keybd_event(wParam1, lParam1, KEYEVENTF_KEYUP, 0);
SetFocus The SetFocus function sets the keyboard focus to the specified window. The window must be associated with the calling thread's message queue. HWND SetFocus( HWND hWnd // handle to window to receive focus ); Parameters hWnd Handle to the window that will receive the keyboard input. If this parameter is NULL, keystrokes are ignored. Return Values If the function succeeds, the return value is the handle to the window that previously had the keyboard focus. If the hWnd parameter is invalid or the window is not associated with the calling thread's message queue, the return value is NULL. To get extended error information, callGetLastError. Remarks The SetFocus function sends a WM_KILLFOCUS message to the window that loses the keyboard focus and a WM_SETFOCUS message to the window that receives the keyboard focus. It also activates either the window that receives the focus or the parent of the window that receives the focus. If a window is active but does not have the focus, any key pressed will produce the WM_SYSCHAR, WM_SYSKEYDOWN, or WM_SYSKEYUP message. If the VK_MENU key is also pressed, the lParam parameter of the message will have bit 30 set. Otherwise, the messages produced do not have this bit set. By using the AttachThreadInput function, a thread can attach its input processing to another thread. This allows a thread to call SetFocus to set the keyboard focus to a window associated with another thread's message queue. Windows CE: Do not use the SetFocus function to set the keyboard focus to a window associated with another thread's message queue. There is one exception. If a window on one thread is the child of the window on the other thread, or if the windows are siblings of the same parent, the thread associated with one window can set the focus to the other window even though it belongs to a different thread. In this case, there is no need to call AttachThreadInput first. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in winuser.h. Import Library: Use user32.lib. See Also Keyboard Input Overview, Keyboard Input Functions,AttachThreadInput, GetFocus, WM_KILLFOCUS, WM_SETFOCUS, WM_SYSCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP
我现在可以实现鼠标事件,把鼠标点击事件发送到flash指定地点。但是文本信息不知道哪有有问题,发送不过去。我在想是不是光标设置的问题,该如何设置光标。我发送光标事件过去,但是感觉没反应,不知道哪里出问题了。
网页游戏一般是FLASH,用C++提供的对键盘的操作功能是没办法达到的