Help Needed Controlling other application using VC++
-
Hi All, I am using a software to run a occupancy report manually by clicking a button in the software. I would like to automate this task by writing MFC application to programatically click the button every hour. So I dont know how to activate other application's button by my program. Could anyone please suggest me some possible solution for this? I am not sure where to start and how to proceed. Any piece of information will help me a lot. Thanks in advance.
Regards, Ram
-
Hi All, I am using a software to run a occupancy report manually by clicking a button in the software. I would like to automate this task by writing MFC application to programatically click the button every hour. So I dont know how to activate other application's button by my program. Could anyone please suggest me some possible solution for this? I am not sure where to start and how to proceed. Any piece of information will help me a lot. Thanks in advance.
Regards, Ram
Ram Murali wrote:
So I dont know how to activate other application's button by my program.
Why not just use a timer in the main application so it sleeps for an hour and then runs its activities? Alternatively you could probably use the Windows Task Scheduler.
-
Ram Murali wrote:
So I dont know how to activate other application's button by my program.
Why not just use a timer in the main application so it sleeps for an hour and then runs its activities? Alternatively you could probably use the Windows Task Scheduler.
Hi Thanx for your reply. Timer function wise, i have no problem. But my problem is how to activate other application's button using my own program. I used FindWindow() method to get the other application's window handle. But How to get the control of the button to send message to that button? This is the biggest issue to me now.
Regards, Ram
-
Hi Thanx for your reply. Timer function wise, i have no problem. But my problem is how to activate other application's button using my own program. I used FindWindow() method to get the other application's window handle. But How to get the control of the button to send message to that button? This is the biggest issue to me now.
Regards, Ram
Ram Murali wrote:
But How to get the control of the button to send message to that button?
I think you need to enumerate all the child windows until you find the button, then post a message to the button's HWND. However this seems a very complicated way of going about solving what is really a simple timer issue.
-
Ram Murali wrote:
But How to get the control of the button to send message to that button?
I think you need to enumerate all the child windows until you find the button, then post a message to the button's HWND. However this seems a very complicated way of going about solving what is really a simple timer issue.
Can you please tell me the easiest way to do this? Thanks
Regards, Ram
-
Hi All, I am using a software to run a occupancy report manually by clicking a button in the software. I would like to automate this task by writing MFC application to programatically click the button every hour. So I dont know how to activate other application's button by my program. Could anyone please suggest me some possible solution for this? I am not sure where to start and how to proceed. Any piece of information will help me a lot. Thanks in advance.
Regards, Ram
Use FindWindow() and then EnumChildWindows() to find that button .Refer MSDN for both functions.That will surely help u. Mark this ans as good if u feel it helped. Kushagra
-
Ram Murali wrote:
So I dont know how to activate other application's button by my program.
Why not just use a timer in the main application so it sleeps for an hour and then runs its activities? Alternatively you could probably use the Windows Task Scheduler.
Richard MacCutchan wrote:
Why not just use a timer in the main application so it sleeps for an hour and then runs its activities?
I think it's a 3rd-party application that he's wanting to run and simulate a button click within.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons