[fpc-pascal]Ummmm... anyone know why this doesn't work...

L D Blake ldblake at sympatico.ca
Tue Aug 5 19:26:50 CEST 2003


A little while back Matt Emson helped me with the message dispatcher for
windows programs... we arrived at something like this:

>     while GetMessage(@oMsg,0, 0, 0) do
>       begin
>         if not (IsDialogMessage(OHandle,omsg)) then
>           begin
>             TranslateMessage(oMsg);
>             DispatchMessage(oMsg);
>           end;
>       end;

I've kept tinkering with it in a multi window program where each window has
it's own WinProc to handle buttons, clicks and things. Rather than use
multiple dispatchers (which seems not to improve performance much) I kept
tinkering with the one above and arrived at:

  // Message dispatcher for all windows
  while GetMessage(WMsg,0,0,0) do
    begin
      if not IsDialogMessage(getforegroundwindow,wmsg) then
        begin
          TranslateMessage(WMsg);
          DispatchMessage(WMsg);
        end;
    end;

I currently have 6 windows that pop up at various times and this handles
tabbing and menu selection for them all, quite nicely.
    
So Matt... if you're reading this you might like to try it out.

-----
 L D Blake





More information about the fpc-pascal mailing list