• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Automate actions on a modal form

I have a dialog-based application that works just fine.  Thanks to some of the folks here at Experts-Exchange I can read command line and start this app from another application.

The application opens a modal dialog.  Once the dialog is open, I want to have it perform some tasks automatically that would normally require a user to initiate from a button click.  My problem is that I don't know when the dialog is ready to begin processing, which I am defining as fully displayed and waiting for user action.

Any ideas on how I can approach this?
0
danhotb1
Asked:
danhotb1
1 Solution
 
jkrCommented:
You can use 'WaitForInputIdle()' after launching the process, e.g.

PROCESS_INFORMATION pi;

//...

CreateProcess (..., &pi);

WaitForInputIdle ( pi.hProcess, INFINITE);

// do tasks
0
 
danhotb1Author Commented:
Sorry, I don't understand.  The dialog has already been opened like this:

   CMyDialog dlg;
   m_pMainForm = &dlg;
   
   int iResponse = dlg.DoModal();

That is the code that Visual Studio built.  Now I need to do something inside the modal dialog after it is opened.  What process would I be waiting for and where would I put the code you describe?
0
 
jkrCommented:
Hmm - I thought you wanted to do that from the application that starts your dialog app. Am I wrong here?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
danhotb1Author Commented:
No, from inside the app itself.  Here's what needs to happen:
1.  App 1 starts App2, with command line arguments.
2.  App2 reads the command line arguments and automatically starts a process that would usually be done by a user clicking a button.
3.  App2 exits with a return value to App1.

Step 2 is the problem.  Now, the process that starts is a series of steps that a user needs to respond to on the modal form, sort of like a wizard, but the process needs to start without a user clicking a button.  I just don't know when to initiate this process because I don't know when the form is open and ready for the user to click the button.








0
 
danhotb1Author Commented:
I figured it out.  Just using ::PostMessage() function in OnInitDialog().
0
 
NawalKishore1976Commented:
Hi you can automate the tasks like button click on
OnInitDialog. of Dialbox Class.

What kind of oprations you want? or you want to wait for few seconds before anthing.

You can also use WM_TIMER message
0
 
GranModCommented:
PAQed with points refunded (250)

GranMod
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now