Loading ...
Sorry, an error occurred while loading the content.
 

Re: Quake Console Update Unreliable

Expand Messages
  • coolrobd
    I have been looking a bit more into it and think SendMessage is even more reliable, anyone used this API function before? ... set the ... Something like ...
    Message 1 of 9 , Jul 19, 2004
      I have been looking a bit more into it and think SendMessage is even
      more reliable, anyone used this API function before?

      --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...> wrote:
      > You might try splitting your message into individual keypresses and
      set the
      > foreground window (or focus window?) before sending each key.
      Something like
      > the following if it was just regular text:
      >
      > foreach $letter (split(//, $text)) {
      > SetForegroundWindow($window);
      > SendKeys($letter);
      > }
      >
      > If your text has special characters, you'll have to be a little more
      > creative.
      >
      > Chris Hilton
      >
      > -----Original Message-----
      > From: coolrobd [mailto:coolrobd@y...]
      > Sent: Monday, 19 July, 2004 03:03
      > To: perlguitest@yahoogroups.com
      > Subject: [perlguitest] Quake Console Update Unreliable
      >
      >
      > Let me start by explaining what I am trying to achieve. Basically
      > the Quake engine has a console window that sits behind it, I
      believe
      > this to be a child window. I want to update the console with text
      > ever 2 seconds.
      >
      > Current Status - I am able to get text to the console, but it is
      not
      > reliable, sometimes all the text arrives, other time bits are
      > missing. If I click in the main window this screws it up, because
      I
      > beleive the main window takes the focus away from the console,
      > therefore the sendkeys command is sending the letters to the main
      > window.
      >
      > Solution Required - I need some way of writing text but be able to
      > specify what window to put this in.
      >
      > Any ideas will be greatly received as I am tearing me hair out and
      I
      > am sure the solution is quite simple.
      >
      > Thanks
      >
      >
      >
      > Yahoo! Groups Sponsor
      >
      > ADVERTISEMENT
      >
      >
      <http://us.ard.yahoo.com/SIG=129qihuc9/M=295196.4901138.6071305.300117
      6/D=gr
      >
      oups/S=1705006951:HM/EXP=1090327130/A=2128215/R=0/SIG=10se96mf6/*http:
      //comp
      > anion.yahoo.com> click here
      >
      > <http://us.adserver.yahoo.com/l?
      M=295196.4901138.6071305.3001176/D=groups/S=
      > :HM/A=2128215/rand=913171747>
      >
      >
      > _____
      >
      > Yahoo! Groups Links
      >
      >
      > * To visit your group on the web, go to:
      > http://groups.yahoo.com/group/perlguitest/
      > <http://groups.yahoo.com/group/perlguitest/>
      >
      >
      > * To unsubscribe from this group, send an email to:
      > perlguitest-unsubscribe@yahoogroups.com
      > <mailto:perlguitest-unsubscribe@yahoogroups.com?
      subject=Unsubscribe>
      >
      >
      > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
      Service
      > <http://docs.yahoo.com/info/terms/> .
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
    • Coleman Tom
      another option is to send the low level window s message this is kind of hacking into the operating system, it would bypass the actuall key press and what
      Message 2 of 9 , Jul 19, 2004
        another option is to send the low level window's message
        this is kind of hacking into the operating system,
        it would bypass the actuall key press and what window has focus issues.

        good luck!
        tom

        pseudo code:

        at start of program
        - get windows handle / id of where key presses ( SendKeys ) are to go

        when key sequence is to be sent
        - post message to window's handle with key to press


        -----Original Message-----
        From: Chris Hilton [mailto:chilton@...]
        Sent: Monday, July 19, 2004 9:16 AM
        To: 'perlguitest@yahoogroups.com'
        Subject: RE: [perlguitest] Quake Console Update Unreliable


        You might try splitting your message into individual keypresses and set the
        foreground window (or focus window?) before sending each key. Something like
        the following if it was just regular text:

        foreach $letter (split(//, $text)) {
        SetForegroundWindow($window);
        SendKeys($letter);
        }

        If your text has special characters, you'll have to be a little more
        creative.

        Chris Hilton

        -----Original Message-----
        From: coolrobd [mailto:coolrobd@...]
        Sent: Monday, 19 July, 2004 03:03
        To: perlguitest@yahoogroups.com
        Subject: [perlguitest] Quake Console Update Unreliable


        Let me start by explaining what I am trying to achieve. Basically
        the Quake engine has a console window that sits behind it, I believe
        this to be a child window. I want to update the console with text
        ever 2 seconds.

        Current Status - I am able to get text to the console, but it is not
        reliable, sometimes all the text arrives, other time bits are
        missing. If I click in the main window this screws it up, because I
        beleive the main window takes the focus away from the console,
        therefore the sendkeys command is sending the letters to the main
        window.

        Solution Required - I need some way of writing text but be able to
        specify what window to put this in.

        Any ideas will be greatly received as I am tearing me hair out and I
        am sure the solution is quite simple.

        Thanks



        Yahoo! Groups Sponsor

        ADVERTISEMENT

        <
        http://us.ard.yahoo.com/SIG=129qihuc9/M=295196.4901138.6071305.3001176/D=gr
        <http://us.ard.yahoo.com/SIG=129qihuc9/M=295196.4901138.6071305.3001176/D=gr
        >
        oups/S=1705006951:HM/EXP=1090327130/A=2128215/R=0/SIG=10se96mf6/*
        http://comp <http://comp>
        anion.yahoo.com> click here

        <
        http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
        <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
        >
        :HM/A=2128215/rand=913171747>


        _____

        Yahoo! Groups Links


        * To visit your group on the web, go to:
        http://groups.yahoo.com/group/perlguitest/
        <http://groups.yahoo.com/group/perlguitest/>
        < http://groups.yahoo.com/group/perlguitest/
        <http://groups.yahoo.com/group/perlguitest/> >


        * To unsubscribe from this group, send an email to:
        perlguitest-unsubscribe@yahoogroups.com
        <mailto:perlguitest-unsubscribe@yahoogroups.com?subject=Unsubscribe>


        * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
        < http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > .




        [Non-text portions of this message have been removed]



        Yahoo! Groups Sponsor

        ADVERTISEMENT

        <http://us.ard.yahoo.com/SIG=129bqm3hn/M=295196.4901138.6071305.3001176/D=gr
        oups/S=1705006951:HM/EXP=1090340193/A=2128215/R=0/SIG=10se96mf6/*http://comp
        anion.yahoo.com> click here

        <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
        :HM/A=2128215/rand=352197167>


        _____

        Yahoo! Groups Links


        * To visit your group on the web, go to:
        http://groups.yahoo.com/group/perlguitest/
        <http://groups.yahoo.com/group/perlguitest/>


        * To unsubscribe from this group, send an email to:
        perlguitest-unsubscribe@yahoogroups.com
        <mailto:perlguitest-unsubscribe@yahoogroups.com?subject=Unsubscribe>


        * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
        <http://docs.yahoo.com/info/terms/> .




        [Non-text portions of this message have been removed]
      • coolrobd
        SendMessage is definately the way to go I feel, but how do you pass a letter using SendMessage, any syntax would be appreciated. I know you can only send one
        Message 3 of 9 , Jul 20, 2004
          SendMessage is definately the way to go I feel, but how do you pass a
          letter using SendMessage, any syntax would be appreciated.

          I know you can only send one letter at a time.

          Thanks in advance!

          Rob

          --- In perlguitest@yahoogroups.com, "coolrobd" <coolrobd@y...> wrote:
          > I have been looking a bit more into it and think SendMessage is
          even
          > more reliable, anyone used this API function before?
          >
          > --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
          wrote:
          > > You might try splitting your message into individual keypresses
          and
          > set the
          > > foreground window (or focus window?) before sending each key.
          > Something like
          > > the following if it was just regular text:
          > >
          > > foreach $letter (split(//, $text)) {
          > > SetForegroundWindow($window);
          > > SendKeys($letter);
          > > }
          > >
          > > If your text has special characters, you'll have to be a little
          more
          > > creative.
          > >
          > > Chris Hilton
          > >
          > > -----Original Message-----
          > > From: coolrobd [mailto:coolrobd@y...]
          > > Sent: Monday, 19 July, 2004 03:03
          > > To: perlguitest@yahoogroups.com
          > > Subject: [perlguitest] Quake Console Update Unreliable
          > >
          > >
          > > Let me start by explaining what I am trying to achieve.
          Basically
          > > the Quake engine has a console window that sits behind it, I
          > believe
          > > this to be a child window. I want to update the console with
          text
          > > ever 2 seconds.
          > >
          > > Current Status - I am able to get text to the console, but it is
          > not
          > > reliable, sometimes all the text arrives, other time bits are
          > > missing. If I click in the main window this screws it up,
          because
          > I
          > > beleive the main window takes the focus away from the console,
          > > therefore the sendkeys command is sending the letters to the main
          > > window.
          > >
          > > Solution Required - I need some way of writing text but be able
          to
          > > specify what window to put this in.
          > >
          > > Any ideas will be greatly received as I am tearing me hair out
          and
          > I
          > > am sure the solution is quite simple.
          > >
          > > Thanks
          > >
          > >
          > >
          > > Yahoo! Groups Sponsor
          > >
          > > ADVERTISEMENT
          > >
          > >
          >
          <http://us.ard.yahoo.com/SIG=129qihuc9/M=295196.4901138.6071305.300117
          > 6/D=gr
          > >
          >
          oups/S=1705006951:HM/EXP=1090327130/A=2128215/R=0/SIG=10se96mf6/*http:
          > //comp
          > > anion.yahoo.com> click here
          > >
          > > <http://us.adserver.yahoo.com/l?
          > M=295196.4901138.6071305.3001176/D=groups/S=
          > > :HM/A=2128215/rand=913171747>
          > >
          > >
          > > _____
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > > * To visit your group on the web, go to:
          > > http://groups.yahoo.com/group/perlguitest/
          > > <http://groups.yahoo.com/group/perlguitest/>
          > >
          > >
          > > * To unsubscribe from this group, send an email to:
          > > perlguitest-unsubscribe@yahoogroups.com
          > > <mailto:perlguitest-unsubscribe@yahoogroups.com?
          > subject=Unsubscribe>
          > >
          > >
          > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
          > Service
          > > <http://docs.yahoo.com/info/terms/> .
          > >
          > >
          > >
          > >
          > > [Non-text portions of this message have been removed]
        • Chris Hilton
          I thought about suggesting this before, but it s a good bit more complicated. Trying to keep it as simple as possible, I believe it would be something like
          Message 4 of 9 , Jul 20, 2004
            I thought about suggesting this before, but it's a good bit more
            complicated. Trying to keep it as simple as possible, I believe it would be
            something like this:

            foreach $letter (split(//, $text)) {
            $vk = getVirtualKey($letter);
            SendMessage($window, WM_KEYDOWN, $vk, 1);
            SendMessage($window, WM_KEYUP, $vk, 1);
            }

            With getVirtualKey() and looking up the constant values left as exercises
            for the reader. Note that if you want to send a two-key combination, like a
            capital letter for the following example, you'll need to send a key down
            message for the virtual shift key, send your letter, then key up the virtual
            shift key. Here's some URLs that might come in handy.

            SendMessage:
            http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
            /WindowsUserInterface/Windowing/MessagesandMessageQueues/MessagesandMessageQ
            ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
            <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
            I/WindowsUserInterface/Windowing/MessagesandMessageQueues/MessagesandMessage
            QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
            WM_KEYDOWN:
            http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
            /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboar
            dInputMessages/WM_KEYDOWN.asp
            <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
            I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboa
            rdInputMessages/WM_KEYDOWN.asp>
            WM_KEYUP:
            http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
            /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboar
            dInputMessages/WM_KEYUP.asp
            <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
            I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/Keyboa
            rdInputMessages/WM_KEYUP.asp>
            Virtual Key Codes:
            http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI
            /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
            <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinU
            I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>

            I think it's a bit of overkill unless you've tried the other way and found
            it lacking, but good luck.

            Chris Hilton

            -----Original Message-----
            From: coolrobd [mailto:coolrobd@...]
            Sent: Tuesday, 20 July, 2004 07:22
            To: perlguitest@yahoogroups.com
            Subject: [perlguitest] Re: Quake Console Update Unreliable


            SendMessage is definately the way to go I feel, but how do you pass a
            letter using SendMessage, any syntax would be appreciated.

            I know you can only send one letter at a time.

            Thanks in advance!

            Rob






            [Non-text portions of this message have been removed]
          • coolrobd
            Naerly there I think - Just can t get then SendMessage to work. Do I need to setup the WM_KEYDOWN? Also getVirtialKey does not work - just wondering if you
            Message 5 of 9 , Jul 20, 2004
              Naerly there I think - Just can't get then SendMessage to work. Do
              I need to setup the WM_KEYDOWN?

              Also getVirtialKey does not work - just wondering if you where
              expecting me to knock up the code behind it?

              Cheers for the help.

              --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
              wrote:
              > I thought about suggesting this before, but it's a good bit more
              > complicated. Trying to keep it as simple as possible, I believe it
              would be
              > something like this:
              >
              > foreach $letter (split(//, $text)) {
              > $vk = getVirtualKey($letter);
              > SendMessage($window, WM_KEYDOWN, $vk, 1);
              > SendMessage($window, WM_KEYUP, $vk, 1);
              > }
              >
              > With getVirtualKey() and looking up the constant values left as
              exercises
              > for the reader. Note that if you want to send a two-key
              combination, like a
              > capital letter for the following example, you'll need to send a
              key down
              > message for the virtual shift key, send your letter, then key up
              the virtual
              > shift key. Here's some URLs that might come in handy.
              >
              > SendMessage:
              > http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinUI
              > /WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesan
              dMessageQ
              > ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
              > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinU
              >
              I/WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesand
              Message
              > QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
              > WM_KEYDOWN:
              > http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinUI
              > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
              e/Keyboar
              > dInputMessages/WM_KEYDOWN.asp
              > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinU
              >
              I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
              /Keyboa
              > rdInputMessages/WM_KEYDOWN.asp>
              > WM_KEYUP:
              > http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinUI
              > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
              e/Keyboar
              > dInputMessages/WM_KEYUP.asp
              > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinU
              >
              I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
              /Keyboa
              > rdInputMessages/WM_KEYUP.asp>
              > Virtual Key Codes:
              > http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinUI
              > /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
              > <http://msdn.microsoft.com/library/default.asp?url=/library/en-
              us/winui/WinU
              > I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>
              >
              > I think it's a bit of overkill unless you've tried the other way
              and found
              > it lacking, but good luck.
              >
              > Chris Hilton
              >
              > -----Original Message-----
              > From: coolrobd [mailto:coolrobd@y...]
              > Sent: Tuesday, 20 July, 2004 07:22
              > To: perlguitest@yahoogroups.com
              > Subject: [perlguitest] Re: Quake Console Update Unreliable
              >
              >
              > SendMessage is definately the way to go I feel, but how do you
              pass a
              > letter using SendMessage, any syntax would be appreciated.
              >
              > I know you can only send one letter at a time.
              >
              > Thanks in advance!
              >
              > Rob
              >
              >
              >
              >
              >
              >
              > [Non-text portions of this message have been removed]
            • Chris Hilton
              Yeah, that s what I meant by getVirtualKey() and looking up the constant values left as exercises for the reader . You ll need to write getVirtualKey() to
              Message 6 of 9 , Jul 21, 2004
                Yeah, that's what I meant by "getVirtualKey() and looking up the constant
                values left as exercises for the reader". You'll need to write
                getVirtualKey() to convert letters to virtual keys. You'll also need the
                constant values for WM_KEYDOWN, WM_KEYUP, and the virtual key codes (from
                winuser.h, I think) and, I would recommend, set them up as constants in your
                Perl program.

                use constant WM_KEYDOWN => <whatever>;
                use constant WM_KEYUP => <whatever>;

                Chris Hilton

                -----Original Message-----
                From: coolrobd [mailto:coolrobd@...]
                Sent: Tuesday, 20 July, 2004 16:11
                To: perlguitest@yahoogroups.com
                Subject: [perlguitest] Re: Quake Console Update Unreliable


                Naerly there I think - Just can't get then SendMessage to work. Do
                I need to setup the WM_KEYDOWN?

                Also getVirtialKey does not work - just wondering if you where
                expecting me to knock up the code behind it?

                Cheers for the help.

                --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
                wrote:
                > I thought about suggesting this before, but it's a good bit more
                > complicated. Trying to keep it as simple as possible, I believe it
                would be
                > something like this:
                >
                > foreach $letter (split(//, $text)) {
                > $vk = getVirtualKey($letter);
                > SendMessage($window, WM_KEYDOWN, $vk, 1);
                > SendMessage($window, WM_KEYUP, $vk, 1);
                > }
                >
                > With getVirtualKey() and looking up the constant values left as
                exercises
                > for the reader. Note that if you want to send a two-key
                combination, like a
                > capital letter for the following example, you'll need to send a
                key down
                > message for the virtual shift key, send your letter, then key up
                the virtual
                > shift key. Here's some URLs that might come in handy.
                >
                > SendMessage:
                > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinUI
                > /WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesan
                dMessageQ
                > ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
                > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinU
                >
                I/WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesand
                Message
                > QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
                > WM_KEYDOWN:
                > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinUI
                > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
                e/Keyboar
                > dInputMessages/WM_KEYDOWN.asp
                > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinU
                >
                I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
                /Keyboa
                > rdInputMessages/WM_KEYDOWN.asp>
                > WM_KEYUP:
                > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinUI
                > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
                e/Keyboar
                > dInputMessages/WM_KEYUP.asp
                > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinU
                >
                I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
                /Keyboa
                > rdInputMessages/WM_KEYUP.asp>
                > Virtual Key Codes:
                > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinUI
                > /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
                > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                us/winui/WinU
                > I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>
                >
                > I think it's a bit of overkill unless you've tried the other way
                and found
                > it lacking, but good luck.
                >
                > Chris Hilton
                >
                > -----Original Message-----
                > From: coolrobd [mailto:coolrobd@y...]
                > Sent: Tuesday, 20 July, 2004 07:22
                > To: perlguitest@yahoogroups.com
                > Subject: [perlguitest] Re: Quake Console Update Unreliable
                >
                >
                > SendMessage is definately the way to go I feel, but how do you
                pass a
                > letter using SendMessage, any syntax would be appreciated.
                >
                > I know you can only send one letter at a time.
                >
                > Thanks in advance!
                >
                > Rob
                >
                >
                >
                >
                >
                >
                > [Non-text portions of this message have been removed]



                Yahoo! Groups Sponsor

                ADVERTISEMENT

                <http://us.ard.yahoo.com/SIG=1293586lr/M=295196.4901138.6071305.3001176/D=gr
                oups/S=1705006951:HM/EXP=1090488476/A=2128215/R=0/SIG=10se96mf6/*http://comp
                anion.yahoo.com> click here

                <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
                :HM/A=2128215/rand=781724395>


                _____

                Yahoo! Groups Links


                * To visit your group on the web, go to:
                http://groups.yahoo.com/group/perlguitest/
                <http://groups.yahoo.com/group/perlguitest/>


                * To unsubscribe from this group, send an email to:
                perlguitest-unsubscribe@yahoogroups.com
                <mailto:perlguitest-unsubscribe@yahoogroups.com?subject=Unsubscribe>


                * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
                <http://docs.yahoo.com/info/terms/> .




                [Non-text portions of this message have been removed]
              • coolrobd
                Back to basic s I am afraid, I have looked into it and just can t figure it out, it just will not work, so now trying to get the calculator to accept keys,
                Message 7 of 9 , Jul 21, 2004
                  Back to basic's I am afraid, I have looked into it and just can't
                  figure it out, it just will not work, so now trying to get the
                  calculator to accept keys, still no joy, check out the attached
                  code, looks good to me, but does not work. The setting up of the
                  window works great, its just the SendMessage that does not work.

                  use Win32::GuiTest qw(FindWindowLike SendMessage
                  SetForegroundWindow ) ;

                  use constant WM_KEYDOWN => 0x0100;
                  use constant WM_KEYUP => 0x0101;

                  my ($hwnd) = FindWindowLike(0, "Calculator");
                  print "hwnd = $hwnd\n";
                  SetForegroundWindow($hwnd);
                  $test = SendMessage($hwnd, WM_KEYDOWN, 0x32, 1);
                  print "test = $test\n";
                  $test2 = SendMessage($hwnd, WM_KEYUP, 0x32, 1);
                  print "test2 = $test2\n";

                  --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
                  wrote:
                  > Yeah, that's what I meant by "getVirtualKey() and looking up the
                  constant
                  > values left as exercises for the reader". You'll need to write
                  > getVirtualKey() to convert letters to virtual keys. You'll also
                  need the
                  > constant values for WM_KEYDOWN, WM_KEYUP, and the virtual key
                  codes (from
                  > winuser.h, I think) and, I would recommend, set them up as
                  constants in your
                  > Perl program.
                  >
                  > use constant WM_KEYDOWN => <whatever>;
                  > use constant WM_KEYUP => <whatever>;
                  >
                  > Chris Hilton
                  >
                  > -----Original Message-----
                  > From: coolrobd [mailto:coolrobd@y...]
                  > Sent: Tuesday, 20 July, 2004 16:11
                  > To: perlguitest@yahoogroups.com
                  > Subject: [perlguitest] Re: Quake Console Update Unreliable
                  >
                  >
                  > Naerly there I think - Just can't get then SendMessage to work.
                  Do
                  > I need to setup the WM_KEYDOWN?
                  >
                  > Also getVirtialKey does not work - just wondering if you where
                  > expecting me to knock up the code behind it?
                  >
                  > Cheers for the help.
                  >
                  > --- In perlguitest@yahoogroups.com, Chris Hilton <chilton@n...>
                  > wrote:
                  > > I thought about suggesting this before, but it's a good bit more
                  > > complicated. Trying to keep it as simple as possible, I believe
                  it
                  > would be
                  > > something like this:
                  > >
                  > > foreach $letter (split(//, $text)) {
                  > > $vk = getVirtualKey($letter);
                  > > SendMessage($window, WM_KEYDOWN, $vk, 1);
                  > > SendMessage($window, WM_KEYUP, $vk, 1);
                  > > }
                  > >
                  > > With getVirtualKey() and looking up the constant values left as
                  > exercises
                  > > for the reader. Note that if you want to send a two-key
                  > combination, like a
                  > > capital letter for the following example, you'll need to send a
                  > key down
                  > > message for the virtual shift key, send your letter, then key up
                  > the virtual
                  > > shift key. Here's some URLs that might come in handy.
                  > >
                  > > SendMessage:
                  > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinUI
                  >
                  > /WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesan
                  > dMessageQ
                  > > ueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp
                  > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinU
                  > >
                  >
                  I/WindowsUserInterface/Windowing/MessagesandMessageQueues/Messagesand
                  > Message
                  > >
                  QueuesReference/MessagesandMessageQueuesFunctions/PostMessage.asp>
                  > > WM_KEYDOWN:
                  > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinUI
                  >
                  > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
                  > e/Keyboar
                  > > dInputMessages/WM_KEYDOWN.asp
                  > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinU
                  > >
                  >
                  I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
                  > /Keyboa
                  > > rdInputMessages/WM_KEYDOWN.asp>
                  > > WM_KEYUP:
                  > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinUI
                  >
                  > /WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReferenc
                  > e/Keyboar
                  > > dInputMessages/WM_KEYUP.asp
                  > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinU
                  > >
                  >
                  I/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference
                  > /Keyboa
                  > > rdInputMessages/WM_KEYUP.asp>
                  > > Virtual Key Codes:
                  > > http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinUI
                  > > /WindowsUserInterface/UserInput/VirtualKeyCodes.asp
                  > > < http://msdn.microsoft.com/library/default.asp?url=/library/en-
                  > <http://msdn.microsoft.com/library/default.asp?url=/library/en->
                  > us/winui/WinU
                  > > I/WindowsUserInterface/UserInput/VirtualKeyCodes.asp>
                  > >
                  > > I think it's a bit of overkill unless you've tried the other way
                  > and found
                  > > it lacking, but good luck.
                  > >
                  > > Chris Hilton
                  > >
                  > > -----Original Message-----
                  > > From: coolrobd [mailto:coolrobd@y...]
                  > > Sent: Tuesday, 20 July, 2004 07:22
                  > > To: perlguitest@yahoogroups.com
                  > > Subject: [perlguitest] Re: Quake Console Update Unreliable
                  > >
                  > >
                  > > SendMessage is definately the way to go I feel, but how do you
                  > pass a
                  > > letter using SendMessage, any syntax would be appreciated.
                  > >
                  > > I know you can only send one letter at a time.
                  > >
                  > > Thanks in advance!
                  > >
                  > > Rob
                  > >
                  > >
                  > >
                  > >
                  > >
                  > >
                  > > [Non-text portions of this message have been removed]
                  >
                  >
                  >
                  > Yahoo! Groups Sponsor
                  >
                  > ADVERTISEMENT
                  >
                  >
                  <http://us.ard.yahoo.com/SIG=1293586lr/M=295196.4901138.6071305.30011
                  76/D=gr
                  >
                  oups/S=1705006951:HM/EXP=1090488476/A=2128215/R=0/SIG=10se96mf6/*http
                  ://comp
                  > anion.yahoo.com> click here
                  >
                  > <http://us.adserver.yahoo.com/l?
                  M=295196.4901138.6071305.3001176/D=groups/S=
                  > :HM/A=2128215/rand=781724395>
                  >
                  >
                  > _____
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  > * To visit your group on the web, go to:
                  > http://groups.yahoo.com/group/perlguitest/
                  > <http://groups.yahoo.com/group/perlguitest/>
                  >
                  >
                  > * To unsubscribe from this group, send an email to:
                  > perlguitest-unsubscribe@yahoogroups.com
                  > <mailto:perlguitest-unsubscribe@yahoogroups.com?
                  subject=Unsubscribe>
                  >
                  >
                  > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                  Service
                  > <http://docs.yahoo.com/info/terms/> .
                  >
                  >
                  >
                  >
                  > [Non-text portions of this message have been removed]
                Your message has been successfully submitted and would be delivered to recipients shortly.