The code-run effect is shown below:
I'll introduce the implementation of this program in three parts:
1. Generates an elliptical graphical interface, and writes italic-colored child and mouse drag on it.
2. Add the right mouse button menu and implement the feature that always covers the front and other programs automatically.
3. Generates a global hook for the mouse, intercepts mouse events, and returns the value of * * * *.
1. Generates an elliptical graphical interface and writes italic colored children above.
In the VC integrated compilation environment, select File, New, and then select the Project tab. Select "MFC Appwizard[exe]" in the project selection on the left, and enter "Ellipsewindow" in the edit box under the project title on the right.
Click the OK button to go to the MFC AppWizard step-1 Selection page, select the radio button on the left of the D Basic dialog box, set the application type to the basic dialog, and click OK when you click the "Finish" button.
In the automatically generated Idd_ellipsewindow_dialog dialog resource, delete the Cancel, OK button, and the text box titled "TODO: Set dialog here." At this point, the compilation runs this program, should be able to pop up an empty dialog box in the window.
The implementation of elliptic forms is mainly achieved by CRGN classes.
1. 1 Generating an oval form
In the definition of class Cellipsewindowdlg, add the protected variable of CRgn M_rgnwnd. In Cellipsewindowdlg::oninitdialog (), add the following code:
CRect rc;
GetClientRect(rc);
m_rgnWnd.CreateEllipticRgn(rc.left+32,rc.top+32,rc.Width()-64,rc.Height()-20);
SetWindowRgn((HRGN)m_rgnWnd,TRUE);
When you run this program, a gray oval form appears. If you cannot close this application, you can use ALT+F4 to close this program.