Making the automatic docking of QQ. Automatic contraction window.

xiaoxiao2021-03-06  62

1. Firstly, the automatic docking. 1). Create a dialog box class CDLG. 2). ///Dlg.h class cdlg {private: bool m_isautohide; // Window can automatically hide the bool m_iswinhide; // Whether the window is hidden. ........} //dlg.cpp ..... Void CDLG :: OnMove (int x, int y) {cdialog :: onmove (x, y); /// window When it is hidden, do not do other operations if (m_iswinhide) {return;} crect trect; getWindowRect (TRECT); if (TRECT.TOP <10) {//// If the window moves behind the window and the distance above the screen is less than 10 /// To stop the window to the screen. TRECT.BOTTOM- = TRECT.TOP; TRECT.TOP = 0; MoveWindow (TRECT); /// The window can automatically hide m_isautohide = true;} else {/ // If the window is not stopped, it cannot be automatically hidden by m_isautohide = false;}}

Void cdlg :: ONMOVING (UINT FWSIDE, LPRECT prect) {if (prect-> TOP <10) && (! m_isautohide)) {///////////////////////// To stop the window to the screen. Prect-> bottom- = prect-> top; prect-> TOP = 0; m_isautohide = true;} cdialog :: onmoving (fwside, prect);} 2. Processing automatic shrink // DLG .h class CDlg {..... LRESULT OnMouseLeave (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);} //dlg.cpp BEGIN_MESSAGE_MAP (CDlg, CDialog) ON_MESSAGE (WM_MOUSELEAVE, OnMouseLeave) END_MESSAGE_MAP () ... .... LRESULT CDLG :: OnMouseLeave (HWND HWND, UINT MSG, WPARAM WPARAM, LPARAM LPARAM) {if (m_isautohide) {cpoint tpoint; getCursorpos (& TPOIN); CRECT TRECT; GetWindowRect (& TRECT); if (! (TRect.ptinRect (TPOINT)))) {m_iswinhide = true; TRECT.TOP = TRECT.TOP - TRECT.BOTTOM 5; TRECT.BOTTOM = 5; MoveWindow (TRECT);

转载请注明原文地址:https://www.9cbs.com/read-111369.html

New Post(0)