forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Windows API - Using the @sendmsg Command

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Tue Nov 04, 2003 10:46 pm    Post subject: Windows API - Using the @sendmsg Command Reply with quote

Hello again everyone,

I am attempting to utilize the @sendmsg command to gather the text from a edit box within a separate application.



Code:

title TEST
DIALOG CREATE,TEST,-1,0,213,84
DIALOG ADD,BUTTON,BUTTON1,36,64,,,,DEFAULT
DIALOG SHOW
:evloop
wait event
goto @event()
:BUTTON1BUTTON
%A = @sendmsg(WHAT DO I PUT HERE FOR THE APP?(~EDIT),$07,0,0)
info %A
goto evloop
:CLOSE
exit

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Nov 05, 2003 9:28 pm    Post subject: Reply with quote

Moved to Advanced VDS 5 Help.

You would be better off I think using the @WINTEXT() function to obatin
text from another window. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Nov 06, 2003 6:08 am    Post subject: Reply with quote

Woody wrote:
%A = @sendmsg(WHAT DO I PUT HERE FOR THE APP?(~EDIT),$07,0,0)


You need to find out the class name of the edit control
If it is something unique then you can use it e.g:

Code:
%A = @sendmsg(@WINEXISTS(#EDITBX),$07,0,0)


Note that the class names are prefixed by #
If that is not the case then you can use @WINATPOINT
function or use API functions to find your edit box.
You can rfer the VDS help file for more documentation.
Also you can use @WINTEXT instead of the API to get the
text from the edit box.

Also this topic discusses at lenght how to find
a window (Your Edit box - infact almost everything is a window)

http://forum.vdsworld.com/viewtopic.php?t=2108

You can post more details as to what U are doing so that more
users may be able to help you.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Thu Nov 06, 2003 9:54 am    Post subject: Reply with quote

A good starting point would be to use Window Spy to look at the target application. This might reveal useful information about the edit box.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Woody
Valued Newbie


Joined: 10 Jul 2003
Posts: 29

PostPosted: Thu Nov 06, 2003 4:58 pm    Post subject: Reply with quote

Hello again Smile

I do have the class name of the edit box I am attempting to gather the data from. However I recieve the error "Invalid Parameter to command"

%A = @sendmsg(@WINEXISTS(#RichEdit20A),$07,0,0)

Now this #RichEdit20A edit box is 5 Windows deep. I am attempting this on XP if that has anything to do with it.

Thanks,

_________________
- Woody
Back to top
View user's profile Send private message AIM Address
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Nov 06, 2003 6:06 pm    Post subject: Reply with quote

Hi Woody

Before sending a message you make sure that
INFO @WINEXISTS(#RichEdit20A)!
is returing a valid window identifier.
I am sure it returns null because #RichEdit20A is not a unique class name but one shared by many
richedit controls.

So you need to use alternative ways to reach at our richedit box.
If it's a fullscreen app you can use @winatpoint() and specify
the expected coordinates of the window.

Else you have a few options:

Loop through all the child windows of your app and llok for the one
that has the class name of interest using @WINCLASS()

If your #RichEdit20A is single and has a immediate parent who has a unique window title
then you can use GetWindow API to get the window ID - This is more effcient and fast.

OR VDS Function @WINEXISTS(<window>,<child window>)
(not sure if the <child window> part works well)


Also @wintext is sufficient once you have got the ID IMO.
Below is a small script that grabs the window under your cursor and shows its text.
Just click the button and move Ur mouse over the richedit box (within 3 sec) and have a look.

Code:
#-----------------------------------------------------------------------------#
#                                                                             #
# Discalimer - Use at your own risk                                           #
#                                                                             #
# Author:  CodeScript                                                         #
#                                                                             #
# Copyright: © 2003 CodeScript Software                                       #
#                                                                             #
#-----------------------------------------------------------------------------#
  DIALOG CREATE,New Dialog,-1,0,240,160
  DIALOG ADD,BUTTON,BUTTON1,130,92,64,24,BUTTON1
  DIALOG SHOW


:EVLOOP
WAIT EVENT
GOTO @EVENT()
 
:BUTTON1BUTTON
WAIT 3
%%hwnd = @WINATPOINT(@MOUSEPOS(X),@MOUSEPOS(Y))
INFO @WINTEXT(%%hwnd)
GOTO EVLOOP

:CLOSE
EXIT

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group