I think I am getting somewhere now, thanks to everyone's patience. See if I am following…
Jeffrey A. Wormsley wrote 6 lines
Correct
Q. Do I need more than one window class? If so, I will need a unique window procedure for each class, correct?
Not sure if you would need a separate one or not. I'm not sure exactly what information is in the WNDCLASS so I can't say for sure. If you do then it might be a good idea to have a separate WINDPROC for each just to keep things neat and clean.
2. Create a window handle with CreateWindow or CreateWindowEx, passing the initial position, size and style information, translated from LCL to Win32, and using the appropriate parent window from the Data pointer passed in.
Sound right so far.
3. Use SetProp to store Data to the window handle structure.
Oh so that's how you do it. Fine.
Q. Should this utilize the lpString parameter directly, subverting its intention as a pointer to a string, or is there a way to get a unique string and use this to index the hData parameter?
I would say subvert it's use as a pointer to a string.
Q. What do I do with the WM_CREATE message recieved by the window procedure? Throw it away? If I pass it on to TObject(Data).Dispatch(LM_CREATE), will this cause an infinite loop?
No it will not cause a loop. If you remember the LM_CREATE that win32int is getting is due to a specific request in the objects .Create. This is called in the TControl method CreateComponent. It is not responding to the LM_CREATE message it is generating it. When you send the Dispatch that is more or less just telling the object that hey a valid LM_CREATE has been done for you. Is there any specific parameters you want to set before the window is really, really made?
Show quoted text 13 lines
Yep that is all there is to handling a message from Windows.
Show quoted text 9 lines
The CreateWindow returns the HWND. In TControl there is the variable fComponent. It is defined as a pointer so it can hold a pointer to anything. In the case of GTK this hold the pointer for the widget handle. In your case load it up with the HWND and now you have an association between the TControl and the Windows Object. Then in turn the HWND has an association to the TControl form the SetProc that you used. So each knows about each other and can access each other when needed.
So for the above question the InterfaceObject.IntSendMessage would get the LM_SETTEXT message with the Self value passed. From the Sender value you can determine what kind of component it is, a button, a window, etc. etc. This way you know what kind of component you are trying to set text for. Then you access the fComponent value from the Sender to determine the exact HWND value that Windows know it by and call the appropriate Windows API call with the HWND. That should be it.
