<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ### 復制粘貼 ***** [原文](http://www.voidcn.com/article/p-tutainvk-bht.html) 右鍵類向導 虛函數PreTranslateMessage ```c++ BOOL CCustomizedListCtrl::CListEditor::PreTranslateMessage(MSG* pMsg) { // 編輯框快捷鍵操作 if(WM_KEYDOWN == pMsg->message) { if(::GetFocus() == m_hWnd && (GetKeyState( VK_CONTROL) & 0xFF00 ) == 0xFF00) { // 全選 if( pMsg->wParam == 'A' || pMsg->wParam == 'a') { this->SetSel(0, -1); return true; } // 拷貝 if( pMsg->wParam == 'C' || pMsg->wParam == 'c') { this->Copy(); return true; } // 剪切 if( pMsg->wParam == 'X' || pMsg->wParam == 'x') { this->Cut(); return true; } // 粘貼 if( pMsg->wParam == 'V' || pMsg->wParam == 'v') { this->Paste(); return true; } // 粘貼 if( pMsg->wParam == 'Z' || pMsg->wParam == 'z') { this->Undo(); return true; } } } return CEdit::PreTranslateMessage(pMsg); } ``` ![](https://box.kancloud.cn/656fb66375ec7e9afc679bb5e8a911b8_784x390.png) 一開始實現時,編輯列表項不能捕捉焦點,后在google代碼搜索中搜關鍵字PreTranslateMessage,才知道沒加一個判斷條件,::GetFocus() == m_hWnd。 ### 失去焦點 ***** 失去焦點的是WM_KILLFOCUS,重載OnKillFocus(CWnd* pNewWnd) 獲取焦點的是WM_SETFOCUS,或者調用::SetFocus(HWND hwnd)把焦點設到某個控件上 ### 禁用標題拖動窗口 ***** ``` void CTestThreadDlg::OnNcLButtonDown(UINT nHitTest, CPoint point) { // TODO: Add your message handler code here and/or call default if (HTCAPTION == nHitTest) { return; } CDialog::OnNcLButtonDown(nHitTest, point); } ``` ### 進制拖拽窗口改變窗口大小 ***** 也可以用 OnNcHitest虛函數試試 可以查看 HTBORDER 這個宏(在沒有大小邊框的窗口的邊框中) 可以根據不同的宏實現不同的意思,可以使用help library ```c++ void CSingleListDlg::OnNcLButtonDown(UINT nHitTest, CPoint point) { // TODO: 在此添加消息處理程序代碼和/或調用默認值 if (HTCAPTION == nHitTest || HTBORDER == nHitTest) { return ; } __super::OnNcLButtonDown(nHitTest, point); } ``` ### 禁止輸入中文 ***** **MFC禁止輸入中文** ``` 1.stdafx.h 中 //禁止中文輸入法 #include <imm.h> #pragma comment (lib ,"imm32.lib") //可以選擇不引入庫 2.InitInstance()中 在中上添加 也就是在注冊其他東西前添加 //禁用中文輸入法方法 ImmDisableIME(GetCurrentThreadId()); 3.獲取控件焦點 SetFocus()中 HWND hwnd = this->m_hWnd; HIMC hi = ImmGetContext(hwnd); if (hi != NULL) { ImmAssociateContext(hwnd, nullptr);//禁用 ImmReleaseContext(hwnd, hi); } 4.釋放 if (hi != NULL) { ImmDestroyContext(hi); hi = nullptr; } ``` **注意禁用跟啟用是配合來用的** ``` HIMC hi = ImmAssociateContext(hwnd, nullptr);//禁用 ImmAssociateContext(OldHwnd, m_bHi);//啟用 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看