Beginner Win32 / C question - Programmer

This is a discussion on Beginner Win32 / C question - Programmer ; Hello, How difficult is it to write an interface for my program to control another application? IE a piece of code that catches other programs' text and graphical output and converts that to a workable format for my core program? ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Beginner Win32 / C question

  1. Beginner Win32 / C question

    Hello,

    How difficult is it to write an interface for my program to control another
    application?
    IE a piece of code that catches other programs' text and graphical output
    and converts that to a workable format for my core program?
    I intend to write a bot for an Internet game which uses a client stored on
    my PC. However, I don't really have much experience with the Win32 API and
    would really appreciate some hints and pointers (no pun intended) to get me
    started.
    I already received some good help in response to my earlier post, but I'm
    looking for as many approaches possible to help me better understand the
    whole problem.

    Thanks in advance,

    Eric



  2. Re: Beginner Win32 / C question


    "Eric" wrote in message
    news:1058825242.740685@halkan.kabelfoon.nl...
    > Hello,
    >
    > How difficult is it to write an interface for my program to control
    > another
    > application?
    > IE a piece of code that catches other programs' text and graphical output
    > and converts that to a workable format for my core program?
    > I intend to write a bot for an Internet game which uses a client stored on
    > my PC. However, I don't really have much experience with the Win32 API and
    > would really appreciate some hints and pointers (no pun intended) to get
    > me
    > started.
    > I already received some good help in response to my earlier post, but I'm
    > looking for as many approaches possible to help me better understand the
    > whole problem.


    You've asked a very broad question which has multiple answers depending
    on what you're trying to do and how the program works. Basically, it's
    going to involve message hooks, faked messages and input events, and
    communications between processes.

    I suggest telling us what you're trying to do and what questions you
    have. I'm sure we can help.

    --

    -GJC
    -Software Consultant (Embedded systems and Real Time Controls)
    -gchanson@mvps.org

    -Abolish public schools



  3. Re: Beginner Win32 / C question

    "Eric" wrote in message news:<1058825242.740685@halkan.kabelfoon.nl>...
    > Hello,
    >
    > How difficult is it to write an interface for my program to control another
    > application?


    Not very. There are a few things you can try.

    > IE a piece of code that catches other programs' text and graphical output
    > and converts that to a workable format for my core program?
    > I intend to write a bot for an Internet game which uses a client stored on
    > my PC. However, I don't really have much experience with the Win32 API and
    > would really appreciate some hints and pointers (no pun intended) to get me
    > started.


    Then do a search on WM_COPYDATA . It's a windows message you can use
    to transfer data between applications.

    > I already received some good help in response to my earlier post, but I'm
    > looking for as many approaches possible to help me better understand the
    > whole problem.
    >


    Well I'm a firm beleiver in DIY. Look up how to pass data from app to
    app using the WM_COPYDATA message. If you're feeling brave, once
    WM_COPYDATA is a peice of cake for you, then lookup how to synchronize
    processes using mutexes.

    > Thanks in advance,
    >
    > Eric


    Well I know code samples kick ass .. but if you search for WM_COPYDATA
    , you'll find what you need.

    Tristan

  4. Re: Beginner Win32 / C question

    >>>> Eric writes:

    Eric> Hello, How difficult is it to write an interface for my
    Eric> program to control another application?

    That depends on whether you have source code for the application you
    are wanting to control. If so it's trivial. If not, then it depends
    on whether the 3rd party app was designed with some sort of automation
    mechanism in mind. Then assuming the automation is sufficient to your
    needs and the interfaces are documented this also is trivial.

    If you don't have source code and there is no support for
    automation/plugin/scripting, then it becomes a hard problem. And the
    way you go about creating a "bot" depends very much on how the game is
    written and what you want the bot to do. A text based win32 app would
    still be easy whereas a directx based graphical game would not.

    Eric> IE a piece of code that catches other programs' text and
    Eric> graphical output and converts that to a workable format for
    Eric> my core program?

    I've seen brute force bitmap diffs w/ polling used in conjunction with
    attachthreadinput/keybd_event/sendinput to automate things in a game.
    Or some games generate a log file which can be used to kick off "bot
    events". I've seen dll's inserted into the games process which patch
    certain api calls like DrawText and/or the winsock I/O functions to
    signal an event.

    Note that use of a "bot" in many games is prohibited by the EULA. And
    patching the code either dynamically or with a dissassembler /
    hex-editor is virtually always against the EULA.

  5. Re: Beginner Win32 / C question

    Eric wrote:

    > How difficult is it to write an interface for my program to control
    > another application?


    Others have mentioned, and I want to highlight, that it depends a
    great deal on the application you want to control.

    Some apps, for example Microsoft Excel, expose an interface that
    allows you *total* control. With that interface (called COM),
    you can do anything programmatically in Excel that a user could
    do using the app.

    Other apps will be much harder to control, because they do not
    offer a public API. Sometimes in Windows, you can do a lot by
    sending messages to the application you want to control. This
    often requires you identify the objects within the app and get
    their "handles". Tools exist (e.g. spy++) that can help you do
    this.

    > I intend to write a bot for an Internet game which uses a
    > client stored on my PC.


    Depending on a number of factors, you might wish to consider making
    a new client rather than controlling the existing one. Some of
    the factors are: how complicated the client is, what it does,
    whether you know or can get the internet protocol, the tools you
    have and exactly what your goals are.

    > However, I don't really have much experience with the Win32 API
    > and would really appreciate some hints and pointers (no pun
    > intended) to get me started.


    You have a lot of material to cover. Charles Petzold's book,
    PROGRAMMING WINDOWS (5th ed.) is considered by many to be *THE*
    Bible for Windows programming. I know it taught me a great
    deal.

    And you might as well start getting used to MSDN...

    --
    |_ CJSonnack _____________| How's my programming? |
    |_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
    |_____________________________________________|___ ____________________|

+ Reply to Thread