Solved

One more question concerning GetModuleUsage

Posted on 1997-07-08
1
225 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

Industry Leaders: 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 (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

749 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