Try COM + (transfer) in Delphi7

xiaoxiao2021-03-06  97

Developing a COM application system is the most headache problem is how to debug COM components. Since COM is executed in a COM execution environment, the programmers of Delphi cannot be debugged directly in Delphi's IDE as Delphi's distributed multi-layer application system.

In fact, Delphi can still debug COM components in Delphi's integrated development environment, or make programmers set breakpoints in the program unit of the Com component in the integrated development environment, and then perform the client application to call COM components. At this point, Delphi will bring execution control to the integrated development environment of Delphi, and suspend programmers start debugging on the breakpoint set by programmers. From now on, the programmer can adjust the COM component as in the general application. However, you should debug COM components so you must do some settings first.

1. Activate the COM component item to be debugged in the Delphi integrated development environment, point the Projects | Options menu, select the Linker page in the pop-up dialog box, select the include TD32 INFO and include Remote Debug Symbol;

2, click Run | Install COM Objects menu, register COM components, it is best to register to new applications, or you can register to existing applications (this application needs to be generated by Delphi's registration COM program).

3. Run the Win2000 Control Panel | Management Tools | Component Services, find the application you just registered in the COM application, right-click, select the Properties menu, in the pop-up dialog box, select "Advanced" page, check The "Starting in the Debugger" option, there is a similar content similar to the following debug path: "c: / program files / borland / delphi7 / bin / bordbg70.exe" DLLHOST.EXE / Processid: {9Cec476D- 83A5-4C2B-AFF1-3E83A147B866}

4, return to the Delphi integrated development environment, click the Run | Parameters menu, in the dialog box, HostApplication is set to: c: /winnt/system32/dllhost.exe, (to be set according to your operating system installation). Parameters is set to: / processid: {9CEC476D-83A5-4C2B-AFF1-3E83A147B866}; this GUID value is consistent with the value value in the WIN2000 component service, you can directly COPY directly.

5, set breakpoints to run COM in Delphi's integrated development environment;

6. Run the client program that calls this COM in Windows (or in a new Delphi environment).

At this time, it will be found that the COM in the Delphi development environment is stopped at the breakpoint, and it can be subjected to the next step tracking.

转载请注明原文地址:https://www.9cbs.com/read-123088.html

New Post(0)