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 


Help on sending keystrokes to browser element
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Wed Mar 16, 2005 2:16 am    Post subject: Reply with quote

Here's the context menu command ids for IE and the VDS browser object:

Code:

"2282  -> Back
"2283  -> Foreward
"2263  -> Save Background As...
"2264  -> Set As Background
"2265  -> Copy Background
"2278  -> Set As Desktop Item
"31    -> Select All
"26    -> Paste
"2266  -> Create Shortcut
"2261  -> Add to Favorites...
"2139  -> View Source
"27    -> Print
"6042  -> Refresh
"28    -> Properties


I'm still working on checking out sending other key strokes to IE and the
browser element as well as checking into doing the same for Adobe Acrobat.

All of the above command ids need to be sent with the @sendmsg() function, with the message being WM_COMMAND (273) and the WPARAM
of the message set to one of the above id numbers. Smile

Code:

IE: %z = sendmsg(%%ieServ, 273, 28, 0)

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."


Last edited by ShinobiSoft on Wed Mar 16, 2005 4:22 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Wed Mar 16, 2005 3:54 pm    Post subject: Reply with quote

Thanks for checking this out, Bill. If I have time today, perhaps I will study the @window() family of commands (never have used them much) and try to figure a way to cycle through each window and child window until I find the browser ...

Joe

_________________
Joe Floyd
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Wed Mar 16, 2005 4:26 pm    Post subject: Reply with quote

I'm glad I could help Joe Wink. I checked into doing something similar with
the Adobe Acrobat reader and man does it have some child windows! Trying
to enumerate all those child windows is gonna be a task.

BTW, in an earlier post in this thread you mentioned something about an
edit that said "1 of 2", that is the page being displayed. Meaing that you were
viewing page "1" of "2" pages. Smile

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Wed Mar 16, 2005 4:57 pm    Post subject: Reply with quote

Yes, Acrobat Reader has lots of child windows, and child-child and children of children...

I knew what the "1 of 2" was, I just want to see if there is a reliable way for me to read that information. (If the user clicks a button on my app, I can see what page they are viewing, and do something with it.)

Thanks -

I'll let you know if I make progress.

Joe

_________________
Joe Floyd
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Wed Mar 16, 2005 5:00 pm    Post subject: Reply with quote

Does anyone know how "Window Spy" gets all the windows and child windows in a list? If my program could recreate that list, then I can sequentially send a certain key combination to each one until I found which one I needed.

Jules - were you involved with the development of that?

_________________
Joe Floyd
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


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

PostPosted: Wed Mar 16, 2005 6:15 pm    Post subject: Reply with quote

Yes I was. I don't know if this will help. It's hacked from the window spy code, but I haven't tested it as such.

Code:
:winlist
  if %V
    list create,1
    %L = 0
    gosub additem
    gosub breaksub
    list close,1
  end
  exit
:breaksub
  list add,1,%V
  %L = @succ(%L)
  %V = @window(%V,CHILD)
  repeat
    if %V
      gosub additem
      gosub breaksub
      %V = @window(%V,NEXT)
    end
  until @null(%V)
  %L = @pred(%L)
  list seek,1,@pred(@count(1))
  %V = @item(1)
  list delete,1
  exit
:additem
  %9 =
  %8 = @wintext(%V)
  %9 = %9%V@tab()#@winclass(%V)
  list add,%%list,%9
  exit


You gosub winlist with %V set to the handle of the window you want, and it creates the window list in %%list.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Wed Mar 16, 2005 7:22 pm    Post subject: Reply with quote

Thanks Jules -

I tried the code (the only thing I had to do was put "1" in place of the %%list variable in :AddItem.)

I got an error saying that the code was nested too deep. Apparently it doesn't like it when the :Breaksub code says to "gosub Breaksub". Is that allowed in VDS 5 - for a piece of code to "gosub" to itself?

_________________
Joe Floyd
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Wed Mar 16, 2005 8:48 pm    Post subject: Reply with quote

I am having some luck.

I found that I can send keystrokes to a window with the class #AVL_AVVIEW and the window text "AVPageView".

This window seems to be nested several child levels deep and I have no idea how to get the window handle reliably, but I will work on it.

_________________
Joe Floyd
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


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

PostPosted: Thu Mar 17, 2005 9:34 am    Post subject: Reply with quote

That code has worked since VDS 1, or whenever the Window Spy was written. The only problem with recursively gosubbing is that each call will use the same variables, and you have to stop recursing before you hit the limit. If an application's window structure is so deeply nested that you hit the limit then the Window Spy will probably have the same trouble.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Thu Mar 17, 2005 1:05 pm    Post subject: Reply with quote

Jules -

I tried again and got the code working well. It does exactly what I need - returns a list of all windows, including child-child-child windows, for my app. Thanks! (The problem I had before was related to the %%list variable.)

I think with this code, I will be able to find the correct window (with text "AVPageView") and send all my keystrokes to it.

Thanks again!

_________________
Joe Floyd
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Fri Mar 18, 2005 4:02 pm    Post subject: Reply with quote

Here is an update:

I was able to use the code from Jules to reliably get the correct windows identifier that I needed to send the keystrokes to. When the PDF viewer has focus, it works perfectly.

I have run into a strange problem, however. If any other dialog element has focus (a list or button), then it seems to intercept the keys I am sending to the PDF viewer.

For instance, I have a button that sends a @key(Left) to the PDF viewer, which causes it to go back one page. If the viewer has focus, then it works great. But if a list on my dialog has focus, the list moves up one item, intercepting the @key(left). Even though I am using WINDOW SEND to send it to the window identifier of the Acrobat Viewer. And I can't set the focus to the browser window either - maybe due to the same problem that won't let it be a TAB stop...?

Strange.

_________________
Joe Floyd
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


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

PostPosted: Fri Mar 18, 2005 4:10 pm    Post subject: Reply with quote

WINDOW SEND generates keystrokes. Keystrokes always go to the control that has focus. It hooks into the same mechanism used when you type on the keyboard, The help file isn't specific enough, but I think that the second parameter of the WINDOW command is meant to be an application main window. All it does is bring that window to the foreground so that it, and not some other app, will receive the keystrokes, but it doesn't determine which control within the window has the focus.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Fri Mar 18, 2005 4:37 pm    Post subject: Reply with quote

I see. And it doesn't seem that I am able to set the focus to the browser element. (I just tested using a DIALOG FOCUS, BROWSER1 and then @FOCUS() still showed "List1".)

Jules - you mentioned in an earlier thread that the browser element was compiled with the Tab property set to false. Is that related to this? Is that something that could be changed in VDS6? I'm thinking that using the browser element opens up some very nice possibilities for VDS, but it sure would be handy to be able to set focus to it and easily send it keystrokes.

_________________
Joe Floyd
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


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

PostPosted: Fri Mar 18, 2005 5:47 pm    Post subject: Reply with quote

Yes, this may have something to do with it. There is ambiguity in the use of the tab key. With the EDIT element you have to add a TAB style if you want to be able to insert tabs in the text, instead of using it to go to the next element that can have focus. With the BROWSER element the tab key always takes you to the next element. I presume that this could easily be changed for VDS 6, and a TAB style added. In the meantime, didn't I read here that someone else has produced a browser element DLL that doesn't have this problem?
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri Mar 18, 2005 10:18 pm    Post subject: Reply with quote

Well my VDSSURFX has the same issue. And I tried with a component to enable the TAB and other keys that dont work in the browser element.

Altho the component I used is suppose to work, I never managed to make the TAB enabled..
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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