home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Task Lister"
- ClientHeight = 3300
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 5175
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 3705
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 3300
- ScaleWidth = 5175
- Top = 1140
- Width = 5295
- Begin VB.CommandButton cmd_Notify
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Set Notification"
- Height = 495
- Left = 3360
- TabIndex = 2
- Top = 1080
- Width = 1455
- End
- Begin VBX.ccCallback Callback1
- EventTrigger = 1 'Posted
- IntVersion = 5
- Left = 3660
- Top = 2400
- Type = 6 'EnumWindows
- End
- Begin VB.CommandButton ListTasks
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "List Tasks"
- Height = 495
- Left = 3360
- TabIndex = 1
- Top = 360
- Width = 1455
- End
- Begin VB.ListBox lst_Tasks
- Appearance = 0 'Flat
- Height = 2565
- Left = 240
- TabIndex = 0
- Top = 360
- Width = 2835
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Callback1_EnumWindows(hWnd As Integer, lpData As Long, retval As Integer)
- lst_Tasks.AddItem Notifications(hWnd)
- End Sub
- Private Sub cmd_Notify_Click()
- Dim di%
- di% = NotifyRegister(0, Callback1.ProcAddress, NF_NORMAL)
- End Sub
- Private Sub Form_Load()
- Notifications$(0) = "NFY_UNKNOWN" ' Unknown notification
- Notifications$(1) = "NFY_LOADSEG" ' A segment is being loaded
- Notifications$(2) = "NFY_FREESEG" ' A segment is being freed
- Notifications$(3) = "NFY_STARTDLL" ' A DLL is being loaded
- Notifications$(4) = "NFY_STARTTASK" ' A task is being started
- Notifications$(5) = "NFY_EXITTASK" ' A task is ending
- Notifications$(6) = "NFY_DELMODULE" ' A module is being freed
- Notifications$(7) = "NFY_RIP" ' A fatal system error occured
- Notifications$(8) = "NFY_TASKIN" ' Switch to a task
- Notifications$(9) = "NFY_TASKOUT" ' Switch from a task
- Notifications$(10) = "NFY_INCHAR" ' A character is entered
- Notifications$(11) = "NFY_OUTSTR" ' Debugging string output
- Notifications$(12) = "NFY_LOGERROR" ' API error occured (not fatal)
- Notifications$(13) = "NFY_LOGPARAMERROR" ' An API parameter error was detected
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- NotifyUnRegister 0
- End Sub
- ' Fill the list box with the names and handles of tasks
- Private Sub ListTasks_Click()
- Dim success%
- Dim te As TASKENTRY
- lst_Tasks.Clear ' Clear the list box
- ' It is very important to initialize the value of
- ' the size field in the structure.
- te.dwSize = Len(te)
- success% = TaskFirst(te)
- Do While success%
- lst_Tasks.AddItem GetModuleName$(te) & " " & Hex$(te.hTask)
- success% = TaskNext(te)
- Loop
- End Sub
-