AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

WindowProc einer Klasse?

Ein Thema von TriphunEM · begonnen am 1. Feb 2006 · letzter Beitrag vom 4. Feb 2006
Antwort Antwort
Benutzerbild von retnyg
retnyg

Registriert seit: 12. Feb 2005
193 Beiträge
 
#1

Re: WindowProc einer Klasse?

  Alt 1. Feb 2006, 22:52
Delphi-Quellcode:
// code ist aus flocke's sizegrip unit ausgeliehen, thx nochma :P
type
  TWndProc = function (hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;

var
  OldWndProc: TWndProc;

function NewWndProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;

  function CallOld: LRESULT;
  begin
    Result := CallWindowProc(@OldWndProc, hWnd, Msg, wParam, lParam);
  end;

begin
  // Result := DefWindowProc(hWnd, Msg, wParam, lParam); // standardWndProc aufrufen

  case Msg of
    WM_DESTROY: begin
      SetWindowLong(hWnd, GWL_WNDPROC, LongInt(@OldWndProc));
      result := callold;
    end;

    WM_PAINT: Begin
      // dein code ^.^
    end;

    else
      Result := CallOld;
  end;
end;

procedure RemoveMsgHook(hWnd: HWND);
begin
  if @OldWndProc <> nil then
    SetWindowLong(hWnd, GWL_WNDPROC, LongInt(@OldWndProc));
end;

procedure SetMsgHook(hWnd: HWND);
begin
  RemoveMsgHook(hWnd);
  OldWndProc := TWndProc(Pointer(GetWindowLong(hWnd, GWL_WNDPROC)));
  SetWindowLong(hWnd, GWL_WNDPROC, LongInt(@NewWndProc));
end;
  Mit Zitat antworten Zitat
Antwort Antwort


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 05:15 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 by Thomas Breitkreuz