• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天下

            記錄修行的印記

            How to move a dialog which does not have a caption(非標題欄移動對話框)

            How to move a dialog which does not have a caption
            Introduction
            This article is aimed at beginners, and presents two ways to move a dialog which does not have a caption by dragging its client area.
            1. WM_SYSCOMMAND message
            Sending the WM_SYSCOMMAND message starts the move operation. Add the following code to handle the mouse down event:
            BEGIN_MSG_MAP(CMainDlg)
                
            //...
                MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
            END_MSG_MAP()

            LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
            & bHandled)
            {
                SendMessage(WM_SYSCOMMAND, SC_MOVE
            |HTCAPTION);
                
            return 0;
            }


            2. WM_NCHITTEST message
            The idea is to handle the WM_NCHITTEST message to return HTCAPTION instead of HTCLIENT when the mouse is in the client area, to trick Windows to start moving the dialog.
            BEGIN_MSG_MAP(CMainDlg)
                
            //...
                MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest)
            END_MSG_MAP()

            LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
            & bHandled)
            {
                
            if (::DefWindowProc(m_hWnd, uMsg, wParam, lParam) == 
                    HTCLIENT 
            && ::GetAsyncKeyState(MK_LBUTTON) < 0)
                  
            return HTCAPTION;

                
            return 0;
            }

            //For MFC
            //Devil for ever supplied the MFC solution that is shown below (thanks!). The idea is the same - to handle the WM_NCHITTEST message.
            UINT OnNcHitTest(CPoint point)
            {
                UINT nHit 
            = CDialog::OnNcHitTest(point);
                
            return (nHit == HTCLIENT ? HTCAPTION : nHit);
            }

            posted on 2012-02-16 10:24 天下 閱讀(501) 評論(0)  編輯 收藏 引用 所屬分類: Win32WTL

            <2016年9月>
            28293031123
            45678910
            11121314151617
            18192021222324
            2526272829301
            2345678

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            久久久这里有精品| 色综合久久无码中文字幕| 99久久国产主播综合精品| 久久线看观看精品香蕉国产| 国内精品伊人久久久久影院对白| 亚洲国产日韩欧美久久| 久久久亚洲欧洲日产国码是AV| 久久99精品久久只有精品| 精品国产青草久久久久福利| 一本色道久久88—综合亚洲精品 | 91精品婷婷国产综合久久| 亚洲精品国精品久久99热| 精品久久久久久国产| 国产精品九九久久免费视频 | 午夜福利91久久福利| 久久99国产精品久久99果冻传媒 | 久久精品国产亚洲AV大全| 久久伊人中文无码| 一本大道加勒比久久综合| 久久er99热精品一区二区| 欧美一区二区久久精品| 久久99精品久久久久久噜噜| 久久久中文字幕| 久久精品国产亚洲沈樵| 久久精品国产亚洲av影院| 久久久久无码精品国产| 久久亚洲AV成人无码| 2021国内久久精品| 四虎亚洲国产成人久久精品| 国产精品欧美久久久久天天影视| 97久久天天综合色天天综合色hd| 久久久久久精品免费免费自慰| 久久久久噜噜噜亚洲熟女综合| 国产成人99久久亚洲综合精品| 国产精品美女久久久m| 欧美噜噜久久久XXX| 97精品依人久久久大香线蕉97| 久久精品国产亚洲AV影院| 久久婷婷成人综合色综合| 久久国产亚洲精品无码| 国产成人99久久亚洲综合精品|