473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Help with SendMessage API calls

Hi all,

Could someone provide a link to working code examples for implementing these
Sendmessage API calls in VB.NET ??

EM_GETLINECOUNT
EM_GETLINE
EM_LINELENGTH
EM_LINEINDEX

I want to use these to get info from a multiline textbox. I can only find
VB6 examples on the net.

thanks in advance
Steve
Nov 21 '05 #1
3 2100
Hi,

The textbox has a lines property I would use that instead of sendmessage

For counter as integer = 1 to 50
textbox1.text &= "line number " & counter.tostring & controlchars.crlf
next

Dim strLines() as string = textbox1.lines

trace.writeline(string.format("Textbox lines {0}", strlines.getubound(0)))

For each sLine as string in strlines
trace.writeline(sline)
trace.writeline(string.format("Line length = {0}", sline.length))
next

Ken
--------------------
"Steve" wrote:
Hi all,

Could someone provide a link to working code examples for implementing these
Sendmessage API calls in VB.NET ??

EM_GETLINECOUNT
EM_GETLINE
EM_LINELENGTH
EM_LINEINDEX

I want to use these to get info from a multiline textbox. I can only find
VB6 examples on the net.

thanks in advance
Steve

Nov 21 '05 #2
If you can only find VB 6 examples then why don't you just convert them? It
would be very easy to do so.

Ken is right about the number of lines etc. so, that part doesn't need to be
converted.

Are you using a RichTextBox or a standard TextBox by the way? Just out of
interest.
Nov 21 '05 #3
Thankyou both,

I have now managed to convert the VB6 code with the help of a few google
searches etc. It's all working fine now. I have zero VB6 experience and only
slightly more vb.net experience, and this is my first use of API calls :P
The change from 32bit to 64bit for long ints was what caught me in the end

As for why I don't use the standard .lines property..
The lines property only splits up the text into separate strings when there
are hard CR/LF's entered by the user. I want to get an array of strings
respresenting the text as it appears in the box, with any wrapped lines
treated as separate strings.

ie if I type "hello world this is a test" and the textbox wraps it over 2
lines, the .lines property will just return a single-element array with
that one full string.
The API EM_GETLINE call returns 2 strings of "hello world" and "this is a
test" just as it appears in the box

I want it this way so I can easily dump the contents of the textbox to a
label printer as ascii

thankyou both again
Steve

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: nnb295 | last post by:
Hi, is it with the .Net-Class-library possible to send a message with the same effect like the API-Call "SendMessage" to another application window or control without Windows-API-Calls. ...
2
by: 2G | last post by:
Hi everybody I think i'm doing something wrong . :) When I install a new font, all my programs (like photoshop) that are running don't respond anymore for like 2 min, after that I can use the...
3
by: Just Me | last post by:
I declare the following and use it if the msg returns values. I also declare an SendMessage using ByVal for other calls. Isn't there a way I can used the SendMessage and in the call tell it to...
3
by: Max M. Power | last post by:
When I use the SendMessage API I can sucessfully send and receive a user defined message. When I use the PostMessage API I can NOT sucessfully send and receive the same user defined message. ...
2
by: Abubakar | last post by:
Hi, in my application, different threads send notifications to GUI thread through sendmessage api. They have special integer numbers inside the wParam arg of sendmessage which the gui thread uses...
4
by: Abubakar | last post by:
Hi, My application has a lot of threads which at some point call SendMessage api passing it the handle of the gui window. The calls r a lot. My question is that should I call the SendMessage api...
22
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. ...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
11
by: NVergunst | last post by:
Hello everyone. I have what I believe to be a simple question, yet I can not find anything that is helpful to me. Basically I have an application, that I want to use to control external...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.