The most vexing problem with developing COM + applications is how to debug COM + components. Because COM + is performed in COM + 's execution Environment, Delphi programmers cannot, like Delphi's distributed multi-tier application system, set breakpoints for application servers directly in the Delphi IDE to debug.
In fact, Delphi can still debug COM + components in the integrated development environment of Delphi, or allow programmers to set breakpoints in the COM + component's program unit in the Integrated development environment, and then execute the client application to invoke the COM + component. At this time the Delphi will take the execution control to the Delphi integrated development environment, and pauses the programmer to set the breakpoint to let the programmer start debugging. From this point on, programmers can tune COM + components like normal applications. However, to debug COM + components So, programmers must first do some setup.
<?xml:namespace prefix = o ns = "Urn:schemas-microsoft-com:office:office"/>
1, in the Delphi integrated development environment to activate the COM + component project to be debugged, point projects| Options menu, select the linker page in the pop-up dialog box, and select include TD32 info and include remote debug symbol.
2, point run| Install COM + objects menu, registering COM + components, preferably registering with a new application, or registering with an existing application (this application needs to be generated by Delphi's registered Com program).
3, Run Win2000 Control Panel | management Tools | Component Services, in COM + applications to find just COM registered application, right-click, select the "Properties" menu, in the pop-up dialog box, select the "Advanced" page, select the "Start in debugger" option, In the following debug path there will be something similar to the following: "C:Program FilesBorlandDelphi7Binordbg70.exe" dllhost.exe/processid:{ 9cec476d-83a5-4c2b-aff1-3e83a147b866}
4, back to the integration of Delphi development environment, click the selection of run| Parameters menu, in the dialog box, HostApplication set to: C:winntsystem32dllhost.exe, (to be based on your operating system setup). Parameters is set to:/processid:{9cec476d-83a5-4c2b-aff1-3e83a147b866}; The value of this GUID is consistent with the value of the property in the Win2000 component service, which can be directly copy over there.
5, set breakpoints, in the Delphi integrated development environment Run COM;
6. Run the client program that calls this COM in Windows (or in the newly opened Delphi environment).
At this point, you will find that the Delphi development environment in the COM stop at the breakpoint, you can follow the next step after debugging.