TaskFirst and TaskNext functions - anyone get them to work? 
Author Message
 TaskFirst and TaskNext functions - anyone get them to work?

Has anyone successfully implemented the TaskFirst and TaskNext functions
as detailed in one of the 99 VB4 tips found at www.windx.com.
You're supposed to be able to determine when an app is complete
but when I try out the code I get a run-time error '48'.

My test code is:

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 section:
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



Sat, 15 Aug 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. TaskNext and TaskFirst functions

2. TaskNext and TaskFirst functions

3. Has anyone EVER gotten this one to work?? ;-((

4. Anyone gotten ListView SubItemImages + FullRowSelect + Sorting working?

5. anyone gotten VB6 ActiveX doc to work?

6. Does anyone haver a working sample of API function GetPrivateProfileString which reads values from ini files

7. Does anyone haver a working sample of API function GetPrivateProfileString which reads values from ini files

8. Anyone worked with CommInput and CommOutput Functions?

9. Help needed getting the ChooseFont api function to work

10. API TASKNEXT VB 3.0

11. VB 3.0 API TASKNEXT

12. Getting the function's name during runtime while running in the scope of the function

 

 
Powered by phpBB® Forum Software