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
Solved

Multi-tasking using forms

Posted on 2000-04-28
6
259 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

808 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