如何使用Delphi调试Windows服务? [英] How to debug a windows service with Delphi?
本文介绍了如何使用Delphi调试Windows服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
您可以使用来自 科林威尔逊的NT低级实用程序 (页面已经没了, 在回程机中可用)
然后在DPR中:
begin
if(paramCount> 0)和(SameText(ParamStr(1),'-DEBUG'))然后
begin
FreeAndNil(Application);
应用程序:= TDebugServiceApplication.Create(nil);
结束
// ...其余的正常DPR代码
结束。
这样,您可以通过调试从Delphi运行(通过设置项目Debugger参数),使用EXE作为一项服务,或从命令行运行与 -DEBUG
开关,和。
Is there a way to debug completely a windows service with Delphi?
解决方案
You can use unitDebugService.pas from Colin Wilson's NT Low Level Utilities (page is gone, available in the wayback machine)
and then in the DPR:
begin
if (paramCount > 0) and (SameText(ParamStr(1), '-DEBUG')) then
begin
FreeAndNil (Application);
Application := TDebugServiceApplication.Create(nil);
end;
//... the rest of the normal DPR code
end.
This way you can run from within Delphi with debugging (by setting the project Debugger Parameters), use the EXE as a service, or run from the commandline with the -DEBUG
switch, and .
这篇关于如何使用Delphi调试Windows服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文