🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2828

Re: Window Handles: what's real?

#2828
From: Ken SYKES
Date: Thu, 23 May 1991 03:31
23 lines
1556 bytes
In article <5175@servax0.essex.ac.uk> whisd@essex.ac.uk (Whiteside S D B) writes:
>Can anyone clarify this for me?
>
>When I use a CreateWindow call, my window's message function gets called with one of the parameters being hWnd.
>
>When the CreateWindow call returns it gives me the hWnd for the window just created.
>
>BUT... these two handles are different! Which is the real one?
>
>I've tried both, and both seem to work. Why does a window need TWO handles?!!

This has been discussed before but here is the reason (sort of): The hwnd
at the WM_CREATE create message is not "fully initialized" as a window
handle.  You are in the process of creating a window so this kinda makes
sense.  The createstruct pointed to by lParam contains the proper handle
if I remember correctly.  The hWnd passed back from CreateWindow is
valid and will match the handle seen in subsequent messages to your
WndProc.

Hope this clears up the confusion.

Ken Sykes
Disclaimer: The above opinions are solely my own.
Technical Details
Message-ID: <72515@microsoft.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!microsoft!kensy
References: <108350001@hplred.HP.COM> <5175@servax0.essex.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!microsoft!kensy
From: kensy@microsoft.UUCP (Ken SYKES)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Window Handles: what's real?
Keywords: windows, microsoft, handle
Message-ID: <72515@microsoft.UUCP>
Date: 23 May 91 03:31:14 GMT
References: <108350001@hplred.HP.COM> <5175@servax0.essex.ac.uk>
Reply-To: kensy@microsoft.UUCP (Ken SYKES)
Organization: Microsoft Corp., Redmond WA
Lines: 23