473,511 Members | 16,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clearing a field with sendmessage

2 New Member
I am working on automating a program whose source I don't have. I have everything working except I am struggling with sending a message to two fields. I am able to send the characters using a cmdlet created by Dr. McCaffrey, which uses sendmessage.
The problem is that this appends the characters to the end of the field. I want to make another cmdlet that clears the field first so that I may then append the characters to it but I canot figure out how to do that with sendmesage and I was unable to find anything about that in the user32 library.

Thanks for the help all.
Jan 13 '08 #1
2 1674
answers4forums
2 New Member
Hi Gerdescm,

I dont know which platform ur using.

in linux and other RTOS :- we can use message-ques for sending and receiving the messages.

ur problem: see have a buffer( file for storing the messages), before writing into buffer make sure u ask the question whether :
1. to append to the existing file,
2. to clear the earlier contents.

!!Sorry!! if i have not given the solution.

Regards,
Answers.
Jan 16 '08 #2
gerdescm
2 New Member
Hey, thanks for the response. I am running on windows XP, so that does not supply the answer sadly. to give a bit more detail on how it is working, the cmdlet is using the user32.dll library which has a sendmessage function contained within. The sendmessage function can do many things when interfacing with a window control (it can click buttons append to fields etc) but I cannot find documentation on how to select what it is to do or what capabilities it has. I believe (judging by the code) that the WM_CHAR = 0x0102 is what specifies that it should be appending characters to the field. Unfortunately I have not been able to find information on what I would need to specify to have it either clear the field or simply replace the contents of the field with what I specify. I have included the code of the cmdlet that appends characters below. Thanks again for your help!


Expand|Select|Wrap|Line Numbers
  1. [Cmdlet(VerbsCommunications.Send, "Chars")]
  2.     public class SendCharsCommand : Cmdlet
  3.     {
  4.         private IntPtr handleControl;
  5.         private string s;
  6.  
  7.         [Parameter(Position = 0)]
  8.         public IntPtr HandleControl {
  9.             get { return handleControl; }
  10.             set { handleControl = value; }
  11.         }
  12.  
  13.         [Parameter(Position = 1)]
  14.         public string S {
  15.             get { return s; }
  16.             set { s = value; }
  17.         }
  18.  
  19.         [DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = CharSet.Auto)]
  20.         private static extern void SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
  21.  
  22.         protected override void ProcessRecord() {
  23.             uint WM_CHAR = 0x0102;
  24.             foreach (char c in s) {
  25.                 SendMessage(handleControl, WM_CHAR, c, 0);
  26.             }
  27.         }
  28.     } // class SendCharsCommand
  29.  
Hi Gerdescm,

I dont know which platform ur using.

in linux and other RTOS :- we can use message-ques for sending and receiving the messages.

ur problem: see have a buffer( file for storing the messages), before writing into buffer make sure u ask the question whether :
1. to append to the existing file,
2. to clear the earlier contents.

!!Sorry!! if i have not given the solution.

Regards,
Answers.
Jan 17 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2872
by: Robin | last post by:
Ok, I have a form that on clicking of the Update button first updates the specific record in the db, then Inserts if the vMemo field is not empty. The problem that I'm having is that After...
1
4226
by: hortoristic | last post by:
We are using JavaScript to Enable/Disable certain fields on web pages based on business rules. A simple example is if when using an option type tag, and the two options are Yes and No. If YES...
3
10143
by: JSK | last post by:
Hi, As any one worked in VB.NET and made use of Sendmessage API? The Issue I am running into is how to pass pointers of Data Structures (UDT) to the SendMessage. I starting looking at "IntPrt"...
18
6535
by: Lars Netzel | last post by:
Hello! Thanx to this newgroup I have finally, with the help of you guys, gotten this to work halfway.. but the final action is still not working, clicking the "Button2" thru SendMessage(). ...
4
4467
by: Roger Aikin | last post by:
I've converted a VB6 project to VB.Net 2005. (Actually using vstudio pro 2005). I'm on a machine that also has VB6 and Vstudio.net 2003 on it. The project uses Word, Excel, MapPoint and SqlClient...
1
4245
by: scprosportsman | last post by:
Please help guys, i am trying to set up a database here at work and im fairly new to access in terms of writing functions and queries and stuff. I have 2 different places on my design that will...
22
9188
by: SQACSharp | last post by:
I'm trying to get the control name of an editbox in another window. The following code set the value "MyPassword" in the password EditBox but it fail to return the control name of the EditBox. ...
1
13383
by: Necromis | last post by:
Ok, I have gotten my head around things better regarding SendMessage and FindWindow functions. However, I am running into an issue with my code still. The program I am working with is EXTRA! by...
5
5216
by: michelqa | last post by:
Hi, I need to call a lot of different native SendMessage to retreive informations from non managed application. Some win32 messages use struct pointer for lparam....how to create and...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.