home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / articles / vbdev / source / tasklook.bas < prev    next >
Encoding:
BASIC Source File  |  1994-09-18  |  1.2 KB  |  45 lines

  1. Option Explicit
  2.  
  3. Type TASKENTRY ' 40 bytes
  4.     dwSize As Long
  5.     hTask As Integer
  6.     hTaskParent As Integer
  7.     hInst As Integer
  8.     hModule As Integer
  9.     wSS As Integer
  10.     wSP As Integer
  11.     wStackTop As Integer
  12.     wStackMinimum As Integer
  13.     wStackBottom As Integer
  14.     wcEvents As Integer
  15.     hQueue As Integer
  16.     szModule As String * 10
  17.     wPSPOffset As Integer
  18.     hNext As Integer
  19. End Type
  20.  
  21. Declare Function TaskFirst% Lib "toolhelp.dll" (lpte As TASKENTRY)
  22. Declare Function TaskNext% Lib "toolhelp.dll" (lpte As TASKENTRY)
  23. Declare Function TaskFindHandle% Lib "toolhelp.dll" (lpte As TASKENTRY, hTask As Integer)
  24. Declare Function NotifyRegister% Lib "toolhelp.dll" (ByVal hTask%, ByVal lpfnCallback&, ByVal wFlags%)
  25. Declare Sub NotifyUnRegister Lib "toolhelp.dll" (ByVal hTask%)
  26. Global Const NF_NORMAL% = 0
  27. Global Const NF_TASKSWITCH% = 1
  28. Global Const NF_RIP% = 2
  29.  
  30. Global Notifications$(13)
  31.  
  32. '
  33. '   Return the name of the module
  34. '
  35. Function GetModuleName$ (lpte As TASKENTRY)
  36.     Dim pos%
  37.     pos% = InStr(lpte.szModule, Chr$(0))
  38.     If pos% > 0 Then
  39.         GetModuleName$ = Left$(lpte.szModule, pos% - 1)
  40.     Else
  41.         GetModuleName$ = ""
  42.     End If
  43. End Function
  44.  
  45.