AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

GetDC, Canvas, bsclear

Ein Thema von simjoh · begonnen am 6. Jul 2007 · letzter Beitrag vom 13. Jul 2007
 
simjoh

Registriert seit: 13. Nov 2006
Ort: Asslar
99 Beiträge
 
Delphi 7 Enterprise
 
#13

Re: GetDC, Canvas, bsclear

  Alt 13. Jul 2007, 08:45
Hi, sorry, bin gestern gleich offline gegangen, hätt ich gewusst, dass ich noch ne Antwort bekomme, wäre ich noch wach geblieben. Das Handle ermittle ich im Prinzip so:

Delphi-Quellcode:
//fill in the listview with all the information
procedure TMainForm.WriteText(Wnd: HWnd);
var pcWinText : PChar;
    NewItem : TListItem;
    aProcessEntry32 : TProcessEntry32;
    aSnapshotHandle : THandle;
    WinVersion : DWord;
    ProcessID : longint;
    ContinueLoop : boolean;
begin
  NewItem:=ListView.Items.Add;
  {Is Window Visible?}
  NewItem.Checked:=IsWindowVisible(wnd);
  {WindowCaption}
  pcWinText:= StrAlloc(102);
  GetWindowText(Wnd, pcWinText, 100);
  NewItem.Caption:=StrPas(pcWinText);
  StrDispose(pcWinText);
  {WindowClassName}
  pcWinText:= StrAlloc(102);
  GetClassName(Wnd, pcWinText, 100);
  NewItem.SubItems.Add(StrPas(pcWinText));
  StrDispose(pcWinText);
  {WindowHandle}
  NewItem.SubItems.Add(IntToHex(wnd, 8));
  {WindowThreadProcessID}
  GetWindowThreadProcessID(wnd,@ProcessID);
  NewItem.SubItems.Add(IntToHex(ProcessID, 8));
  {WindowsVersion}
  WinVersion:=GetProcessVersion(ProcessID);
  NewItem.SubItems.Add(IntToStr(WinVersion shr 16)+'.'+IntToStr(WinVersion mod $1000));
  {CommandLine}
  {According to Christian Kästner:}
  aSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
  aProcessEntry32.dwSize := Sizeof(aProcessEntry32);
  ContinueLoop := Process32First(aSnapshotHandle, aProcessEntry32);
  while integer(ContinueLoop) <> 0 do begin
    if aProcessEntry32.th32ProcessID = ProcessID then
      NewItem.SubItems.Add(ExtractFileName(aProcessEntry32.szExeFile));
    ContinueLoop := Process32Next(aSnapshotHandle,aProcessEntry32);
  end;
  CloseHandle(aSnapshotHandle);
  {end of Chrstian's stuff}
end;
Gruß
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz