473,322 Members | 1,287 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,322 software developers and data experts.

Problem using Win api SendMessage to FindText

I am trying to find text in a window. I can get the handle to th
window but when I try using SendMessage the return value is very larg
number. When I use Spy++ to see the return value it is FFFFFFFF.
don't think SendMessage is working correctly to find the text. Ca
somebody help me out here with the parameters that need to be passe
and if I am passing them correctly

How do i specify the pointer to string member in the FindTex
structure in C#

My code is as follows
public long FindTextW(

RichEdit.FindText tEx

sText = "John\0"
IntPtr lstrPtr = Marshal.StringToCoTaskMemAuto(sText);
//tEx is the FINDTEXT structur
tEx.lpstrText =lstrPtr
tEx.chrg = tCR
tEx.chrg.cpMax = -1
tEx.chrg.cpMin = 0
IntPtr lPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(tEx))
Marshal.StructureToPtr(tEx, lPtr, true)
lR = RichEdit.SendMessage((IntPtr)m_hWnd,RichEdit.EM_FI NDTEXT,0,lPtr)
return lR
The value I get for lR is 9222812406911074303 which doesn't see
right!

Any help will be really appreciated
Thanks
jbha

Nov 15 '05 #1
0 1278

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

Similar topics

9
by: none | last post by:
Hello all, I wrote a shell program a few years ago in VB6 that needs to be modified. The problem I have is this: The SysAdmin uses this shell in place of Explorer, so there is no taskbar. When...
2
by: ThunderMusic | last post by:
Hi, while I'm searching into a treeview to find a specific node, I find the code duplicating treeview nodes I just can't figure out what's causing this behavior, maybe some of you already...
5
by: Mark Overstreet | last post by:
I am trying to click a button in another window and I have it's hWnd value so I was trying to use Send message. Here is my code but it doesn't work as expected... response =...
4
by: jbhan | last post by:
Hi, I am trying to find text in a window. I can get the handle to the window but when I try using SendMessage the return value is very large number. When I use Spy++ to see the return value it...
3
by: Rob | last post by:
Hi all, I am having trouble converting the code below (found on http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a format that will work using vb .NET. Can anyone have a look...
5
by: Atara | last post by:
I am trying to convert the following code to VB .Net, I still have some gaps (the lines that are marked with (*)) and also I need an ending condition for the while loop. any help would be...
1
by: Frederik Vanderhaegen | last post by:
Hi, I'm trying change the layout of a combobox when f.e. a certain property is set to true. My problem is the following: when I execute the code, the combobox is repainted but there always...
16
by: Abubakar | last post by:
Hi all, My solution consists of 2 projects, 1 is a dll (contains sockets functionality, multithreaded), and the other is a wtl gui project. Both are totally unmanaged. The gui app has a edit...
5
by: Trevor2007 | last post by:
Hi I am trying to disable the replace tab on the find diaog in access 03, I have searched the net and found findtext.dlg but have tried searhing both my HD and the ms Office folder for the file with...
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: 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: 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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.