View Full Version : Girder not sending keystrokes to child window
lesterjacobs
March 2nd, 2003, 03:49 PM
Hi,
I'm working on an mp3 player I'm writing using VB6. Since this player is designed for a living room PC (Home Theatre PC) I aiming to make it completely comtrollable by girder. Thus the program has a keyboard shortcut for every command which makes it easy to create a girder gml for it.
However the problem is this; whenever a command pops up a child dialog, girder seems unable to send keystrokes to the dialog. Strangely, if I use the keyboard to issue the command to invoke the dialog, girder can send keystrokes to the dialog just fine. It's only when girder itself issues the keystroke that causes the dialog to pop up that it seems unable to send keystrokes to the dialog.
Since I have the source to this program. I 'm able to modify it to make it compatible with the way girder sends keystrokes. All the code does is invoke a modal child window using VB's Show method.
What do you think is the problem? Any clues on how to modify the code to bypass this issue?
Thanks
Lester
lesterjacobs
March 2nd, 2003, 05:38 PM
Hi,
Just adding a bit more information that I've discovered while trying to debug this myself.
It seems that Girder appears to send all keystrokes after the dialog has appeared to the parent form instead of the dialog. What I see is that while the dialog is up, Girder appears not to be sending keystrokes. However if I close the dialog by using my actual keyboard, the Keypress Handler for the parent form suddenly sees all the keystrokes that Girder was trying to send.
Could this be a clue as to what's going on?
Thanks
Lester
Ron
March 2nd, 2003, 06:04 PM
what window are you targetting ? Give detailed info about target set by you and actually modal window class and name.
lesterjacobs
March 3rd, 2003, 03:11 AM
The modal window I'm targetting is
Name: Form1
Window Class: ThunderRT6FormDC
The parent window is:
Name: DigiCasa EZ Player
Window Class: ThunderRT6Main
I've tried targetting the modal window in a number of ways.
1) Just targetting the .exe with "Only send to first match" checked
2) Targetting the name, class name, and exe of the modal window with "Only send to first match" checked
3) Method (1) with "Only send to first match" unchecked.
Method (1) exhibits the problem I reported in my first post.
Method (2) won't work very well for me since both the parent form and the dialog need to reuse the same keystrokes and therefore I can't target the modal form only. However the modal form does receive the keystroke when targetted directly.
Using method (3) and just targetting the exe the modal dialog does actually receive the keystroke. Problem is, the parent form also receives the keystroke as well. Thus the code in both of them act on the keystroke, which is non optimal.
ASIDE: Actually this behaviour is strange since according to VB6 documentation the parent form shouldnot respond to any events until the modal dialog is closed. Thus even if Girder sends keystrokes to both forms, the main form should just ignore it.
Let me know if this helps.
Lester Jacobs
Ron
March 3rd, 2003, 07:56 AM
There should be an edit box or something on the modal form. You'll need to enter that as the child window if you want girder to type into there.
So use the modal window class and name. the main windows exe name and the child window ( edit box ) name and class.
Note: there is no garantuee that this will work. See disclaimer in the FAQ section.
lesterjacobs
March 3rd, 2003, 08:01 AM
There should be an edit box or something on the modal form. You'll need to enter that as the child window if you want girder to type into there.
So use the modal window class and name. the main windows exe name and the child window ( edit box ) name and class.
Note: there is no garantuee that this will work. See disclaimer in the FAQ section.
Ok, thanks. I'll try this out.
Regards
Lester
lesterjacobs
March 5th, 2003, 01:02 PM
Hello All,
Well I have now solved the problem but I wanted to relate my experiences here since I believe the my solution may be an explanation for why Girder appears to be unable to send keystrokes to the child windows for some applications.
Firstly, I solved the original problem by implementing my own Windows message handler in my mp3 program. Therefore by using Girder and the SendMessage plugin I can now control every aspect of my program.
However, interestingly, I first coded my message handler to receive messages from Girder and forward them to the pertinent objects in my app using SendMessage. What I found is that I had the same problem that I was having with Girder originally; namely I could not send keystrokes via SendMessage to child dialogs. I then switched to using PostMessage and everything works great!
In hindsight it makes sense that if the Keydown routine for a form pops up a dialog as part of the event handling, then since SendMessage is synchronous, it doesn't get a reply until the dialog itself has been handled. This is consistent with Girder not being able to send keystrokes to the child dialog; it's still waiting for a return on the previous SendMessage.
Therefore my current theory is that, assuming Girder uses SendMessage instead of PostMessage, to send keystrokes, then the reason for not being able to control child dialogs sometimes may have something to do with the synchronous nature of SendMessage. Perhaps a useful plugin for someone with more C coding skills than I might be to write a PostMessage plugin for Girder as a companion to the SendMessage plugin.
Regards
Lester
Ron
March 5th, 2003, 01:11 PM
Thanks for the analysis, maybe we should adapt the sendmessage plugin to simply support postmessage, that should save a lot of time for everyone.
graemef
March 5th, 2003, 01:21 PM
I have seen a similar problem trying to send commands to a file open dialog box, never got it to work. This could explain it. Perhaps another checkbox on the sendkeys form ?
esouk
January 1st, 2004, 07:11 PM
As I am trying to get BSPlayer working with Girder as well (although in a more primitive way by simply sending keystrokes to the main app) I have encountered the same issue in this thread with the child window (namely when I try to open a new file). I was trying to get it to recognize simple Up/Down, Tab & Alt-Tab, and some other stuff but it won't get it - I've tried everything from Sunday as far as the targetting - it appears to send it fine (I've even targetted indivdual controls on the dialog box) but it doesn't take - and it seems that this is not new...
So I guess the question is, short of having to control Explorer and open my files that way, is there any hope for Girder to be able to successfully post my keystrokes to an application's child window? :)
btw, Ron, its an amazing program - I've been having a loads of fun with it!
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.