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

Michael A. Hess mhess at miraclec.com
Tue Aug 10 14:07:05 EDT 1999


Jeff Wormsley wrote:
> 
> I will have to look into the RTL TObject declaration.  It was my
> understanding that this had nothing to do with native Windows
> messages,

It doesn't have anything to do with Windows native handling. If I
understand things correctly in Windows the callbacks aka messages from
Windows are sent to a Dispatch routine in Delphi. This then takes care
of sending it to the correct handler that was defined by the

procedure xxxxxx; message;

etc. etc.


This is estentially what Free Pascal and the LCL does. You define 

procedure xxxx; message LM_XXX;

This means that this routine is used as a message handler for the
message LM_XXX.

When you call

  TObject(data).Dispatch(LM_XXX);

It will call the handler that was defined for that Object.

Now with what you are doing you will be creating the Window, Component
or whatever using the Windows API with code written in the win32int.pp
unit. It will know it needs to do this by the LM_Create message sent by
the LCL. Now when you create the Window you will need to setup what is
used as the callback/handler (whatever). At this point it will be a
routine within the win32int unit. Now I assume you can pass to the
windows object you are creating some data of your own choosing. This
would be the Self value passed in the SendMessage. Then in the callback
I again assume that this data is available. You would then use that as
the TObject for calling the Dispatch with the correct and valid message.

> So, if this is in the TObject, then I should be able to catch a LM_xxx
> message in Interfaces, translate it to a windows message, and then
> call TObject(Sender).Dispatch(Win32Message) ???  Is this what I
> missed?

Which way are you talking about the message being sent? Are you talking
about the message coming from Windows back to the LCL code to a message
handler or are you sending a message to Windows?


-- 
==== 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