473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Controlling priorities or interrupting an application

I have built this app based on a form with several buttons, each to launch a different process. One of the buttons launches a process that is a number cruncher that has 35 parts that together take about 7 minutes to complete. I have a text box on the form in which I am trying to display progress messages like “1/35”, “2/35” etc. Once I hit the button, its code takes over and none of the progress messages are displayed. When done, the “35/35” shows. I’ve looked in help and googled and can find no graceful way to set relative priorities or even to interrupt the process, other than totally unacceptable task manager brute force. When I have this fully done, it will run full bore continuously – I will want a way to set higher priorities for other processes or at least interrupt it with a button and then resume. I tried the timer property for the form and it doesn’t seem to get called during the seven minutes. If I put a msgbox on the timer call, the box doesn’t come up once I hit the button.

Any ideas? Am I going to end up doing multithreading or run multiple instances of the app? Any help would be greatly appreciated.

thx, cb
May 21 '11 #1
3 1866
ADezii
8,834 Expert 8TB
You may have to somehow incorporate the DoEvents() Function in your Logic so that you can yield execution to the Operating System so that it can process other events. In the Demo Code that I have created, with every 100,000th Iteration of the Loop, the Code yields to the OS so that a Label can be updated with the Processing Status (as a Percentage). Hope this helps.
Expand|Select|Wrap|Line Numbers
  1. Dim x As Long
  2. Const conMAX_VALUE As Long = 1000000000
  3.  
  4. x = 1
  5.  
  6. While x <= conMAX_VALUE
  7.  If x Mod 100000 = 0 Then
  8.    DoEvents
  9.      Me![lblStatus].Caption = "Processing Status: " & Format$(x / conMAX_VALUE, "Percent")
  10.  End If
  11.    x = x + 1
  12. Wend
P.S. - Without DoEvents, you would only see Processing Status: 100.00% at the completion of the Task.
May 21 '11 #2
NeoPa
32,556 Expert Mod 16PB
Chris, you need to explain how your code is designed at the moment. Simply saying it doesn't do as expected leaves us very little to go on.
May 21 '11 #3
Thanks - i wasn't aware of that function. Works great!
May 24 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: AlanR | last post by:
Hi, I have to implement(or possibly acquire) a queue that manages priorities. Low priority elements cannot get lost in the queue indefinitely if there is a sustained, constant flow of high...
1
by: Seda Ozulku | last post by:
I don't have much information about .Net. May be it must be a silly question. I have Windows Application running at the server. I need to Access the program functions ( like at given time...
3
by: Amit Dedhia | last post by:
Hi I am developing a Dot net application (involving image processing) on a uni processor. It works well on my machine. I then take all my code on a multi processor, build and run the application...
1
by: cybertof | last post by:
Hello, Actually, I have a main VB6 application which launches an external c# application through a shell command. Each time the C# application is launched, the framework is "loaded" so it...
7
by: Tamir Khason | last post by:
I need the way to interrupt (freeze) ANY program currenlty running at the computer, then to activate the application and return the previous applications state after my application execution. Is...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
9
NeoPa
by: NeoPa | last post by:
In VBA (I expect VB would be similar) controlling another Office Application (Automation) can be done using the following steps : Ensure the Reference (VBA Window / Tools / References) has been...
3
by: John Nagle | last post by:
There's no way to set thread priorities within Python, is there? We have some threads that go compute-bound, and would like to reduce their priority slightly so the other operations, like...
6
by: Paulers | last post by:
Hello, I am trying to manipulate a console based application from another application for example I need to launch the console application, provide it input and take the output from the console...
0
by: SteelNetNob | last post by:
I am having a problem where I have a COM application that can be run stand-alone and programatically via COM interop. If an instance of the COM application is being run when my .NET application that...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.