TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jonathan de Boyne Pollard
from: Steffen Offermann
date: 1995-04-29 18:59:00
subject: Q: User specific data in

Hi!

20 Apr 95 11:39, Jonathan de Boyne Pollard wrote to Steffen Offermann:

 >> From: steve{at}pil.dssd.fido.de (Steffen Offermann)

 JdBP>  We know who you are, thanks.  It's in your origin line
 JdBP> (and in the proper format, too).

My mail was copied from a Fido.De conference (InterNet newsgroup), and
I did not feel like removing the address line.

 JdBP> There is no guarantee that the control data structure that
 JdBP> you pass to WinCreateWindow() will still be around after
 JdBP> you have created the window. Certainly you, the programmer
 JdBP> calling WinCreateWindow(), are not required to keep it
 JdBP> around.

I found the information I had been looking for just after my
mail had been sent. It is the function WinSetWindowPtr() which
I was not aware of.

 JdBP> One way is to allocate the create data structure off the
 JdBP> heap, implicitly transfer ownership of that structure to
 JdBP> your window procedure during window creation, and then
 JdBP> store the pointer to the  structure in the window using
 JdBP> WinSetWindowPtr.

That's exactly what I am doing right now.

 JdBP> Another way is to maintain an associative array of HWNDs and
 JdBP> pointers to create data, which you maintain in the WM_CREATE
 JdBP> and WM_DESTROY events of your windows.

And that's what I first thought of - but that's rather inefficient
and bad programming style.

 JdBP> Yet another way is to use a C++ class library for PM and
 JdBP> derive a class from the requisite window class with the
 JdBP> approriate instance data members that you desire.

I am, in fact, writing such a class library myself, and the data I
store using WinSetWindowPtr() is the window's this-pointer. Every-
thing works fine so far, but now I have another problem: I would
like to use a dialog window as my application's main window, but
this does not work as expected. If I use the frame window style
FCF_SHELLPOSITION, the window size is - of course - set by the
shell. Omitting this flags results in a window that has no title
bar, no buttons, no system menu and no border. Do I really have
to simulate the dialog by handling every possible window message
myself, or is there an easy and clean way to set a dialog as main
window?

Tschuess, Steffen

--- FastEcho 1.41g+
* Origin: Sprach's und verschwand von der Bildflaeche (2:2433/1860)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 2433/1860 1800 1200 2440/225 2452/110 105/42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.