🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1644

Re: Clock applet

#1644
From: Hunting the Snark
Date: Fri, 16 Oct 1992 02:55
48 lines
2626 bytes
In article <1992Oct15.175501.22407@microsoft.com>, mattsq@microsoft.com (Matthew Squires) writes...
|>In article <1992Oct15.053454.8491@engage.pko.dec.com> marshall@tfh.enet.dec.com (Hunting the Snark) writes:
|>>I would like to imitate an interesting property of the Clock applet in Windows
|>>3.1 (I don't remember now if the one in 3.0 did this). When you select the "No
|>>Title" setting, holding the left mouse button down in the clock window puts it
|>>into the move mode the same as in the caption of of a normal window. How does 
|>>it do that? Is there an easy way (some undocumented windows fuction) or do they
|>>do it "the hard way" (LbuttonDown, SetCapture, GetDC, MouseMove, etc.) Is it 
|>>significant that it only does this when there is no title bar?
|> 
|>Yes, it's true!  There is another undocumented windows function called
|>"ImplementCoolClockBehaviorOnlyForMSApplications" that only we know
|>about.

Well to answer my own question: one of my collegues here did find an
undocumented method to do this. Since I've been using TPW/OWL; here is the 
method in that language that implements it:

 procedure MyProgram.wmLbuttondown(var msg:Tmessage);
 begin
    {hold down left mouse button to move window}
    SendMessage(msg.receiver,WM_SYSCOMMAND,SC_MOVE+2,0);
 end;{          ~~~~~~~~~~~~               ~~~~~~~~~this is not documented}


Works like a charm and seems alot easier than the method described below:

|>Seriously, look up the WM_NCHITTEST message.  If the user is clicking on
|>your client area (found by calling DefWindowProc and noting its return
|>value) then you would want to return HTCAPTION - i.e. windows should treat
|>this click as if it happened on the title bar.
|> 
|>There are other issues like handling double-clicks and you probably
|>don't want to let the user move your window if it is maximized, but

good point, hadn't thought of that, but this particular app under development 
can't be maximized anyway.

|>this should be enough to get you started.
|> 
|>Matt "not a spokesbeing for microsoft" Squires
|>mattsq@microsoft.com

Thanks Matt.


Steve
Technical Details
Message-ID: <1992Oct16.021046.6618@engage.pko.dec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!tfh.enet.dec.com!marshall

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!tfh.enet.dec.com!marshall
From: marshall@tfh.enet.dec.com (Hunting the Snark)
Subject: Re: Clock applet
Message-ID: <1992Oct16.021046.6618@engage.pko.dec.com>
Sender: newsdaemon@engage.pko.dec.com (USENET News Daemon)
Organization: Digital Equipment Corporation
Date: Fri, 16 Oct 1992 02:55:36 GMT
Lines: 48