DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: C++ program problem  (Read 9,192 times)

heretic06

  • Participant
  • Joined in 2013
  • *
  • Posts: 4
C++ program problem
« on: July 15, 2013, 07:12 PM »
Hey, i am wanting a program which has a start and stop function and does something along the lines of this:

(program start button pressed)
* launch certain .exe file
* wait until .exe file has loaded (probably just wait 5 seconds)
* press run button on .exe file
* if certain pop up appears, close pop up and close .exe file
* repeat until stop function is clicked

i know it may seem abit vague but this is what i am in need of, im abit too new to c++ to be able to write this kind of program

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: C++ program problem
« Reply #1 on: July 15, 2013, 07:25 PM »
Hi, heretic06, and welcome to the DonationCoder site.  :Thmbsup:

As for your request, you might be better off trying to use something like AutoHotkey to script/automate your request.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: C++ program problem
« Reply #2 on: July 15, 2013, 08:39 PM »
I agree with skwire.  AHK or variants such as AHK_L make detecting new windows easy.  It has functions that can get all handles of windows of a certain class etc.. out of the box.  With C++ you'd have to roll your own functions for the most part.  Anything more complicated than getting an individual handle to a window you'd likely have to code yourself.

heretic06

  • Participant
  • Joined in 2013
  • *
  • Posts: 4
Re: C++ program problem
« Reply #3 on: July 16, 2013, 04:34 PM »
well, i have spent some time with AHK but... the program i am trying to open up has a slight annoying pop up... when the program loads and you hit start, it brings up a pop up saying "To make sure you are not a bot, please solve this simple equation: 12 + 27 = ?" obviously the equation always changes, but it is always something plus something equals...., thats thing only thing i am stuck on, everything else is so easy, loading program, clicking start, then the damn pop up =/

any idea's?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: C++ program problem
« Reply #4 on: July 16, 2013, 05:48 PM »
If it's a graphic to avoid automated response you're probably stuck. Unless they did a really bad job of it that is. :)

heretic06

  • Participant
  • Joined in 2013
  • *
  • Posts: 4
Re: C++ program problem
« Reply #5 on: July 16, 2013, 05:49 PM »
luckily its not a graphic, it is text, you can't highlight it, but it is text from a text box

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: C++ program problem
« Reply #6 on: July 16, 2013, 06:13 PM »
As skwire is the mod maybe he can speak to whether we're supposed to circumvent anti-bot code. I'm not sure. I don't know how to do it anyway, off the top of my head.

justice

  • Solve issues simply.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • Participated in NANY Challenge Four Times
    • Cody Award
    • Coding Snacks
    • DJ Badge - DJ
Re: C++ program problem
« Reply #7 on: July 17, 2013, 09:20 AM »
ClickOff might already be doing what you want.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: C++ program problem
« Reply #8 on: July 17, 2013, 07:42 PM »
luckily its not a graphic, it is text, you can't highlight it, but it is text from a text box

Have you tried SendMessage API using WM_GETTEXT message to the control?  Get the handle of the active control when the box pops up.  Send the WM_GETTEXT msg to the control.  Then you'll have to pull it apart in sections like first number, operator, second number etc..

Use a window spy to see the controls on the box so you'll know the identifier to use with SendMessage.
If you can get the text then it should be pretty simple to add or subtract after comparing the arithmetic operator to '-' or '+' etc..

In AHK you'd just use ControlGetText()

heretic06

  • Participant
  • Joined in 2013
  • *
  • Posts: 4
Re: C++ program problem
« Reply #9 on: July 18, 2013, 04:20 PM »
cheers dude, i'll give it a try, see what i can do

Original address: https://www.donationcoder.com/forum/index.php?topic=35463.0