Einzelnen Beitrag anzeigen

Benutzerbild von Flocke
Flocke

Registriert seit: 9. Jun 2005
Ort: Unna
1.172 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#22

Re: Ist es möglich die Scrollbar in MDI-Form abzuschalten ?

  Alt 17. Feb 2006, 20:32
Schon fast richtig - allerdings ist ClientWndProc keine Methode von TForm1 sondern eigenständig.

Du musst es also oben aus der Deklaration von TForm1 entfernen und unten über das FormCreate setzen (damit's bekannt ist). Vielleicht solltest du es auch erst in FormShow machen, damit ClientHandle auf jeden Fall gültig ist.

Also:
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormShow(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function ClientWindowProcNoSB(wnd: HWND; msg: Cardinal; wparam, lparam: Integer): Integer; stdcall;
begin
  if msg = WM_NCCALCSIZE then
    SetWindowLong(wnd, GWL_STYLE,
      GetWindowLong(wnd, GWL_STYLE) and not (WS_HSCROLL or WS_VSCROLL));
  Result := CallWindowProc(Pointer(GetWindowLong(wnd, GWL_USERDATA)),
    wnd, msg, wparam, lparam);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  If ClientHandle <> 0 Then
    If GetWindowLong( ClientHandle, GWL_USERDATA ) = 0 Then
      SetWindowLong( ClientHandle, GWL_USERDATA,
                     SetWindowLong( ClientHandle, GWL_WNDPROC,
                                    integer( @ClientWindowProcNoSB)));
end;

end.
Volker
Besucht meine Garage
Aktuell: RtfLabel 1.3d, PrintToFile 1.4
  Mit Zitat antworten Zitat