Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

GetModuleUsage file kernel.exe not found

Posted on 2002-07-04
5
Medium Priority
?
1,384 Views
Last Modified: 2012-08-13
i used the following from MSDN library for determining when the shelled application has
terminated.It gave me an error saying that "kernel" not found.The kernel.exe file in which
the GetModuleUsage API is present is not on my system.how can I solve this problem.

Extract from MSDN is as shown below:
HOWTO: Determine When a Shelled Process Has Terminated
Last reviewed: October 13, 1997
Article ID: Q96844  

      Declare Function GetModuleUsage% Lib "Kernel" (ByVal hModule%)


      Private Function TestFunc(ByVal lVal As Long) As Integer
      'this function is necessary since the value returned by Shell is an
      'unsigned integer and may exceed the limits of a VB integer
         If (lVal And &H8000&) = 0 Then
           TestFunc = lVal And &HFFFF&
         Else
           TestFunc = &H8000 Or (lVal And &H7FFF&)
         End If
      End Function



Add the following code to the Form_Click event procedure of Form1:

      Sub Form_Click()
        lRet& = Shell("NOTEPAD.EXE")       ' Modify the path as necessary.
        x% = TestFunc(lRet&)
        While GetModuleUsage(x%) > 0    ' Has Shelled program finished?
           z% = DoEvents()              ' If not, yield to Windows.
        Wend
        MsgBox "Shelled application just terminated", 64
      End Sub


0
Comment
Question by:vinayak_j
5 Comments
 
LVL 38

Accepted Solution

by:
PaulHews earned 200 total points
ID: 7130280
That's for win 3.x
Use the 32 bit version instead:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q129796
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7130366
yeah, that function is not supported in 32-bit.
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7132433
It can be done, search for CreateProcessA and WaitForSingleObject on MSDN. I agree, It's annoying that GetModuleUsage was removed.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7990658
Hi vinayak_j,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept PaulHews's comment(s) as an answer.

vinayak_j, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8053080
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

885 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