TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Steffen Offermann
from: Jonathan de Boyne Pollard
date: 1995-04-20 11:39:28
subject: Q: User specific data in

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

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

ZZ>
  > When I define an own window class I can use the parameter 
  > from WinCreateWindow() to convey specific data needed by this class.
  >      [...]              The problem is: A pointer to this info record
  > is only available with the WM_CREATE message, not with WM_DESTROY, if
  > the documentation is right. So there is no clean and comfortable way
  > to have the window procedure dynamically (de)allocated this record.
  >
  > My question is: Is it possible to query the record pointer using
  > some PM API call?
ZZ>

  No.

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

  So if you want to save what is in it, then you have to take charge of
  keeping it around yourself.

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

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

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

  I use the third method myself, but it does require all of the extra
  effort of getting hold of a class library.

  > JdeBP <
___
 X MegaMail 2.10 #0:

--- Maximus/2 2.02
* Origin: DoNoR/2,Woking UK (44-1483-722344) (2:440/4)
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: 440/4 141/209 270/101 105/103 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™.