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

basic pb on LB

Expand Messages
  • Patrick
    Hello I have a pb to send data to a window of other program who I need to control with LB I know how put the cursor on the window calldll #user32,
    Message 1 of 4 , Jan 13, 2013
    • 0 Attachment
      Hello

      I have a pb to send data to a window of other program who I need to control with LB

      I know how put the cursor on the window
      calldll #user32, "SetCursorPos",_
      cur.x as long,_
      cur.y as long,_
      result as void

      but after that total mystery to send data into

      if someone have the knowhow thank's a lot for this future help I apreciate Patrick
    • Stefan Pendl
      ... Placing the cursor doesn t do anything useful on its own. What do you try to control? Press buttons? Enter text? Search this group for keybd_event and
      Message 2 of 4 , Jan 14, 2013
      • 0 Attachment
        Am 13.01.2013 21:28, schrieb Patrick:
        > Hello
        >
        > I have a pb to send data to a window of other program who I need to control with LB
        >
        > I know how put the cursor on the window
        > calldll #user32, "SetCursorPos",_
        > cur.x as long,_
        > cur.y as long,_
        > result as void
        >
        > but after that total mystery to send data into
        >
        > if someone have the knowhow thank's a lot for this future help I apreciate Patrick
        >

        Placing the cursor doesn't do anything useful on its own.

        What do you try to control?
        Press buttons?
        Enter text?

        Search this group for "keybd_event" and you will find some examples of
        sending keystrokes.
        Read the whole explanation at
        http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304%28v=vs.85%29.aspx
        to fully understand it.

        For mouse events see
        http://msdn.microsoft.com/en-us/library/windows/desktop/ms646260%28v=vs.85%29.aspx
        make sure to read and understand that too.

        Both API functions have been superseded, but you should master the
        simple ones first before you do the advanced stuff.

        Make sure to advance the problem step-by-step, since this is not easy stuff.

        You may even need to examine the EnumWindows API sample shipping with LB
        to find the application window.
        There have been a couple of examples posted here too.

        EnumClientWindows would be good to find the controls inside the window,
        if you need to position the mouse on a button to press it.
        There should be something posted too.

        In any case controlling another application is advanced stuff, so be
        prepared for a long journey.


        --
        Stefan Pendl
        http://stefanpendl.runbasichosting.com/

        LB 4.04 Pro ... http://www.libertybasic.com/assist.html
        LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

        LB Community Wiki .............. http://basic.wikispaces.com/
        LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
        LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

        Books at http://www.lulu.com/ and http://www.amazon.com/
        Alyce Watson ... APIs for Liberty BASIC
        Carl Gundel .... Beginning Programming with Liberty BASIC

        Windows 7 Home Premium 64-bit SP1
        AMD Turion X2 RM-70 2GHz, 4GB RAM
      • Patrick
        thanks Stefan for your answer I just want to reproduce the behavior of user 1) goto x,y with the mouse 2) click into the window 3) type text 4) send carriage
        Message 3 of 4 , Jan 16, 2013
        • 0 Attachment
          thanks Stefan for your answer

          I just want to reproduce the behavior of user

          1) goto x,y with the mouse
          2) click into the window
          3) type text
          4) send carriage return

          that all but it's seem impossible with LB because I can't adress a window not created by LB himself

          May be I have to choose other soft to do that ?

          thanks for your help

          Patrick
        • Stefan Pendl
          ... You will need to know the correct location else everything fails. The Window can be moved, so the location will need to be retrieved every time. ... This
          Message 4 of 4 , Jan 17, 2013
          • 0 Attachment
            Am 16.01.2013 23:32, schrieb Patrick:
            > thanks Stefan for your answer
            >
            > I just want to reproduce the behavior of user
            >
            > 1) goto x,y with the mouse

            You will need to know the correct location else everything fails.
            The Window can be moved, so the location will need to be retrieved every
            time.

            > 2) click into the window

            This might be need to activate the window, but it can be omitted if the
            control can be identified directly.

            > 3) type text

            If you have the window handle of the text control it is easy to do this.

            > 4) send carriage return

            This should be fairly easy too.

            >
            > that all but it's seem impossible with LB because I can't adress a window not created by LB himself
            >
            > May be I have to choose other soft to do that ?
            >

            LB can access other windows not created by the running LB program, but
            you must use API functions.
            This is true for any programming language.

            There are specialized utilities that allow automation of user
            interaction, but those are using the same API functions as LB would need to.


            --
            Stefan Pendl
            http://stefanpendl.runbasichosting.com/

            LB 4.04 Pro ... http://www.libertybasic.com/assist.html
            LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

            LB Community Wiki .............. http://basic.wikispaces.com/
            LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
            LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

            Books at http://www.lulu.com/ and http://www.amazon.com/
            Alyce Watson ... APIs for Liberty BASIC
            Carl Gundel .... Beginning Programming with Liberty BASIC

            Windows 7 Home Premium 64-bit SP1
            AMD Turion X2 RM-70 2GHz, 4GB RAM
          Your message has been successfully submitted and would be delivered to recipients shortly.