“cs服务端当掉后自动重启“有什么好的解决办法吗? cs服务端(一个类似dos窗口的程序Hlds.exe)开启后就显示服务器已连接,然后哪个客启端连上就显示ip等信息。一天大约要重启一次,如果网管不在就比较麻烦,现在想编一个程序在这个窗口当掉后自动重启这个程序。有什么好的解决办法吗?分不够再加! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用个时钟控件,定期检测Hlds.exe,如果找不到则启动它! 以下是检测 系统计算器启动关闭程序!unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}uses shellapi;procedure TForm1.Button1Click(Sender: TObject);var HWndCalculator: HWnd;begin // find the exist calculator window HWndCalculator := FindWindow(nil, '计算器');//写入你的程序标题! // close the exist Calculator } if HWndCalculator = 0 then shellexecute(self.handle, '', 'calc.exe', '', '', 0)else SendMessage(HWndCalculator, WM_CLOSE, 0, 0);end;end. // 这样处理可以吗 ? (只是想法没有做)在某一个客户端中 :先得到服务端的进程ID,向服务端发送数据后取 t := GetTickCount ; 加上一个 Timer , Timer事件中判断当 GetTickCount - t > Value (Value 为设定的一个值)时根据取得的进程 ID 杀掉服务进程再重新启动服务进程 ;(在服务进程中 :进程启动后向该客户端发送消息,客户端收到消息后取服务端进程ID ;) 利用com+,就不难搞定了!只要有客户端请求,服务器端就可以自动启动! cs 使用的是UDP,弄一个程序定期的检查这udp端口也行,当掉了,就重新启动。 我有主意 这样子好了 程序A每隔5分钟向cs程序发送一个消息cs程序收到后回应消息 发送给A如果没有回应则认为当机 杀掉cs 再启动 报表中如何定义变量 delphi中怎么嵌入 XML 画布打印的问题,应该很多人都遇到过,请赐教,谢谢! StringGrid问题:有一StringGrid,里面有很多行数据,我想在最上面插入一行,解决马上揭帖,决不食言! WINDOWS或DELPHI自己有下载函数吗? 请问如何把数据库中触发器的一个生成值返回到DEPHI程序的EDIT中啊 order by 根据多列排序 1 想结帖,可是出现错误,求助~~~ 关于数据库的问题。急、急、急! 菜鸟问题:用Html help workshop如何将html文件转为chm 文件? delphi中有没有类似于VB中的DoEvents的函数?
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
uses
shellapi;procedure TForm1.Button1Click(Sender: TObject);var
HWndCalculator: HWnd;
begin
// find the exist calculator window
HWndCalculator := FindWindow(nil, '计算器');//写入你的程序标题! // close the exist Calculator }
if HWndCalculator = 0 then
shellexecute(self.handle, '', 'calc.exe', '', '', 0)
else
SendMessage(HWndCalculator, WM_CLOSE, 0, 0);
end;end.
GetTickCount - t > Value (Value 为设定的一个值)时根据取得的进程 ID 杀掉服务进程再重新启动服务进程 ;(在服务进程中 :进程启动后向该客户端发送消息,客户端收到消息后取服务端进程ID ;)
弄一个程序定期的检查这udp端口也行,当掉了,就重新启动。
cs程序收到后回应消息 发送给A
如果没有回应则认为当机 杀掉cs 再启动