Welcome to tiger's blog!

What lead to success, what we are seeking...
posts - 47, comments - 23, trackbacks - 0, articles - 8
   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

如何弹出软键盘

Posted on 2007-01-05 09:16 tiger 阅读(1893) 评论(1)  编辑 收藏 引用
1、打开/关闭输入法
    void CHideDlgDlg::OnButton9()
    {
     // TODO: Add your control notification handler code here
     CWnd * pWnd = GetDlgItem(IDC_TREE1);
     if (pWnd){
     pWnd->SetFocus();
     ImmSimulateHotKey(pWnd->m_hWnd, IME_CHOTKEY_IME_NONIME_TOGGLE);
    
     HIMC hIMC = ImmGetContext(pWnd->m_hWnd);
     DWORD dwConv, dwSent;
     DWORD dwTemp;
    
     ImmGetConversionStatus(hIMC,&dwConv,&dwSent);
     dwConv |= IME_CMODE_SOFTKBD;
    
     ImmSetConversionStatus(hIMC,dwConv,dwSent);
    
     ImmReleaseContext(pWnd->m_hWnd,hIMC);
     }
    
    }
    2、打开/关闭软键盘
    void CHideDlgDlg::OnButton10()
    {
     // TODO: Add your control notification handler code here
     CWnd * pWnd = GetDlgItem(IDC_TREE1);
     if (pWnd){
     pWnd->SetFocus();
    
     HIMC hIMC = ImmGetContext(pWnd->m_hWnd);
     DWORD dwConv, dwSent;
     DWORD dwTemp;
    
     ImmGetConversionStatus(hIMC,&dwConv,&dwSent);
     if (dwConv & IME_CMODE_SOFTKBD)
     dwConv &= ~IME_CMODE_SOFTKBD;
     else
     dwConv |= IME_CMODE_SOFTKBD;
    
     ImmSetConversionStatus(hIMC,dwConv,dwSent);
    
     ImmReleaseContext(pWnd->m_hWnd,hIMC);
     }
    }

Feedback

# re: 如何弹出软键盘[未登录]  回复  更多评论   

2010-09-06 15:36 by alex
dwConv ^= IME_CMODE_SOFTKBD; 更简洁高效一些

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理