Solved

One more question concerning GetModuleUsage

Posted on 1997-07-08
1
232 Views
Last Modified: 2008-03-06
Hi experts,

I have one more question concerning the "GetModuleUsage" API function.

With help of the "Shell" and "GetModuleUsage" (= API function)
command I want to start several times a math software which reads input from a text file and does some very time consuming calculations with this input data.

So far my source code has the following structure:

Private Sub btnEndCommand_Click()
Dim i%
For i = 0 To 3
result = Shell("my_math_program.exe " , 6)
While GetModuleUsage(result) > 0
DoEvents
Wend
Next
End Sub

This attempt unfortunately has one very big setback:

In my VB sample procedure the user has to stop and start INTERACTIVELY
the single my_math_program sessions.

Is it possible to use "GetModuleUsage" in a "non-interactive-mode", too?

I would like to let us say 3 calculations being done during the night while
I am sleeping.
So I don't want to get up after each session and finish/start each session
by mouse click.
I want that each calculation session is started and finished AUTOMATICALLY,
without my interaction. So the second call of my_math_program should be
done after the first calculation is finished, the third call should be done
after the second calculation is finished, and so on.
Unfortunately one doesn't know the needed time for each calculation before,
so it makes no sense to start the calulation sessions in a certain time
interval.

What else could I try, If "GetModulUsage" is not the appropriate idea to
solve my problem?

If it is a help for you experts, I can send you this math program. It is
freeware so it can be freely distributed.

Any suggestions are highly appreciated.

cu
Christian Mathes
0
Comment
Question by:mathes
[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
1 Comment
 
LVL 2

Accepted Solution

by:
vorlon earned 50 total points
ID: 1428116
mathes,
Is you're math program an interactive application? I'm assuming it is not since it can run at night. In order for you're vb program to run you're math program several times, you can do a few things:

A) Create a loop in which:
1) you're math program gets executed
2) you're vb program checks for its termination using GetModuleUsage
3) you're vb program does some processing after the math program is done
4) go back to step 1

B) Instead of creating a closed loop with the above steps, place the above steps in a timer. Have the timer go off, say, every 5 minutes. Each time the timer event goes off, you could check the time from the system clock and therefore run the formentioned loop at predeterined times. Since you don't know what time to process, then it's better to maybe run the process every 5 minutes anyway.

QUESTION: Since you don't know what time to process the results of the math program, how do you determine when it's time run the vb program? All is dependent on that. The GetModuleUsage function is only usefull in determining when a certain application has terminated.

If you have any further questions don't hesitate to comment...
Hope this helps.
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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

707 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