Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
General :: Windows :: Programming :: Windows with Delphi :: Windows Forms
Code snippets, Q+A around the Windows user interface. From a Delphi perspective, but usually applicable to other languages.
Articles:
This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
This is the FULL list of all articles in this category.
Featured Article
Catching ALL mouse eventsQuestion:
I tried to override the MouseDown() method in a subclass of TForm to get every event for a general handler.
I get only the events, when the user clicks somewhere on the form, where it has no controls. When the user clicks on a control, the message is handled by this control.
How can I get every MouseDown event in a form?
Answer:
The Application.OnMessage event will see all mouse messages before they are delivered to the control under the mouse. You work at the API level there, however. If none of the controls needs to do special mouse processing just hook the same event to all OnMouse* events of interest.
The Sender parameter will tell you which control fired the handler.
Start with the example below:  | |  | | unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
private
procedure MyMouseEvent(var Msg: TMsg; var Handled: Boolean);
public
end;
var
Form1: TForm1;
implementation
procedure TForm1.MyMouseEvent(var Msg: TMsg; var Handled: Boolean);
var
s : string;
begin
case Msg.message of
wm_LButtonDown: s := 'left mouse down';
wm_LButtonUp: s := 'left mouse up';
wm_MouseMove: s := 'mouse move';
else s := '';
end;
if s <> '' then
ListBox1.Items.Insert(0, s);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := MyMouseEvent;
end;
end. | |  | |  | You don't like the formatting? Check out SourceCoder then!
|
| Most recent comments
2010-03-20 23:14:51:
by anonymous
in Dating Scams
on Is this Russian girl scamming me? How to recognize scammers:
Ref; Olga Malinkina posted earlier..THANK YOU to whomever posted the links....It is obvious that Olga was using Lera Pashkeeva photo's to try and scam me for money to come visit me in the USA with int ... read more
|
2010-03-20 23:08:34:
by Moon Queen
in Male Dating Scammers
on Dating scammer Romeo Siba Philips:
I know for sure he is a scammer. He took $40k from me and when I did not want to send him any more money he became arrogant, smug, nasty, and went on to another victim. He had claimed to be in Texas w ... read more
|
2010-03-20 22:54:22:
by anonymous
in Dating Scams
on Dating scammer Roselin Jemba jembarose@yahoo.com from Monrovia, Senegal:
que tal amigos, tambien resivi un mensaje similar o igual a los que estan publicados es una verdadera estafa y perdida de tiempo no crean en lo que les dicen estoy muy mortificado por lo que pasa en l ... read more
|
2010-03-20 22:48:40:
by anonymous
in Dating Scams
on Dating scammer Rose Sedu Mubarka:
It's a group of them lary hughes, Sam percy, Cole Johnson, Fidel Imoro, Yaya Kharim, Kojo Freeborn, Enejaro, they are not older than 21. They work for the adults who protect them, but they hardly get ... read more
|
2010-03-20 22:33:10:
by anonymous
in Dating Scams
on Dating scammer Sarah Sarpong:
dear men
hello,i spoke to sarah i did.she found a man already she did so leave her alone she has a new man in her life she does,she is has a new man she loves him very much.so get your mind off of ... read more
|
2010-03-20 21:07:39:
by DOC
in Dating Scams
on Dating scammer Olga:
Tanya (tanya.musician@gmail.com)
Teddy Bear.jpg
|
|
2010-03-20 20:45:00:
by Dirk
in Dating Scams
on Dating scammer Natalya from Osinniki, Russia:
[quote]Valeria
valeriamilka
KhersoUkraine[ /quote]
[r>[quote]If you’re thinking that I’m looking just for a man who could realize my needs, you’re wrong.[/quote]
|
2010-03-20 19:18:45:
by anonymous
in Dating Scams
on Dating scammer Alevtina:
i found the same mail of olga vatrushka , with the same storys as here so its 100% scam
|
2010-03-20 18:56:17:
by [hidden]
in Dating Scams
on Dating scammer Tatyana (photos: Raven Riley):
i have been chating with a person calling herself salima sadik with many of the same pics and more of raven riley. she is good at what she does , also has so called uncle hafiz sadik , and a gran mom ... read more
|
2010-03-20 18:32:27:
by anonymous
in Other Scams
on Dating scammer Rose Kimberly in Africa:
I got this too, I knew it was a scam right away for someone who suposedly started off in the UK her english and grammar was a bit dodgey., its a script designed to make you like her very quickly (that ... read more
|
|