🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #158

MDI Parent and Scroll Bars - Peter Below's code won't compile!

#158
From: Brad Miller
Date: Mon, 26 Jan 2004 18:48
46 lines
2860 bytes
So I've inherited this MDI application, and it has the ubiquitous scroll 
bars, which I'm trying to get rid of. While the whole MDI scheme is 
inherently bogus, I don't have the time right now to eradicate it from 
the app. So I find a couple of code snippets from Peter Below, about 
subclassing the form to get these things to go away:

If ClientHandle <> 0 Then Begin
     If GetWindowLong( ClientHandle, GWL_USERDATA ) <> 0 Then
       Exit; // cannot subclass client window, userdata already in use

{!!!!!THIS LINE IS GETTING FLAGGED AS ERROR!!!!!}
     SetWindowLong( ClientHandle, GWL_USERDATA,
                    SetWindowLong( ClientHandle, GWL_WNDPROC,
                                   integer( @ClientWindowProc)));
{!!!!!ERROR BEING REPORTED IS "Variable Required"!!!!!}
   End;

Add a new standalone function to the unit, it has to go above the
FormCreate method since it is referenced in the statement above.

Function ClientWindowProc( wnd: HWND; msg: Cardinal; wparam,
                            lparam: Integer ): Integer; stdcall;
Var
   f: Pointer;
Begin
   f:= Pointer( GetWindowLong( wnd, GWL_USERDATA ));
   Case msg of
     WM_NCCALCSIZE: Begin
         If ( GetWindowLong( wnd, GWL_STYLE ) and
              (WS_HSCROLL or WS_VSCROLL)) <> 0
         Then
           SetWindowLong( wnd, GWL_STYLE,
                          GetWindowLong( wnd, GWL_STYLE )
                          and not (WS_HSCROLL or WS_VSCROLL));
       End;
   End;
   Result := CallWindowProc( f, wnd, msg, wparam, lparam );
End;

As shown in the code above, I'm getting an error when attempting to 
compile this in D5. I've tried a couple of things to make it happy, but 
so far to no avail. Any ideas? Should this compile in D5? Compiler 
switch that might be messing it up? This is on XP Professional.

TIA
Brad Miller
Technical Details
Message-ID: <4015601e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f94dd,8ff3524931d7799a,start
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2004-01-26 11:10:03 PST
Date: Mon, 26 Jan 2004 10:48:57 -0800
From: Brad Miller <Windopaene@nohaminYAHacanformeOO.COM>
User-Agent: Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.5) Gecko/20031007
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.delphi.nativeapi
Subject: MDI Parent and Scroll Bars - Peter Below's code won't compile!
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.40.181.198
Message-ID: <4015601e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1075142686 67.40.181.198 (26 Jan 2004 10:44:46 -0700)
Lines: 47
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail