🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

What do I do with stale window handles? (GetDesktopWindow() )

#1533
From: Thomas B. Kinsman (37681)
Date: Wed, 06 Mar 1991 21:58
33 lines
1771 bytes
    In the heat of computation I suddenly discover that something has
    gone wrong.  I don't have a global variable for the window handle
    because I'm encapsulating my routines.

    I want to use MessageBox() to signal the user (me) *what* went
    wrong.  MessageBox() needs a handle to a window.  The following
    snippet of code correctly displays the message box, but later hangs.

    Do I need to get rid of the window handle once I am done with it?
    If so, how?  Release?  Destroy?

    Thanks in advance.

		- Thomas Kinsman		thomas@ssd.kodak.com

-------  snippet  ---  snippet  ---  snippet  snippet  ---  snippet  ------

    if (<something horribly wrong >)
    {
HWND                    hwndDisplay;		/* handle to display */

	hwndDisplay = GetDesktopWindow();
	MessageBox(hwndDisplay,
		   (LPSTR) "Something went horribly wrong",
		   (LPSTR) "on a call to : Process(foo, bar)", MB_OK);
	return FALSE;
    }
-- 
----
thomas@ssd.kodak.com	Voice: 716/253-7681(w)		Fax: 716/253-7443
Thomas B. Kinsman, Eastman Kodak Co., Flr 1, Bldg 10, C, Roch., NY 14653-9011
"Knowledge is what's left when you throw the books away."	- A. Einstein
Technical Details
Message-ID: <1991Mar6.215823.3216@ssd.kodak.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!mintaka!think.com!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!kodak!ispd-newsserver!thomas

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!mintaka!think.com!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!kodak!ispd-newsserver!thomas
From: thomas@ssd.kodak.com (Thomas B. Kinsman (37681))
Newsgroups: comp.windows.ms.programmer
Subject: What do I do with stale window handles? (GetDesktopWindow() )
Keywords: Handles, Stale, Release, Destroy
Message-ID: <1991Mar6.215823.3216@ssd.kodak.com>
Date: 6 Mar 91 21:58:23 GMT
Sender: news@ssd.kodak.com
Distribution: na
Organization: Eastman Kodak
Lines: 33
Originator: thomas@magpie