Solved

Multi-tasking using forms

Posted on 2000-04-28
6
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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