Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to respond to Windows Messages Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
07-Jul-03
Category
Win API
Language
Delphi 3.x
Views
105
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Manuel Sarmiento 

It shows how to act on response to windows messages. Further information can be 
foun in the Online Help seeking  "message handling" 

Answer:

It is as easy as writing a method that complies with 

Getting a TMessage Parameter or a specific Message Parameter (such as TWMMouse that 
makes it easier to get the message's parameters) 
Putting the reserved word message followed by the windows message to which you want 
to react (such as WM_MOUSEMOVE) 

Then write your method and VOILA! 

Here is the code: 

1   unit messageUnit;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
7   
8   type
9     TForm1 = class(TForm)
10    private
11      procedure CatchMouseMove(var winMessage: TWMMouse); message wm_mousemove;
12      { Private declarations }
13    public
14      { Public declarations }
15    end;
16  
17  var
18    Form1: TForm1;
19  
20  implementation
21  
22  procedure TForm1.CatchMouseMove(var winMessage: TWMMouse);
23  {*
24  WM_MOUSEMOVE
25  fwKeys = wParam;        // key flags
26  xPos = LOWORD(lParam);  // horizontal position of cursor
27  yPos = HIWORD(lParam);  // vertical position of cursor
28  *}
29  
30  begin
31    self.Color := TColor(winmessage.XPos)
32  end;
33  
34  {$R *.DFM}
35  
36  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC