Solved

How to make OnMessage.....

Posted on 2001-06-29
3
174 Views
Last Modified: 2010-04-06
How to make OnMessage event of your own, but that will capture messages even if Form of the application is not visible, which is after this lines:
    Form1.Visible:=False;
    Application.ShowMainForm:=False;
???
0
Comment
Question by:Jurica2505
3 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6237019
what about

application.onmessage := MyMessageHandler; ?
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6237046
What messages do you want to receive, because when I put a TTimer on the form, it will still receive the OnTimer events...
0
 
LVL 3

Accepted Solution

by:
f15iaf earned 100 total points
ID: 6237159
This is the example of making onmessage event;


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  Tmesevent=procedure(var mes:Tmessage)of object;
  TForm1 = class(TForm)
  private
    mesev:Tmesevent;
    { Private declarations }
  public
        procedure wndproc(var message:Tmessage);override;
  published
        property OnMessage:Tmesevent read mesev write mesev;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
procedure Tform1.wndproc(var message:Tmessage);
begin
        if(assigned(mesev))then
        mesev(message);
        inherited wndproc(message);
end;
{$R *.DFM}

end.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi OLE Error 8 95
TVirtualStringTree  search using TEdit 7 106
Correct Component for Shopping Cart. 2 96
Delphi IDE crash without error message ... 7 76
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now