🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer.misc
Article #170

PM Programming Question; pls help

#170
From: Keith Bennett
Date: Fri, 01 Mar 1996 00:00
60 lines
2984 bytes
I have an object that creates a window, draws text in it, and puts a
button window in it.  I want to be able to remove it either by the
user pressing the button, or by deleting the object.  My destructor
calls a member function Close().  I've tried several approaches in
Close(), but none seem to take care of all my needs.

The most obvious approach (to me) was to send this window a WM_CLOSE
message.  When I created it, I used WinCreateStdWindow, and got a
hwndFrame and hwndClient.  When I send the WM_CLOSE to the client, it
closes the window, but closes the application's window too.  This is
not what I want.  Two different people have advised me to check that
I'm not sending the WM_CLOSE to the app's main window, but I checked
by printing out handles and I'm not.  I also checked by putting a
cout<< in the WM_CLOSE section of my window's procedure.

The WM_CLOSE section looked something like this:

// *******************************************************************
case WM_CLOSE:
// *******************************************************************
{
	cout << "Got CLOSE msg." << endl;
	mr = WinDefWindowProc (hwnd, msg, mp1, mp2);
	break;
}

When I commented out the WinDefWindowProc(), none of the windows
closed.

Is there something I look for in the way the windows are being
created that would explain why the main window closes when my message
box window closes?

I am very inexperienced with PM programming, so feel free to state the 
obvious; it may not be obvious to me.

The posting of the WM_CLOSE message is happening from a separate
thread from the thread where the window was created.

------------------------------------------------------------------------

Is it true that I must call WinDestroyWindow() to free the memory PM
allocates for the window?

Right now, I'm managing to close just the message box window by
sending a click message to its OK button.  My concern is that this
will not free the memory for that window.  A Windows programmer
friend told me that I need to free (destroy) the window explicitly or
the memory will never be deallocated.

Any suggestions?

Thanks....
- Keith

-- 
--------------------------------------------------------------------------
Keith Bennett                             Bennett Business Solutions, Inc.
Silver Spring, MD USA                     OS/2 & DOS Software Development
kbennett@cpcug.org                        (301) 871-7696
Technical Details
Message-ID: <4h7v58$3cu@cpcug.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11307a,32221af43e415bbf,start
X-Google-Attributes: gid11307a,public
X-Google-Thread: 10cd94,32221af43e415bbf,start
X-Google-Attributes: gid10cd94,public
From: kbennett@cpcug.org (Keith Bennett)
Subject: PM Programming Question; pls help
Date: 1996/03/01
Message-ID: <4h7v58$3cu@cpcug.org>
X-Deja-AN: 141714040
organization: Express Access Online Communications USA: 800-969-9090
newsgroups: comp.os.os2.programmer.misc,bit.listserv.os2-l