GetModuleUsage file kernel.exe not found
Posted on 2002-07-04
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&
TestFunc = &H8000 Or (lVal And &H7FFF&)
Add the following code to the Form_Click event procedure of Form1:
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.
MsgBox "Shelled application just terminated", 64