[fpc-pascal] How to use a window message queue in a call?
Michael Van Canneyt
michael at freepascal.org
Wed Jan 27 10:15:20 CET 2010
On Wed, 27 Jan 2010, Daniel Gilbert wrote:
> Hi there,
> this is my first posting to the fpc-mailinglist, so please don't slap me if I
> do anything wrong. :)
> I'm currently re-writing a program I've written in Delphi some months ago.
> Due to the now missing free version, I've decided to switch over to
> Freepascal. But now, I'm somehow stuck.
> The application is Windows-only, and I'm using WindowsAPI-calls to create the
> main window. But I would like to program in an object-oriented way, so I
> decided to create a class, TstMainWindow.
> To get Messages from your Window, you need a Callback. Unfortunately, a
> pointer to a method is <> a pointer to a function.
> So i tried this workaround, I've posted it at the german lazarus forum:
You cannot use a method as a window message handler.
You must use a plain function for this. You can see in the lazarus
file win32callback.inc, function CallDefaultWindowProc or WindowProc
how to do this and how to transfer the code to your objects.
I'm surprised the code at Delphipraxis works at all. Probably because
the delphi compiler uses a different calling convention.
More information about the fpc-pascal