Debug and use ActiveX Controls

Source: Internet
Author: User

 

  In this sectionThe ATL control is used as an object to explain how to debug and use ActiveX controls.

Since the control cannot run independently, you must use another program to load the control and debug it,VC provides ActiveX containers for use. Select the Debug page from the project/setting menu and select ActiveX Container.

Start debugging and goWhen using Container, VC will prompt that there is no debugging code error in Container, so ignore it and continue.

EnterAfter the Container, first load the Control you want to debug, select the menu Edit/Insert OLE Control..., and select the Control you want to Insert in the pop-up dialog box.

IfAfter the Container is successfully created, the control is displayed on the screen. Based on the content in the previous section, we can see that the control displays a string of characters, next, we need to test whether the methods provided by the control can run correctly. Select the menu Edit/Invoke Methods ..., select the method you want to use in the pop-up dialog box, but after you select the method, the parameter input area on the dialog box displays the list of input parameters, you can enter the parameters and press the Invoke button.

During debugging, you can use it in the code just like debugging other programs.TRACE macro. You can also set breakpoints.

In fact, when you insert a control, you will see other controls that have been registered in the system. If you are interested, you can try loading them to see the effect.

If you wantThe existing ActiveX control is used in the VC project. The simplest method is to use the VC insertion function, in the menu, select Project/Add To Project/Component and Control (in different versions of VC, the menu location may be different), and then select the inserted Control, VC will generate the definition file for this control for you. Of course, it will be totally different from what you wrote at the beginning, but it does not matter. You will see the methods and properties implemented by the control in the definition file, which can be called using functions. (It is difficult to use a control without instructions)

Another way is to insert a control in the dialog box. If the definition file of the control is not generatedVC can also help you generate.

The controls in the dialog box do not need to be manually created, but if you want to create a window elsewhere, you need to call the control's creation function. In fact, this function is very simple, and

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.