By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,460 Members | 1,508 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,460 IT Pros & Developers. It's quick & easy.

Problem using Win api SendMessage to FindText

P: n/a
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

Any help will be really appreciated

Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.