Thema: Delphi Wm_syscommand

Einzelnen Beitrag anzeigen

marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#8

Re: Wm_syscommand

  Alt 3. Okt 2005, 10:05
Klebe mal eine ListBox auf deine Form und probiere das hier aus - vielleicht bekommst du dann einen Hinweis, was schief läuft:

Delphi-Quellcode:
procedure TForm1.FormShow(Sender: TObject);
var
  h: HWnd;
  buf: array [0..255] of char;
begin
  ListBox.Items.Clear;
  h := Handle;
  while h > 0 do
  begin
    if IsWindowVisible(h) then
    begin
      GetWindowText(h, buf, SizeOf(buf));
      ListBox.Items.Add(StrPas(@buf));
// if StrPas(@buf) <> 'Program Manager' then
// PostMessage(h, WM_SYSCOMMAND, SC_Close, 0);
    end;
    h := GetNextWindow(h, GW_HWNDNEXT);
  end;
end;
marabu
  Mit Zitat antworten Zitat