Solved

Multi-tasking using forms

Posted on 2000-04-28
6
256 Views
Last Modified: 2010-05-02
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?
0
Comment
Question by:saffron
6 Comments
 
LVL 1

Accepted Solution

by:
4P earned 500 total points
ID: 2759039
I worked on something about 6 months ago that was very similar to what you are working on now. I ran into the same problem, too. I tried it different ways, but no matter what I did the results were the same. So I figured that you have to have that timer control.

To me it appears, and I think this is logical, that when you call a method from your ActiveX exe, the method will be fully executed before the control is given back to the caller application.

Also, I think you must have the data processing code either in the Load or in the Init event of your form, because you are saying that your ActiveX exe displays a form upon completion. Please correct me if I'm wrong.

I worked around the problem by using a timer control whose Interval was set to 1, and then I maipulated the Enabled property of the timer.

Please let me know if you are interested in this solution, I'll write a little code example then. Just becase you said you wanted it to work without the timer...
0
 

Expert Comment

by:Surojitseal
ID: 2759661
I may sound novice, but I had a similar problem. I wanted to load a listview control from a database table in the backbround while a form (displayed thru a activeX dll object) showed the infamous filecopy animation just like windows explorer. I fould that the window that should play the animation hanged up while the DO UNTIL EOF() loop executed. Just writing a DOEVENTS within that loop did the trick. Let me know whether you have a doevents in your code, and if so, then where.
0
 
LVL 1

Expert Comment

by:4P
ID: 2761546
Hello Surojitseal,

I have no DoEvents in my code. DoEvents is a working solution (though a little bit slow), but in my case the big thing was to give feedback to the caller form through an event.

Let's wait and see if Saffron will be interested in the code.

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:saffron
ID: 2776706
4P,

Thanks I'm going to accept your comment as the answer (sorry Surojitseal but DoEvents wasn't the solution).  Unfortunately I inadvertently posted this question twice and a suggestion similar to yours was given by mdougan 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 was manipulating the enabled property of the timer in order to release control back to the client.

Thanks for your help.

Saffron.
0
 
LVL 3

Expert Comment

by:darinw
ID: 2779177
Reviewing question.

darinw
Customer Service
0
 
LVL 1

Expert Comment

by:4P
ID: 2783851
Hi Saffron,

Thanks for accepting my comments.

My offer to on the code is still valid. If you are interested in it, or if you run into a problem with this later on, you can e-mail me at peter.papp@halliburton.com.

Our mail server is a bit slow right now because of ILoveYou, but I imagine this will be solved Monday.

Bye
Péter
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now