Einzelnen Beitrag anzeigen

TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.070 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: ListView Header Farbe (Win32)

  Alt 17. Jan 2017, 11:38
Du brauchst also nur das Handle davon?
Vielleicht reicht es aus, wenn du WM_PARENTNOTIFY abgreifst und dir wie unten gezeigt das Headerhandle holst?!

Delphi-Quellcode:
  TWMParentNotify = record
    Msg: Cardinal;
    MsgFiller: TDWordFiller;
    case Word of
      WM_CREATE, WM_DESTROY: (
        Unused1: Word;
        ChildID: Word;
        EventChildIDFiller: TDWordFiller;
        ChildWnd: HWnd);
      WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN: (
        Unused2: Word;
        Value: Word;
        EventValueFiller: TDWordFiller;
        XPos: Smallint;
        YPos: Smallint;
        XYPosFiller: TDWordFiller);
      0: (
        Event: Word;
        Value1: Word;
        EventValue1Filler: TDWordFiller;
        Value2: LPARAM;
        Result: LRESULT);
  end;

...

procedure WMParentNotify(var Message: TWMParentNotify); message WM_PARENTNOTIFY;

...

procedure TCustomListView.WMParentNotify(var Message: TWMParentNotify);
begin
  with Message do
    if (Event = WM_CREATE) and (FHeaderHandle = 0) then
    begin
      FHeaderHandle := ChildWnd;
      FDefHeaderProc := TWindowProcPtr(GetWindowLong(FHeaderHandle, GWL_WNDPROC));
{$IFDEF CLR}
      SetWindowLong(FHeaderHandle, GWL_WNDPROC, FLVInstances.FHeaderInstance);
{$ELSE}
      SetWindowLong(FHeaderHandle, GWL_WNDPROC, Winapi.Windows.LPARAM(FHeaderInstance));
{$ENDIF}
    end;
  inherited;
end;
  Mit Zitat antworten Zitat