C
colacoca
Unregistered / Unconfirmed
GUEST, unregistred user!
用:<br>procedure Tform1.ProcessList(); //察看进程的过程<br>var<br> lppe: TProcessEntry32;<br> found : boolean;<br> Hand : THandle;<br>begin<br> ListBox1.Items.Clear;<br> Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);<br> found := Process32First(Hand,lppe);<br> while found do<br> begin<br> ListBox1.Items.Add(StrPas(lppe.szExeFile));//列出所有进程。<br> found := Process32Next(Hand,lppe);<br> end;<br>end;<br>可以在程序中显示进程<br>但是现在出了一个问题,如果是服务端被客户端调用上面的过程的话,则显示不了进程,为什么???怎么解决?????<br>具体例子:<br>客户段发送请求: ClientSocket1.Socket.SendText('A');<br>服务端接到请求,并对请求进行处理:<br>procedure TForm1.ServerSocket1ClientRead(Sender: TObject;<br> Socket: TCustomWinSocket);<br>var<br>Data: String;<br>begin<br> Data:=Socket.ReceiveText;<br> Edit1.Text:='收到字符:'+Data;<br> ProcessList(); //调用察看进程的过程<br>end;<br><br>进程没有在listbox1中显示,但是在服务端直接用Button调用,进程则能在listbox1中显示:<br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> ProcessList(); //调用察看进程的过程<br>end;<br><br>请大家帮我解决一下.