Jump to content
Sign in to follow this  
CountyIT

Sendmessage() $wParam and $lParam

Recommended Posts

CountyIT

I have been reading and am a tad confused. When using Sendmessage am I free to make $wParam and $lParam whetever I want?

Ideally I would like $wParam to be an Integer (my code for something) and $lParam to be a string. The one that is scaring me a little is $lParam being a string, of say 100 characters. Am I going to run in to problems with this?

Share this post


Link to post
Share on other sites
PhoenixXL

Why not try and see if there is some problems ;)


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
CountyIT

Because I might not have problems but that doesn't mean they don't exist. Hence the question :)

Share this post


Link to post
Share on other sites
FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
CountyIT

Interesting link. I think I read that one at least twice before posting the question. I didn't find any specfics about the $wParam or the $lParam in that link.

Share this post


Link to post
Share on other sites
BrewManNH

The parameters wParam and iParam are Windows message specific, they're determined by what the msg you're sending is. Are you using this with a "private" message to an application you're creating, or are you sending a Windows message to one? Also, what kind of problems are you asking about in your first post?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
MDCT

what kind of problems are you asking about in your first post?

I think the op wants to know the character limit that can be sent with $lParam. And maybe what kind of problem it can cause if many characters are being sent.

Share this post


Link to post
Share on other sites
BrewManNH

That's what I was thinking too, but the OP never specified what he/she was anticipating might happen.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
kylomas

CountyIT,

I have been reading and am a tad confused. When using Sendmessage am I free to make $wParam and $lParam whetever I want

I think you might have a misconception about what _sendmessage is/does. What are you trying to do?

Specific to your questions:

1 - "When using Sendmessage am I free to make $wParam and $lParam whetever I want?"

Depends, answer BrewmanNH's questions

2 - " Ideally I would like $wParam to be an Integer (my code for something) and $lParam to be a string.

The one that is scaring me a little is $lParam being a string, of say 100 characters.

Am I going to run in to problems with this?"

This can be done with a user defined message. I believe the string limit i 65536 (don't remember exactly). However, I'm not

sure why you would want to pass data around like this.

kylomas

edit: holy crap, I suck with this editor

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
CountyIT

I really simply wanted to pass a string like "Hello World" from one program I have written to another program I have written but it doesn't appear that this is the way to do it. Just playing I set $WParam to 10 and $lParam to "Hello World" and did a sendmessage() to the other program. The $wParam transfered correctly but the $lParam did not. It came in as a hex number not a string so I am assuming $lParam cannot be a string. It has to be a number?????

Share this post


Link to post
Share on other sites
kylomas

No, you can pass a string, as I said in my previous post.


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
kylomas

CountyIT,

The following is an example of how to pass a string using a user defined message.

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <SendMessage.au3>

local $my_msg = $wm_user+1

local $gui010 = guicreate('',900,150)
local $aSize = wingetclientsize($gui010)
local $lbl010 = guictrlcreatelabel('',10,20,$aSize[0]-20,50,$ss_sunken)
guictrlsetfont(-1,12,600,default,'courier new')
local $btn010 = guictrlcreatebutton('Send Message',10,$aSize[1]-40,$aSize[0]-20,30,$ss_sunken)
guisetstate()

GUIRegisterMsg($my_msg,"_user01")

while 1
switch guigetmsg()
case $gui_event_close
Exit
case $btn010
_sendmessage($gui010,$my_msg,200,'This is a message sent by actioning my user defined message',0,'wparam','str')
EndSwitch
WEnd

func _user01($hWnd, $uMsg, $wParam, $lParam)

$mystr = dllstructcreate('char mystring[128]', $lparam)
guictrlsetdata($lbl010,' LPARAM = ' & dllstructgetdata($mystr,1) & @crlf & ' WPARAM = ' & int($wparam))

endfunc

thread has an example of actioning a control in another thread using a user defined message.

edit: I'm not sure that you can pass a string because I do not know how to get addressability to the structure used to store the lparam data. Perhaps one of the heavy hitters knows....

edit2: there are a bunch of threads on inter process communications

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×