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
Here are a few simple, working, games that you can use as-is or as the basis for your own games.
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…
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.