[lazarus] More Native Win32 stuff(Pascal,canyouhelphere?)

Michael A. Hess mhess at miraclec.com
Tue Aug 10 16:26:43 EDT 1999


Jeff Wormsley wrote:
> 
> 
> Let's see if I have this right, then...  I know I am still in the air
> about callbacks...
> 
> TForm in its create calls SendMessage(LM_CREATE, Self)

Correct
 
> TInteface processes the SendMessage, cases off of the message to
> LM_CREATE, then what???  I though it would create a window and set a
> variable of type HWnd, then somhow create/initialize a window
> procedure for that window handle.  I could create the window, but had
> no clue as to what to use for a window procedure.  According to the
> posts today, it would seem that is in TObject.

Defining and setting the callback (which is the windproc) is your job.
You will need to have this callback in the win32int unit and define it
in the WndClass structure that you pass to the CreateWindow routine.
This is then the callback that Windows will use for this control.
 
> Somewhere there is this mysterious SetCallBack to handle.

This is where it is a little different then GTK. In GTK you can set a
whole host of different callbacks routines for ONE control. The
appropriate callback routine is called for the appropriate message. In
the Windows case ALL of the messages are passed back to just ONE
callback. The WindProc routine. This means that you will then have to
case the established Windproc routine to find what message is being
passed back, translate that into the appropriate LCL message (LM_XXX)
and then call Dispatch for that object with that LCL message.

> If I read this right, when TInterface is told to set a callback, there
> is a method (of TObject?) that I can use that will update a list of
> messages and the handler address for the message, so that the objects
> WindowProc can then detect that type of message and call the
> appropriate handler.

Somewhat correct. Read above.

> Presumably all I need to do there is to translate the LM_xxx to the
> Win32 equivalent and away I go.  But, what if there is no equivalent?

See this is where you keep confusing me. You should never have to
translate an LM_XXX to a Win32 equivalent. You should only every be
translating a Win32 to it's LM_XXX equivalent.

> So, to summarize, the messages from the component are handled by
> TInterface casing the SendMessage, and messages from Windows are
> handled by callbacks, which are put in place by messages from
> TInterface and SendMessage.  Is this correct?

Correct.

I am in the process of writing another email which gives more detail
using actual Windows names and references that might help you as well.

-- 
==== Programming my first best destiny! ====

Michael A. Hess      Miracle Concepts, Inc.
mhess at miraclec.com   http://www.miraclec.com






More information about the Lazarus mailing list