Link to home
Start Free TrialLog in
Avatar of saffron
saffron

asked on

Multi-tasking using forms

Ok, my problem is that my application has a function key which (should) go off to produce a report in the background.  This report isn't to be printed but,when ready, is displayed on a spreadsheet control.  In the meantime I would like the user to be able to carry on doing data-entry.

I've followed the coffee example in the VB documentation and also a couple of examples on this excellant website.  However they all seem to depend on use of the timer control.  When I ignore this and play around with the code to produce the report in the Active X exe my calling application still hangs whilst waiting for the exe to finish processing.

I can't set the ActiveX exe to run as unattended execution because it displays a form on completion of processing.  

What I would like is the processing to carry on in the background and an event raised to signal that the report is ready to be displayed.  How can I get this to happen?  

My ActiveX exe is set up as Multiuse and the projecties are set to 'thread per object'.  

Can anybody help?
ASKER CERTIFIED SOLUTION
Avatar of mdougan
mdougan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The timer control is your answer. You must set up the timer control on the form of your background report. On form load, start the timer.

As an active X exe, the spawned program will kick off the timer and release control to your calling program immediately. When the timer event fires, it will execute the code you have placed in <object>_timer. This is where you put your report creation code. Your report production code should also have an event "Report Done" that is raised when the task is complete.

We have a process that uses this methodology to control numerous processes running at the same time.
Avatar of saffron
saffron

ASKER

mdougan,

Thanks I'm going to accept your comment as the answer.  Unfortunately I inadvertently posted this question twice and a suggestion similar to yours was given by 4P so I'm going to have to split the points 2-ways.  Hope this doesn't seem unfair.

Basically you were right and the key to the problem was manipulating the enabled property of the timer in order to release control back to the client.

Thanks for your help.

Saffron.
Reviewing question.

darinw
Customer Service
No problem, in the future, don't be shy about asking customer service to delete the duplicate question.  Just post a comment explaining what you'd done and invite the people who'd commented to post in the other question instead.