On Thu, 29 May 1997 15:59:51 -0400 (EDT) Pierre Phaneuf pp@dilu.ml.org wrote:
[...]
Yes, that is correct. The handle is not not necessary in TObject - but I still feel that it does no harm to have it there.
What if it did?
How can it?
What if I use a windowing system that has long integers for window handles?
Nothing stopping you from having a different name for your handle. Also, that is one reason for having the source code. You can change anything that doesn't suit you. Apart from that, in other places, I would declare the handle as a THandle or HWnd - the meaning of which varies depending on the platform. In Win16 it is a Word. In Win32 it is a long integer (which is the same as an integer in GPC).
You have a field there that's basically of *no use*.
Ok.
The instance pointer is an unique ID, why have another redundant one?
Yes, the instance pointer is a unique ID. But this assumes that you know the instance pointer. This will be the case in most situations, but it won't always be the case. And, like I said in another post, there are things that you can do with integers that you cannot do with pointers.
I don't know. Why would you know more the integer ID than the instance pointer?
You wouldn't. And that is the crux of the matter. In CHIEFAPP define a GetObjectCount function which returns the number of currently active objects. I can loop through these and do any number of things with the information - here is a trivial example;
for i := 1 to GetObjectCount do begin p := InstanceFromSelfID ( i ); If Assigned ( p ) then begin If p^.Name = 'CHIEFDIALOG' then { blah blah } else If p^.Name = 'CHIEFCONTROL' then {blah blah} else {blah blah}; end; end;
And what kind of things would you do with an unique integer ID?
Inter-process communication and message passing for one. Saving and storing things for another - the objects themselves, the state of the desktop, the whole environment in which the program is running, etc.
Best regards, The Chief Dr Abimbola A. Olowofoyeku (The African Chief, and the Great Elephant) Author of: Chief's Installer Pro v3.50 for Win16 and Win32. Homepage: http://ourworld.compuserve.com/homepages/African_Chief/ E-mail: laa12@cc.keele.ac.uk