Introduce form technology into ActiveX Controls

Source: Internet
Author: User

 

 

I. IntroductionDialog Technology

---- The following describes how to introduce the mode-based dialog box technology when creating ActiveX controls. The procedure is as follows:

 

Create a newThe MFC ActiveX ControlWizard project named Hello. Use the default options for other items;

 

InAdd a dialog box resource on the ResourceView page named IDD_HELLODIALOG.

Put your own controls on the box;

 

Resources for the dialog boxIDD_HELLODIALOG create a new class CHelloDialog, inherited from CDialog;

 

Confirm inThe statement # include "HelloDialog. h" has been added to HelloCtrl. h, which is the CHelloCtrl class.

Add member variablesCHelloDialog m_helloDialog;

 

UseClassWizard adds a method void DoHello () for CHelloCtrl on the Automation page.

The Department name is alsoDoHello;

Void CHelloCtrl: DoHello ()

{

// Display dialog box

M_helloDialog.DoModal ();

}

 

---- ActiveX Control Test Container can be used to Test the DoHello method of Hello Control.

 

---- The following describes how to introduce the mode-free dialog box technology when creating ActiveX controls. The procedure is as follows:

 

Based on the above work, useClassWizard adds the WM_CREATE handler for CHelloCtrl

OnCreate, create a mode-free dialog box here;

 

ModifyDoHello code. The dialog box is displayed here;

Int CHelloCtrl: OnCreate

(Maid)

{

If (COleControl: OnCreate (lpCreateStruct) =-1)

Return-1;

// Create dialog box

M_helloDialog.Create (IDD_HELLODIALOG );

 

Return 0;

}

 

Void CHelloCtrl: DoHello ()

 

{

// Display dialog box

M_helloDialog.ShowWindow (SW_SHOW );

}

 

 

---- The following describes the ActiveX control technology used to create a dialog box. The procedure is as follows:

 

On the basis of the above work, set the dialog box ResourcesThe Style page of The IDD_HELLODIALOG attribute is

Style: Child, Border: Dialog Frame, Title Bar: unchecked; set More Style

Page isVisible: checked; Control: checked; set the Extended Styles page

Static Edge: checked;

 

In

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.