Debug COM + in Delphi7

Source: Internet
Author: User

Debug COM + in Delphi7

The biggest headache for Developing COM + application systems is how to debug COM + components. Because COM + is executed in the execution environment of COM +, therefore, Delphi programmers cannot directly set the breakpoint of the application server in Delphi IDE just like Delphi's distributed multi-tier application system.

In fact, Delphi can still debug COM + components in the integrated development environment of Delphi, or allow programmers to set breakpoints in the program units of COM + components in the integrated development environment, then execute the client application to call the COM + component. In this case, Delphi will bring the execution control to the integrated development environment of Delphi, and pause the breakpoint set by the programmer to allow the programmer to start debugging. From then on, programmers can call COM + components just like debugging common applications. However, to debug COM + components in this way, programmers must first make some settings.

<? Xml: namespace prefix = o ns = "urn: schemas-microsoft-com: office"/>

1. Activate the COM + component project to be debugged in the integrated development environment of Delphi, click Projects | Options, and select the Linker page in the pop-up dialog box, select include Td32 info and include remote debug symbol;

2. Click Run | Install Com + Objects menu to register COM + components. It is best to register a new application, you can also register an existing application (this application must be generated by the COM program registered by Delphi ).

3. Run Win2000 Control Panel | administrative tool | component service. In the COM + application, right-click the application registered with COM and select the "properties" menu, in the displayed dialog box, select the "advanced" Page and select the "Start In Debugger" option. The following debugging path contains the following content: "C: program FilesBorlandDelphi7Binordbg70.exe "dllhost.exe/ProcessID: {9CEC476D-83A5-4C2B-AFF1-3E83A147B866}

4. Return to the integrated development environment of Delphi and click the Run | Parameters menu. In the dialog box, set HostApplication to C: WINNTsystem32DLLHOST. EXE, (set according to your operating system installation ). Parameters is set to/ProcessID: {9CEC476D-83A5-4C2B-AFF1-3E83A147B866}. The GUID value must be consistent with the property value in the Win2000 Component Service and can be copied directly from there.

5. set breakpoints and run COM in the integrated development environment of Delphi;

6. Run the client program that calls COM in Windows (or in the New Delphi environment.

At this time, we will find that COM in the Delphi Development Environment stops at the breakpoint, and then we can track and debug it in a single step.

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.