[DUG] Intercepting messages in separate units

Ross Levis ross at stationplaylist.com
Mon Jun 27 20:54:54 NZST 2005


Thanks for that Kyley.  I managed to implement AllocateHWnd etc, and everything appears correct and logical.  It's picking up some Windows messages but not the WM_USER messages being sent.  WM_USER is message number 1024.  I'm getting Message.Msg = 28 and that's about it.

I tried the same code in the mainform as a test and this worked but only after I specified the following:
procedure MyMessage(var Message: TMessage); message WM_USER;

If I leave off "message WM_USER", then nothing gets through to the procedure in the mainform at all.

I tried this in the unit and it doesn't make any difference.  Message 28 is still getting to the procedure and no 1024.

You can tell I'm no expert when it comes to this.  Do I need to use your fancy looking wrapper class?

I must be missing something.

Thanks,
Ross.
  ----- Original Message ----- 
  From: Kyley Harris 
  To: NZ Borland Developers Group - Delphi List 
  Sent: Monday, June 27, 2005 7:13 PM
  Subject: [Spam] Re: [DUG] Intercepting messages in separate units


  in the forms unit

  function AllocateHWnd(Method: TWndMethod): HWND; deprecated;  { moved to Classes.pas }
  {$EXTERNALSYM AllocateHWnd}
  procedure DeallocateHWnd(Wnd: HWND);             deprecated;  { moved to Classes.pas }


  read the help will sort you out just fine

  Ross Levis wrote: 
    I'm writing a component which communicates with a 3rd party DLL using WM_USER messages.  After loading the DLL, I need to tell the DLL the handle to send user messages back to, so my unit can intercept them, but I don't know where to get a handle from.  I know how to do it in the mainform of a program but not in a separate unit.  The messages sent to the mainform do not appear to reach my unit.

    What do I need to do to make this happen?

    Thanks,
    Ross.
----------------------------------------------------------------------------
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi
  

------------------------------------------------------------------------------


  _______________________________________________
  Delphi mailing list
  Delphi at ns3.123.co.nz
  http://ns3.123.co.nz/mailman/listinfo/delphi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20050627/068374b5/attachment.html


More information about the Delphi mailing list