Solved

How to make OnMessage.....

Posted on 2001-06-29
3
177 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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