uses TlHelp32;
procedure Process32List(Slist: TStrings);
var
 Process32: TProcessEntry32;
 SHandle:   THandle;  // the handle of the Windows object
 Next:      BOOL;
begin
 Process32.dwSize := SizeOf(TProcessEntry32);
 SHandle          := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
 if Process32First(SHandle, Process32) then
 begin
   // 실행화일명과 process object 저장
   Slist.AddObject(Process32.szExeFile, TObject(Process32.th32ProcessID));
   repeat
     Next := Process32Next(SHandle, Process32);
     if Next then Slist.AddObject(Process32.szExeFile, TObject(Process32.th32ProcessID));
   until not Next;
 end;
 CloseHandle(SHandle);  // closes an open object handle
end;
위의 "Process32List"란 함수를 이용해서 "Buff"에 현재 실행중인 목록을
구했는데 이 실행중인 프로그램의 제목(타이틀; 캡션)을 얻을려고 하는데
고수님의 도움을 부탁드립니다.
procedure TForm1.Button1Click(Sender: TObject);
var
  Buff : TStringList;
  Loop : Integer;
begin
  Memo1.Clear;
  Buff := TStringList.Create;
  try
     Process32List(Buff);
     for Loop := 0 to Buff.Count - 1 do
     begin
       // 현재 실행중인 프로그램의 제목(타이틀;캡션)을 구하고 싶어요.... 
     end;
  finally
     Buff.Free;
  end;
end; 
			 
	
	
    
    
	
	
    
    
    
procedure TForm1.Button5Click(Sender: TObject);
var
acTitle: array[0..256] of char;
begin
GetWindowText( Handle, acTitle, 256 );
showmessage( acTitle );
GetClassName( Handle, acTitle, 256 );
showmessage( acTitle );
end;
<전부>
procedure
TForm1.PlzEnumWindows( hWnd: Cardinal );
var
iID: Integer;
szStr: array[0..1023] of Char;
ListItem: TListItem;
begin
hWnd := GetWindow( hWnd, GW_CHILD );
while True do
begin
if hWnd = 0 then Break;
GetClassName( hWnd, szStr, SizeOf( szStr ) );
GetWindowText( hWnd, szStr, SizeOf( szStr ) );
hWnd := GetWindow( hWnd, GW_HWNDNEXT );
end;
end;
답변이 되는지 모르겠군요... 그럼 수고하세요
임준 wrote:
> uses TlHelp32;
>
> procedure Process32List(Slist: TStrings);
> var
> Process32: TProcessEntry32;
> SHandle: THandle; // the handle of the Windows object
> Next: BOOL;
> begin
> Process32.dwSize := SizeOf(TProcessEntry32);
> SHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
>
> if Process32First(SHandle, Process32) then
> begin
> // 실행화일명과 process object 저장
> Slist.AddObject(Process32.szExeFile, TObject(Process32.th32ProcessID));
> repeat
> Next := Process32Next(SHandle, Process32);
> if Next then Slist.AddObject(Process32.szExeFile, TObject(Process32.th32ProcessID));
> until not Next;
> end;
> CloseHandle(SHandle); // closes an open object handle
> end;
>
> 위의 "Process32List"란 함수를 이용해서 "Buff"에 현재 실행중인 목록을
> 구했는데 이 실행중인 프로그램의 제목(타이틀; 캡션)을 얻을려고 하는데
> 고수님의 도움을 부탁드립니다.
>
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
> Buff : TStringList;
> Loop : Integer;
> begin
> Memo1.Clear;
> Buff := TStringList.Create;
> try
> Process32List(Buff);
>
> for Loop := 0 to Buff.Count - 1 do
> begin
> // 현재 실행중인 프로그램의 제목(타이틀;캡션)을 구하고 싶어요....
> end;
> finally
> Buff.Free;
> end;
> end;