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 use PostMessage to post a string instead of an integer 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
18-Sep-03
Category
Win API
Language
Delphi 2.x
Views
136
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler 

How to use PostMessage to post a string instead of an integer 

Answer:

1   unit Unit1;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7     Dialogs, StdCtrls;
8   
9   type
10    TForm1 = class(TForm)
11      Button1: TButton;
12      procedure Button1Click(Sender: TObject);
13    private
14      procedure wmUser(var Msg: TMessage); message WM_USER;
15    public
16    end;
17  
18  var
19    Form1: TForm1;
20  
21  implementation
22  
23  {$R *.dfm}
24  
25  procedure TForm1.Button1Click(Sender: TObject);
26  var
27    lP: LPARAM;
28  begin
29    lP := 0; {VERY important}
30    string(lP) := Caption + ' Whatever';
31    PostMessage(Handle, WM_USER, 0, lP);
32  end;
33  
34  procedure TForm1.wmUser(var Msg: TMessage);
35  begin
36    Caption := string(Msg.LParam);
37    string(Msg.LParam) := ''; {VERY important}
38  end;
39  
40  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