Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Multi-tasking using forms

Posted on 2000-04-28
6
Medium Priority
?
269 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 2000 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
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.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

926 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