Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 04 SEP 2008 10:10:08AM Sandra D'Angelo wrote:

I am trying to use WM_GETTEXT to get the text from an open explorer webform. However, I keep getting a non-numeric error when the text len id more than 10. The WM_GETTEXTLENGTH is returning the correct length. I use that value to create a 0 filled variable called txt. The syntax looks correct from what I can gather from MSDN:

txtlen=SendMessage(hndle,WM_GETTEXTLENGTH$,0,0)
txt=str(0,txtlen)
rv=SendMessage(hndle,WM_GETTEXT$,txtlen+1,txt)

But if the txtlen is too long I get a non-numeric error message. Also, I never get any text back regardless of length (I tested on a notepad edit box control also). I know the handle is correct since I verified it with WindowSpy and the length from the WM_GETTEXTLENGTH call is correct. So what am I doing wrong? Is there a better way to do this? The objective is to get the data entered on a Web form prior to the user clicking submit. We are trying to prevent double entry into the state required web system and our system. Thanks!!! Sandra


At 04 SEP 2008 11:53AM [url=http://www.srpcs.com]SRP[/url]'s Kevin Fournier wrote:

Sandra,

Try this:

TxtLen=SendMessage(hndle, WM_GETTEXTLENGTH$[/color], [/color]0[/color], [/color]0[/color]) 
Txt=Str([/color]\00\[/color], TxtLen) 
rv=SendMessage(hndle, [/color]WM_GETTEXT$[/color], TxtLen + [/color]1[/color], GetPointer(Txt))[/color][/color][/size]         
               

The non-numeric error occurs because SendMessage is expecting pointers to strings, and OI doesn't know to do this automatically.

kfournier@srpcs.com

SRP Computer Solutions, Inc.


At 04 SEP 2008 11:56AM [url=http://www.srpcs.com]SRP[/url]'s Kevin Fournier wrote:

Sandra,

As I look at this, I would make another minor correction. Make sure you set the text length to the exact same size as what you're sending the WM_GETTEXT call. So, if you are sending TxtLen + 1 to the message, you should init the string to the same size, like so:

TxtLen=SendMessage(hndle, WM_GETTEXTLENGTH$[/color], [/color]0[/color], [/color]0[/color]) 
Txt=Str([/color]\00\[/color], TxtLen + [/color]1[/color]) 
rv=SendMessage(hndle, [/color]WM_GETTEXT$[/color], TxtLen + [/color]1[/color], GetPointer(Txt))[/color][/color][/size]         
               

kfournier@srpcs.com

SRP Computer Solutions, Inc.


At 04 SEP 2008 12:00PM [url=http://www.srpcs.com]SRP[/url]'s Kevin Fournier wrote:

Okay,

Last time, I swear. Since you're making room for an extra character, it's likely you'll have null values at the end. So, this block of code is the best way to get the text and strip any null chars:

TxtLen=SendMessage(hndle, WM_GETTEXTLENGTH$[/color], [/color]0[/color], [/color]0[/color]) 
Txt=Str([/color]\00\[/color], TxtLen + [/color]1[/color]) 
rv=SendMessage(hndle, [/color]WM_GETTEXT$[/color], TxtLen + [/color]1[/color], GetPointer(Txt)) 
Txt=Txt[/color]1[/color], [/color]\00\[/color][/color][/color][/size]         
               

kfournier@srpcs.com

SRP Computer Solutions, Inc.


At 04 SEP 2008 01:43PM Sandra D'Angelo wrote:

Thanks!!! That fixed my WM_GETTEXT$ problem. However, it now seems that WM_GETTEXT$ is probably not the right message since I am not getting anything back on IE. The class for the web page frame is Internet Explorer_Server but the handle for that control does not bring anything back. I suspect because its in a frame or rich text. Any ideas of what message would work or is this not possible? Heck I would even be happy with a cut and paste option. Thanks.

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/358b634d38f6158a852574ba004dd55c.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1