阅读:2527回复:2
求助:自制软键盘,编辑框无法接收到字符
用evc4.0写了一个软键盘,在模拟器上测试,一切正常,可拿到arm2440上却出了问题:我的测试程序是基于单文档的,这个程序可以接收到按键消息,但无法传递到对话框里,所以编辑框也就受不到字符了。但是按退格键、确认键等这些键是可以的,不知道为什么。下面是我的软键盘源码,各位大虾帮我看看是什么原因。
// KeyboardDlg.cpp : implementation file // #include "stdafx.h" #include "Keyboard.h" #include "KeyboardDlg.h" #include "NumKeyboardDlg.h" #include "SpecialCharVKCode.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif HWND m_hFocus; CKeyboardDlg *pCharKeyboardDlg; CNumKeyboardDlg *pNumKeyboardDlg; ///////////////////////////////////////////////////////////////////////////// // CKeyboardDlg dialog CKeyboardDlg::CKeyboardDlg(CWnd* pParent /*=NULL*/) : CDialog(CKeyboardDlg::IDD, pParent) { //{{AFX_DATA_INIT(CKeyboardDlg) m_bPressKeyShift = FALSE; m_bCapsLK = TRUE;//true:uppercase, false:lowercase //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CKeyboardDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CKeyboardDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CKeyboardDlg, CDialog) //{{AFX_MSG_MAP(CKeyboardDlg) ON_WM_CREATE() ON_BN_CLICKED(IDC_KEY_A, OnKeyA) ON_WM_PAINT() ON_BN_CLICKED(IDC_KEY_Q, OnKeyQ) ON_BN_CLICKED(IDC_KEY_B, OnKeyB) ON_BN_CLICKED(IDC_KEY_BACKSPACE, OnKeyBackspace) ON_BN_CLICKED(IDC_KEY_C, OnKeyC) ON_BN_CLICKED(IDC_KEY_CAPS, OnKeyCaps) ON_BN_CLICKED(IDC_KEY_COLON, OnKeyColon) ON_BN_CLICKED(IDC_KEY_COMMA, OnKeyComma) ON_BN_CLICKED(IDC_KEY_D, OnKeyD) ON_BN_CLICKED(IDC_KEY_DOT, OnKeyDot) ON_BN_CLICKED(IDC_KEY_E, OnKeyE) ON_BN_CLICKED(IDC_KEY_ESC, OnKeyEsc) ON_BN_CLICKED(IDC_KEY_F, OnKeyF) ON_BN_CLICKED(IDC_KEY_G, OnKeyG) ON_BN_CLICKED(IDC_KEY_H, OnKeyH) ON_BN_CLICKED(IDC_KEY_I, OnKeyI) ON_BN_CLICKED(IDC_KEY_J, OnKeyJ) ON_BN_CLICKED(IDC_KEY_K, OnKeyK) ON_BN_CLICKED(IDC_KEY_L, OnKeyL) ON_BN_CLICKED(IDC_KEY_LEFT_PARENTHESIS, OnKeyLeftParenthesis) ON_BN_CLICKED(IDC_KEY_M, OnKeyM) ON_BN_CLICKED(IDC_KEY_N, OnKeyN) ON_BN_CLICKED(IDC_KEY_O, OnKeyO) ON_BN_CLICKED(IDC_KEY_P, OnKeyP) ON_BN_CLICKED(IDC_KEY_R, OnKeyR) ON_BN_CLICKED(IDC_KEY_RIGHT_PARENTHESIS, OnKeyRightParenthesis) ON_BN_CLICKED(IDC_KEY_S, OnKeyS) ON_BN_CLICKED(IDC_KEY_SEMICOLON, OnKeySemicolon) ON_BN_CLICKED(IDC_KEY_SHIFT, OnKeyShift) ON_BN_CLICKED(IDC_KEY_SLASH, OnKeySlash) ON_BN_CLICKED(IDC_KEY_SPACE, OnKeySpace) ON_BN_CLICKED(IDC_KEY_T, OnKeyT) ON_BN_CLICKED(IDC_KEY_U, OnKeyU) ON_BN_CLICKED(IDC_KEY_V, OnKeyV) ON_BN_CLICKED(IDC_KEY_W, OnKeyW) ON_BN_CLICKED(IDC_KEY_X, OnKeyX) ON_BN_CLICKED(IDC_KEY_Y, OnKeyY) ON_BN_CLICKED(IDC_KEY_Z, OnKeyZ) ON_BN_CLICKED(IDC_SWITCHTONUM, OnSwitchtonum) ON_BN_CLICKED(IDC_KEY_RETURN, OnKeyReturn) ON_BN_CLICKED(IDC_KEY_ENTER, OnKeyEnter) ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CKeyboardDlg message handlers BOOL CKeyboardDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CenterWindow(GetDesktopWindow()); // center to the hpc screen // TODO: Add extra initialization here pCharKeyboardDlg = this; pNumKeyboardDlg = new CNumKeyboardDlg; pNumKeyboardDlg->Create(IDD_NUM_KEYBOARD_DLG, this); //设置矩形窗口(内部) CRect winrect; CRgn rgn; // CBrush brush; // brush.CreateSolidBrush(RGB(255,255,255)); GetClientRect(&winrect); // rgn.CreateRectRgn(0,0,winrect.right,winrect.bottom); // SetWindowRgn(rgn, 1); // SetWindowText(_T("软键盘")); // GetWindowRect(winrect); ::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 60, 350, winrect.Width(), winrect.Height() ,SWP_NOSIZE); //必须的 // MoveWindow(160, 400, winrect.Width(), winrect.Height(), true); keybd_event(VK_CAPITAL, 0, 0, 0); SHORT ntmp = GetKeyState(VK_CAPITAL); //只能得到VK_CAPITAL 的触发状态,0为大写状态,1为小写状态 keybd_event(VK_CAPITAL, 0, KEYEVENTF_KEYUP, 0); if(ntmp == 1) { keybd_event(VK_CAPITAL, 0, 0, 0); keybd_event(VK_CAPITAL, 0, KEYEVENTF_KEYUP, 0); } m_KeySpace.Attach(IDC_KEY_SPACE, this); m_KeySpace.SetWindowText(_T("Space")); m_KeyZ.Attach(IDC_KEY_Z, this); m_KeyZ.SetWindowText(_T("Z")); m_KeyY.Attach(IDC_KEY_Y, this); m_KeyY.SetWindowText(_T("Y")); m_KeyX.Attach(IDC_KEY_X, this); m_KeyX.SetWindowText(_T("X")); m_KeyW.Attach(IDC_KEY_W, this); m_KeyW.SetWindowText(_T("W")); m_KeyV.Attach(IDC_KEY_V, this); m_KeyV.SetWindowText(_T("V")); m_KeyU.Attach(IDC_KEY_U, this); m_KeyU.SetWindowText(_T("U")); m_KeyT.Attach(IDC_KEY_T, this); m_KeyT.SetWindowText(_T("T")); m_KeySlash.Attach(IDC_KEY_SLASH, this); m_KeySlash.SetWindowText(_T("/")); m_KeyShift.Attach(IDC_KEY_SHIFT, this); m_KeyShift.SetWindowText(_T("Shift")); m_KeySemicolon.Attach(IDC_KEY_SEMICOLON, this); m_KeySemicolon.SetWindowText(_T(";")); m_KeyS.Attach(IDC_KEY_S, this); m_KeyS.SetWindowText(_T("S")); m_KeyRParenthesis.Attach(IDC_KEY_RIGHT_PARENTHESIS, this); m_KeyRParenthesis.SetWindowText(_T(")")); m_KeyReturn.Attach(IDC_KEY_RETURN, this); m_KeyReturn.SetWindowText(_T("Return")); m_KeyR.Attach(IDC_KEY_R, this); m_KeyR.SetWindowText(_T("R")); m_KeyQ.Attach(IDC_KEY_Q, this); m_KeyQ.SetWindowText(_T("Q")); m_KeyP.Attach(IDC_KEY_P, this); m_KeyP.SetWindowText(_T("P")); m_KeyO.Attach(IDC_KEY_O, this); m_KeyO.SetWindowText(_T("O")); m_KeyN.Attach(IDC_KEY_N, this); m_KeyN.SetWindowText(_T("N")); m_KeyM.Attach(IDC_KEY_M, this); m_KeyM.SetWindowText(_T("M")); m_KeyLParenthesis.Attach(IDC_KEY_LEFT_PARENTHESIS, this); m_KeyLParenthesis.SetWindowText(_T("(")); m_KeyL.Attach(IDC_KEY_L, this); m_KeyL.SetWindowText(_T("L")); m_KeyK.Attach(IDC_KEY_K, this); m_KeyK.SetWindowText(_T("K")); //////////// m_KeyJ.Attach(IDC_KEY_J, this); m_KeyJ.SetWindowText(_T("J")); m_KeyI.Attach(IDC_KEY_I, this); m_KeyI.SetWindowText(_T("I")); m_KeyH.Attach(IDC_KEY_H, this); m_KeyH.SetWindowText(_T("H")); m_KeyG.Attach(IDC_KEY_G, this); m_KeyG.SetWindowText(_T("G")); m_KeyF.Attach(IDC_KEY_F, this); m_KeyF.SetWindowText(_T("F")); m_KeyEsc.Attach(IDC_KEY_ESC, this); m_KeyEsc.SetWindowText(_T("Esc")); m_KeyEnter.Attach(IDC_KEY_ENTER, this); m_KeyEnter.SetWindowText(_T("ENTER")); m_KeyE.Attach(IDC_KEY_E, this); m_KeyE.SetWindowText(_T("E")); m_KeyDot.Attach(IDC_KEY_DOT, this); m_KeyDot.SetWindowText(_T(".")); m_KeyD.Attach(IDC_KEY_D, this); m_KeyD.SetWindowText(_T("D")); m_KeyComma.Attach(IDC_KEY_COMMA, this); m_KeyComma.SetWindowText(_T(",")); ///////// m_KeyColon.Attach(IDC_KEY_COLON, this); m_KeyColon.SetWindowText(_T(":")); m_KeyCaps.Attach(IDC_KEY_CAPS, this); m_KeyCaps.SetWindowText(_T("CAPS")); m_KeyC.Attach(IDC_KEY_C, this); m_KeyC.SetWindowText(_T("C")); m_KeyBackSpace.Attach(IDC_KEY_BACKSPACE, this); m_KeyBackSpace.SetWindowText(_T("←")); m_KeyB.Attach(IDC_KEY_B, this); m_KeyB.SetWindowText(_T("B")); m_KeyA.Attach(IDC_KEY_A, this); m_KeyA.SetWindowText(_T("A")); return TRUE; // return TRUE unless you set the focus to a control } int CKeyboardDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here //置窗体为最顶层显示及其位置 CRect rcW; GetWindowRect(&rcW); SetWindowPos(&wndTopMost, rcW.left, rcW.top, rcW.Width(), rcW.Height(), SWP_NOSIZE); return 0; } void CKeyboardDlg::ReleaseFocus() { //释放焦点 if(IsWindow(m_hFocus)) { HWND wnd = ::GetForegroundWindow(); if(IsWindow(wnd)) { if(wnd == m_hFocus) { return; } } //设置保存的焦点窗口处于激活状态 ::SetForegroundWindow(m_hFocus); ::SetFocus(m_hFocus); } } void CKeyboardDlg::OnKeyA() { // TODO: Add your control notification handler code here BYTE key = 'A'; SendKeyMessage(key); } BOOL CKeyboardDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class HWND wnd = ::GetForegroundWindow(); if(IsWindow(wnd)) { //如果当前激活窗口不是本程序的窗口 if(wnd != this->m_hWnd) { //激活窗口发生了改变 if(m_hFocus != wnd) { if(IsWindow(m_hFocus)) { //释放本进程和gFocus线程的联系 // AttachThreadInput( // GetWindowThreadProcessId(m_hWnd,NULL), // GetWindowThreadProcessId(m_hFocus,NULL), // FALSE); m_hFocus = ::GetFocus(); } m_hFocus = wnd; //使本进程和激活窗口的进程联系起来,接收本进程的按键消息 // AttachThreadInput( // GetWindowThreadProcessId(m_hWnd,NULL), // GetWindowThreadProcessId(m_hFocus,NULL), // TRUE); } } } return CDialog::PreTranslateMessage(pMsg); } BOOL CKeyboardDlg::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Add your specialized code here and/or call the base class DWORD dwExtendStyle=0; DWORD dwStyle=0; dwExtendStyle=GetWindowLong(this->m_hWnd,GWL_EXSTYLE); dwExtendStyle |=WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE; dwStyle=GetWindowLong(this->m_hWnd,GWL_STYLE); //dwStyle |=DS_SYSMODAL; cs.dwExStyle=dwExtendStyle; cs.style=dwStyle; return CDialog::PreCreateWindow(cs); } int CKeyboardDlg::DescribeKeyState() { int state = 0; short ks; ks = GetKeyState(VK_CAPITAL);//返回值小于0,则被触发,大于0没有被按下 if(ks & 0x000F) state += 0x01; ks = GetKeyState(VK_SHIFT); if(ks & 0xF000) state += 0x02; ks = GetKeyState(VK_CONTROL); if(ks & 0xF000) state += 0x04; return state; } void CKeyboardDlg::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here // CDC *pDC; // CRgn myrgn; // CBrush frameBrush; // CRect winrect; // GetClientRect(&winrect); //// myrgn.CreateRectRgn(0,0,winrect.right,winrect.bottom);//绘制直角矩形 //// myrgn.CreateRoundRectRgn(0,0,winrect.right,winrect.bottom,5,5);//绘制圆角矩形圆角度5 // // frameBrush.CreateSolidBrush(RGB(0,158,221)); //边框颜色 // // pDC->FillRgn(&myrgn,&m_brush); //// pDC->FrameRgn(&myrgn,&frameBrush,1,1); // pDC->FrameRect(&winrect, &m_brush); // pDC->SetBkMode(TRANSPARENT); // Do not call CDialog::OnPaint() for painting messages } void CKeyboardDlg::OnKeyQ() { // TODO: Add your control notification handler code here BYTE key = 'Q'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyB() { // TODO: Add your control notification handler code here BYTE key = 'B'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyBackspace() { // TODO: Add your control notification handler code here SendKeyMessage(VK_BACK); } void CKeyboardDlg::OnKeyC() { // TODO: Add your control notification handler code here BYTE key = 'C'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyCaps() { // TODO: Add your control notification handler code here SendKeyMessage(VK_CAPITAL); } void CKeyboardDlg::OnKeyColon() { // TODO: Add your control notification handler code here SendKeyMessage(VK_SEMICOLON); } void CKeyboardDlg::OnKeyComma() { // TODO: Add your control notification handler code here SendKeyMessage(VK_COMMA); } void CKeyboardDlg::OnKeyD() { // TODO: Add your control notification handler code here BYTE key = 'D'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyDot() { // TODO: Add your control notification handler code here SendKeyMessage(VK_PERIOD); } void CKeyboardDlg::OnKeyE() { // TODO: Add your control notification handler code here BYTE key = 'E'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyEsc() { // TODO: Add your control notification handler code here SendKeyMessage(VK_ESCAPE); } void CKeyboardDlg::OnKeyF() { // TODO: Add your control notification handler code here BYTE key = 'F'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyG() { // TODO: Add your control notification handler code here BYTE key = 'G'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyH() { // TODO: Add your control notification handler code here BYTE key = 'H'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyI() { // TODO: Add your control notification handler code here BYTE key = 'I'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyJ() { // TODO: Add your control notification handler code here BYTE key = 'J'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyK() { // TODO: Add your control notification handler code here BYTE key = 'K'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyL() { // TODO: Add your control notification handler code here BYTE key = 'L'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyLeftParenthesis() { // TODO: Add your control notification handler code here SendKeyMessage(VK_LPARENTHESIS); } void CKeyboardDlg::OnKeyM() { // TODO: Add your control notification handler code here BYTE key = 'M'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyN() { // TODO: Add your control notification handler code here BYTE key = 'N'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyO() { // TODO: Add your control notification handler code here BYTE key = 'O'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyP() { // TODO: Add your control notification handler code here BYTE key = 'P'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyR() { // TODO: Add your control notification handler code here BYTE key = 'R'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyRightParenthesis() { // TODO: Add your control notification handler code here SendKeyMessage(VK_RPARENTHESIS); } void CKeyboardDlg::OnKeyS() { // TODO: Add your control notification handler code here BYTE key = 'S'; SendKeyMessage(key); } void CKeyboardDlg::OnKeySemicolon() { // TODO: Add your control notification handler code here SendKeyMessage(VK_SEMICOLON); } void CKeyboardDlg::OnKeyShift() { // TODO: Add your control notification handler code here SendKeyMessage(VK_SHIFT); } void CKeyboardDlg::OnKeySlash() { // TODO: Add your control notification handler code here SendKeyMessage(VK_SLASH); } void CKeyboardDlg::OnKeySpace() { // TODO: Add your control notification handler code here SendKeyMessage(VK_SPACE); } void CKeyboardDlg::OnKeyT() { // TODO: Add your control notification handler code here BYTE key = 'T'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyU() { // TODO: Add your control notification handler code here BYTE key = 'U'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyV() { // TODO: Add your control notification handler code here BYTE key = 'V'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyW() { // TODO: Add your control notification handler code here BYTE key = 'W'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyX() { // TODO: Add your control notification handler code here BYTE key = 'X'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyY() { // TODO: Add your control notification handler code here BYTE key = 'Y'; SendKeyMessage(key); } void CKeyboardDlg::OnKeyZ() { // TODO: Add your control notification handler code here BYTE key = 'Z'; SendKeyMessage(key); } void CKeyboardDlg::OnSwitchtonum() { // TODO: Add your control notification handler code here pNumKeyboardDlg->ShowWindow(SW_SHOW); this->ShowWindow(SW_HIDE); // pNumKeyboardDlg = new CNumKeyboardDlg; // pNumKeyboardDlg->DoModal(); } void CKeyboardDlg::OnKeyReturn() { // TODO: Add your control notification handler code here SendKeyMessage(VK_RETURN); } void CKeyboardDlg::OnKeyEnter() { // TODO: Add your control notification handler code here SendKeyMessage(VK_RETURN); } void CKeyboardDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default m_OldPoint = point; SetCapture();//调用SetCapture后,即使鼠标移动出客户区,你也可以接受到鼠标消息 //CDialog::OnLButtonDown(nFlags, point); } void CKeyboardDlg::OnLButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CRect winrect; GetWindowRect(&winrect); // RETAILMSG(1, (TEXT("OnLButtonUp::left = %d, top = %d\r\n"), winrect.left, winrect.top)); if((point.x != m_OldPoint.x) || (point.y != m_OldPoint.y)) {//移动 int offset_x = point.x - m_OldPoint.x; int offset_y = point.y - m_OldPoint.y; MoveWindow(winrect.left + offset_x, winrect.top + offset_y, winrect.Width(), winrect.Height(), true); } ReleaseCapture(); //CDialog::OnLButtonUp(nFlags, point); } void CKeyboardDlg::SendKeyMessage(int vk_code) { ReleaseFocus(); if(vk_code >= 'A' && vk_code <= 'Z') { /* SHORT nTmp = GetAsyncKeyState(VK_CAPITAL); if(!(GetKeyState(VK_CAPITAL) && 0xFF)) if(nTmp < 0) { keybd_event(VK_CAPITAL,0,0,0); keybd_event(VK_CAPITAL,0,KEYEVENTF_KEYUP,0); } */ if(m_bPressKeyShift) keybd_event(VK_SHIFT, 0, 0, 0); if(!m_bCapsLK) vk_code += 32;//lowercase keybd_event(vk_code, 0, 0, 0); keybd_event(vk_code, 0, KEYEVENTF_KEYUP, 0); if(m_bPressKeyShift) { keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); m_bPressKeyShift = FALSE; m_KeyShift.ChangeColor(WHITE_COLOR); GetDlgItem(IDC_KEY_SHIFT)->SetWindowText(_T("SHIFT")); } } else if(vk_code == VK_LPARENTHESIS || vk_code == VK_RPARENTHESIS) { keybd_event(VK_SHIFT , 0, 0, 0); keybd_event(vk_code, 0, 0, 0); keybd_event(vk_code, 0, KEYEVENTF_KEYUP, 0); keybd_event(VK_SHIFT , 0, KEYEVENTF_KEYUP, 0); } else if(vk_code == VK_SHIFT) { keybd_event(VK_SHIFT, 0, 0, 0); keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); m_KeyShift.ChangeColor(PALEGREEN_COLOR); m_bPressKeyShift = TRUE; //m_KeyShift. } else if(vk_code == VK_CAPITAL) { keybd_event(vk_code, 0, 0, 0); SHORT ntmp = GetKeyState(VK_CAPITAL); //只能得到VK_CAPITAL 的触发状态,0为大写状态,1为小写状态 keybd_event(vk_code, 0, KEYEVENTF_KEYUP, 0); char text; CString strText; if(ntmp == 0) { m_bCapsLK = TRUE; for(int id = IDC_KEY_A; id <= IDC_KEY_Z; id++) { text = 'A' + (id - IDC_KEY_A); strText = text; GetDlgItem(id)->SetWindowText(strText); } } else if(ntmp == 1) { m_bCapsLK = FALSE; for(int id = IDC_KEY_A; id <= IDC_KEY_Z; id++) { text = 'A' + (id - IDC_KEY_A) + 32; strText = text; GetDlgItem(id)->SetWindowText(strText); } } } else//VK_BACK,,VK_COMMA,VK_PERIOD,VK_ESCAPE,VK_SEMICOLON,VK_SLASH,VK_SPACE,VK_RETURN { keybd_event(vk_code, 0, 0, 0); keybd_event(vk_code, 0, KEYEVENTF_KEYUP, 0); } ReleaseFocus(); } |
|
沙发#
发布于:2009-08-07 15:50
而且按数字键比如(VK_NUMPAD1)时,在测试程序里受到的时‘a',很奇怪。
|
|
板凳#
发布于:2009-08-07 20:58
代码太多没仔细看,好好查一下kbd_event的用法吧
|
|
|