1. Inheriting win32 Handles
- Posted by jordah at btopenworld.com Feb 06, 2003
- 416 views
Hi all, I was just writing my own EUWIN. when i came across something funny. I wanted to Inherit win32 Handles to respond to basic events just as if they were created by EUWIN. After doing that i just checked win32lib's subclasscontrol(). I noticed in win32lib, you subclass a control by also assigning it a "new parent". How about the original parent of the control? What if the original parent of the control is also a handle? This would mean getParent() would fail...and this would lead to other successive errors. Correct me if i'm wrong? Jordah ---
2. Re: Inheriting win32 Handles
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 07, 2003
- 407 views
On Thu, 6 Feb 2003 23:27:53 -0000, <jordah at btopenworld.com> wrote: > > Hi all, > I was just writing my own EUWIN. when i came across something funny. I > wanted to Inherit win32 Handles to respond to basic events just as if > they > were created by EUWIN. After doing that i just checked win32lib's > subclasscontrol(). > > I noticed in win32lib, you subclass a control by also assigning it a "new > parent". How about the original parent of the control? What if the > original > parent of the control is also a handle? This would mean getParent() would > fail...and this would lead to other successive errors. > > Correct me if i'm wrong? Okay, I'll give it a try. Firstly, the routine subClassControl() is documented that it only applies to controls that Windows has created and win32lib does not know about. Such as the edit box area for a combo box. The routine is used to 'simulate' creating the edit box as if win32lib had created it. It does NOT change it's parentage in the strict Windows sense. The purpose of this routine is so that we can use the normal win32lib events and other routines on a control that Windows created. To do this, it just creates the structures inside win32lib to support it, It does not create a Windows control as that already exists. Secondly, there is an undocumented use for this routine. This other use is just so that I don't have duplicated code hanging around. Internally I call the routine when win32lib has created a control in order to create the supporting internal structures. Now, if you supply the 'parent' value as a hWnd type, you are doing the wrong thing. The documenation says that the parent value is an Id - that is: a value returned to you from a previous call to create(). -- cheers, Derek Parnell
3. Re: Inheriting win32 Handles
- Posted by jordah at btopenworld.com Feb 07, 2003
- 404 views
Makes sense now, Thanx a lot mate, Jordah ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Subject: Re: Inheriting win32 Handles > > On Thu, 6 Feb 2003 23:27:53 -0000, <jordah at btopenworld.com> wrote: > > > > > Hi all, > > I was just writing my own EUWIN. when i came across something funny. I > > wanted to Inherit win32 Handles to respond to basic events just as if > > they > > were created by EUWIN. After doing that i just checked win32lib's > > subclasscontrol(). > > > > I noticed in win32lib, you subclass a control by also assigning it a "new > > parent". How about the original parent of the control? What if the > > original > > parent of the control is also a handle? This would mean getParent() would > > fail...and this would lead to other successive errors. > > > > Correct me if i'm wrong? > > Okay, I'll give it a try. > > Firstly, the routine subClassControl() is documented that it only applies > to controls that Windows has created and win32lib does not know about. Such > as the edit box area for a combo box. The routine is used to 'simulate' > creating the edit box as if win32lib had created it. It does NOT change > it's parentage in the strict Windows sense. The purpose of this routine is > so that we can use the normal win32lib events and other routines on a > control that Windows created. To do this, it just creates the structures > inside win32lib to support it, It does not create a Windows control as that > already exists. > > Secondly, there is an undocumented use for this routine. This other use is > just so that I don't have duplicated code hanging around. Internally I call > the routine when win32lib has created a control in order to create the > supporting internal structures. > > Now, if you supply the 'parent' value as a hWnd type, you are doing the > wrong thing. The documenation says that the parent value is an Id - that > is: a value returned to you from a previous call to create(). > > -- > > cheers, > Derek Parnell > > > > TOPICA - Start your own email discussion group. FREE! > ---