TaskNext and TaskFirst functions 
Author Message
 TaskNext and TaskFirst functions

VBPJ posted a tip on http://www.*-*-*.com/ on how to determine if an app
is complete.

I wrote the following test code but I get a run-time error '48':

Function IsInst(hInst As Long) As Boolean

    Dim taskstruct As TaskEntry
    Dim retc As Boolean

    IsInst = False
    taskstruct.dwSize = Len(taskstruct)
    retc = TaskFirst(taskstruct)

    Do While retc
        If taskstruct.hInst = hInst Then
            ' note: the task handle is: taskstruct.hTask
    IsInst = True
            Exit Function
        End If
        retc = TaskNext(taskstruct)
    Loop

End Function

'Declarations
Private Type TaskEntry
    dwSize As Long
    HTASK As Long
    hTaskParent As Long
    hInst As Long
    hModule As Long
    wSS As Long
    wSP As Long
    wStackTop As Long
    wStackMinimum As Long
    wStackBottom As Long
    wcEvents As Long
    hQueue As Long
   ' szModule(MAX_MODULE_NAME + 1) As String
    wPSPOffset As Long
    hNext As Long
End Type

Private Declare Function TaskNext Lib "toolhelp.dll" Alias "TASKNEXT" _
(taskstruct As TaskEntry) As Long
Private Declare Function TaskFirst Lib "toolhelp.dll" Alias "TASKFIRST"  _
(taskstruct As TaskEntry) As Long

Private Sub Command1_Click()
Dim hInst As Long

hInst = Shell("notepad.exe")

Do While IsInst(hInst)
    DoEvents
Loop

MsgBox "Hello"

End Sub

-------------------------------------------------------

Thanks for any help,

Dan Stoelting



Fri, 14 Aug 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. TaskNext and TaskFirst functions

2. TaskFirst and TaskNext functions - anyone get them to work?

3. API TASKNEXT VB 3.0

4. VB 3.0 API TASKNEXT

5. Running Excel function from Access function/macro

6. findlast function is not functioning?

7. new type of aggregate function (product function)

8. functions calling other functions

9. Function based on Function

10. Calling Function in CBF from Toolbar via a Public Function

11. Executing Function using String Containing Function Name

12. Function, function.

 

 
Powered by phpBB® Forum Software