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 


Get Window ID - solved
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Mon Nov 13, 2006 10:12 pm    Post subject: Get Window ID - solved Reply with quote

I need to have my program get the Window ID from a list box in a iconized application.

I can get the list box's ID using Window Spy or Win Spy... but it's a different ID each time the application is run.

I've had a look at Win Spy's source and tried many different things... without success. Sad

_________________
cheers

Dave


Last edited by DaveR on Tue Nov 14, 2006 1:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 14, 2006 12:12 am    Post subject: Reply with quote

Dave,
If the application is a VDS program and you just need the ID of it's listbox element then just use @winexist(~LIST1) you can do this with all the built in elements with the exception of the BITMAP and TEXT elements. To get the window ID of an external list box you will have to use the @window and walk the child windows of the parent that holds the child listbox element. You can also use the @winatpoint if you know the exact location on the screen that the listbox element is located.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Nov 14, 2006 12:59 am    Post subject: Reply with quote

Yep, it's an external application.

Maybe I'm having a slow day... but how exactly do I "walk the child windows of the parent"?

_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 14, 2006 1:14 am    Post subject: Reply with quote

Dave,
First get the ID of the Window that has the ListBox in question using @winexist(parent class name) or @winexist(parent Title) You can get the class name from Window Spy. Next use @window(parent ID,CHILD) after that you will need to call @window(parent ID,NEXT) for the next child and you may have to play around with moving next and prev and child until you figure out the location of the listbox. This is a similar tecnique that Window Spy uses.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Nov 14, 2006 1:21 am    Post subject: Reply with quote

Basically I need to read the text in a non-vds program's list box. The program has a class of #TfMain and the listbox has a class of #TMemo.

If I know the handle I can use that
Code:
if @winexists(#TfMain)
  %x = "%1705198"
  %%Log = @wintext(%x)
end

But this doesn't work
Code:
%%Log = @wintext(#TMemo)

Nor does a kazzillion other, more complicated things I've tried

_________________
cheers

Dave
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Nov 14, 2006 1:32 am    Post subject: Reply with quote

Thanks DS,

I'll have a play around with it.

_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 14, 2006 1:36 am    Post subject: Reply with quote

Dave,
Without seeing the exact program in question here goes nothing...

Code:

Title Find My ListBox
%%Parent = @winexist(#TfMain)
If %%Parent
  %%FirstChild = @window(%%Parent,CHILD)
  If @Equal(@winclass(%%FirstChild),#TMemo)

  Else
   Repeat
     # This may result in a endless loop if you can't find the window...
     %%NextChild = @window(%%Parent,NEXT)
   Until @Equal(@winclass(%%NextChild),#TMemo)
  End
End
Exit


This is the basic idea...

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Nov 14, 2006 2:21 am    Post subject: Reply with quote

That's pretty much what I've been trying to do.

For some reason all I can get is the program's statusbar handle (using CHILD). FIRST, LAST, NEXT and PREV repeatedly return the same handle - i.e. FIRST always returns the same handle, LAST always returnes the same handle etc. But every handle except CHILD isn't from the program in question.

It's as if the program only has 2 handles - which is contrary to what Window Spy shows.

_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 14, 2006 2:33 am    Post subject: Reply with quote

Dave,
Maybe the other controls are a child of the 1 child control? This is usually the case of Internet Explorer.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 14, 2006 2:34 am    Post subject: Reply with quote

Dave,
Hmmm let me see if I can find some old code of mine? I remember doing a similar thing for Garrett once Wink

_________________
Home of

Give VDS a new purpose!


Last edited by vdsalchemist on Tue Nov 14, 2006 2:35 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Nov 14, 2006 2:34 am    Post subject: Reply with quote

If it helps, you can download the program in question here:
http://www.8ung.at/aldarin/ftp4t.html

And what I need to do is be able to get the text in the "FTP - Server Logfile" list. You'll need to press the "Start Server" button before you'll see any text in the log list.

_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 14, 2006 2:53 am    Post subject: Reply with quote

Dave,
That helped Wink

Code:

%%Main_hwnd = @winexists(#TfMain)
%%ID = @window(%%Main_hwnd,CHILD)
INFO @WINCLASS(%%ID)@cr()
%%ID = @window(%%ID,NEXT)
INFO @WINCLASS(%%ID)@cr()
%%ID = @window(%%ID,CHILD)
INFO @WINCLASS(%%ID)@cr()
%%ID = @window(%%ID,CHILD)
INFO @WINCLASS(%%ID)@cr()
%%ID = @window(%%ID,CHILD)
INFO @WINCLASS(%%ID)@cr()
%%LogMemo = @window(%%ID,CHILD)
INFO @WINCLASS(%%LogMemo)@cr()@WinText(%%LogMemo)
Exit


However there is a way to locate this dynamicly I just don't have time now to go into it. There is both a way VIA VDS and my GadgetX DLL.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Nov 14, 2006 3:01 am    Post subject: Reply with quote

Dude, you're awsome! You managed to do in minutes something that I've been struggling with for 10 hours!

I was just looking at GadgetX and it's EnumChildWindows - and all the other things it can do.

Thanks for all your help.

_________________
cheers

Dave
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 14, 2006 3:13 am    Post subject: Reply with quote

Dave,
It took me almost a month to figure that out when I was helping Garrett with it. The VDS help file is not very clear on how to use the @window() function in relationship to the Window Spy tool. Basicly you have to follow the hierachy in the Window Spy. Each child is 1 character to the right if it is not then you use NEXT.
As far as the EnumChildWindows.dsc GadgetX demo it was made to show how to use GadgetX'es built in callback functions and really shouldn't be used for this where the names are actually known since it is slower and depends on a event loop. Those demos show how to make a more complete Window Spy tool. The VDS Window Spy tool misses windows. I don't know why other than maybe they use something other than the EnumWindows and EnumChildWindows functions?

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Nov 14, 2006 1:30 pm    Post subject: Reply with quote

Ahh, it all makes sense now. Windows Spy suddenly seems a lot more useful.
_________________
cheers

Dave
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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