Solved

GetModuleUsage file kernel.exe not found

Posted on 2002-07-04
5
1,321 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 50 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

773 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