topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 9:00 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: C++ program problem  (Read 6238 times)

heretic06

  • Participant
  • Joined in 2013
  • *
  • Posts: 4
    • View Profile
    • Donate to Member
C++ program problem
« on: July 15, 2013, 02: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

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #1 on: July 15, 2013, 02: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
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #2 on: July 15, 2013, 03: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
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #3 on: July 16, 2013, 11:34 AM »
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
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #4 on: July 16, 2013, 12: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
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #5 on: July 16, 2013, 12: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
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #6 on: July 16, 2013, 01: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

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #7 on: July 17, 2013, 04:20 AM »
ClickOff might already be doing what you want.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #8 on: July 17, 2013, 02: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
    • View Profile
    • Donate to Member
Re: C++ program problem
« Reply #9 on: July 18, 2013, 11:20 AM »
cheers dude, i'll give it a try, see what i can do