TIP: Click on subject to list as thread! ANSI
echo: osdebate
to: Gary Britt
from: Gregg N
date: 2004-05-09 14:55:42
subject: Re: Need Help With PostMessage WinAPI

From: Gregg N 

"Gary Britt"  wrote in
news:409e7ace$1{at}w3.nls.net:

> For the example below, the Window Handle is W. N is the command and
> will be as follows:
>     N := wm_user+20 (for nickname)
>     N := wm_user+21 (for playable macro name)
>     S = the nickname or the playable macro name
>
> C++ Code:
> for (int i=0, i     postmessage(W, N, S[i], 0);
> postmessage(W, N, 0, 0);
>
> The code example in the help is for C or C++. This delphi code should
> also work:
>
> Delphi Code:
> for i := 0 to length(S) do
>     PostMessage (W, N, S[i], 0);
> PostMessage (W, N, 0, 0);
>
> The program I'm going to use  to send a message uses the following
> command syntax:
>
> SendMessage(hWnd,msgValue,wParam, dwParam)
>      [    Sends message to window.   Returns same values as Win3.x API
>      function.]
>
> I can't decipher the Macro Express syntax to figure out what to put in
> the SendMessage command.  I know how to find the window handle for
> hWnd, but can't seem to figure out the correct variable for msgValue.
> Not sure what the [i] in S[i] above is to do.  Is msgValue supposed to
> be exactly the string "WM_USER+20" or it supposed to be some other
> string value or numerical value?
>
> Thanks for any suggestions.

S[i] means the i'th character in the string S. The for loop is sending a
seaprate message for each character in the nickname, followed by sending a
zero to terminate the string.

The msgValue is not a string, it is an integer constant. You have to look
up what the value of WM_USER is. My documentation says it is 0x400, or 1024
in decimal. You then add 20 or 21 to this and pass this integer as
msgValue.

Gregg

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270
@PATH: 379/45 1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.