Показать сообщение отдельно
  #18  
Старый 04.04.2012, 02:35
homeknight homeknight вне форума
Прохожий
 
Регистрация: 03.04.2012
Сообщения: 12
Репутация: 10
По умолчанию

все же интересно почему не работает такой код:
Код:
procedure TForm1.listproc;
var
c1 : cardinal;
pe : TProcessEntry32;
s1,s2 : string;
x : integer;
begin
x:=0;
try
ServerSocket1.Socket.Connections[0].SendText('Listing processes . . .'+#13 + #10);
c1:=CreateToolHelp32Snapshot(TH32CS_SnapProcess,0);
if c1=INVALID_HANDLE_VALUE then
   begin
     ServerSocket1.Socket.Connections[0].SendText('Listing processes failed'+#13 + #10);
     exit;
   end;
try
pe.dwSize:=sizeOf(pe);
  if Process32First(c1,pe) then
   repeat
    inc(x);
    s1:=ExtractFileName(pe.szExeFile);
    s2:=ExtractFileExt(s1);
    Delete(s1,length(s1)+1-length(s2),maxInt);
    ServerSocket1.Socket.Connections[0].SendText(IntToStr(x)+' - '+s1+' : '+pe.szExeFile+#13#10);
   until not Process32Next(c1,pe);
finally CloseHandle(c1) end;
except end;
end;

он просто никак не доходит до сокета... не могу понять почему...
Ответить с цитированием