Joke Collection Website - Public benefit messages - I want to use VB programming to make a process monitoring program.

I want to use VB programming to make a process monitoring program.

The VB6 method 1 calls the API.

Private declaration function findnowlib "user 32" alias "findnowa" u

(ByVal lpClassName in string form, ByVal lpWindowName in string form).

The private declaration function is the window library "user 32”(ByVal hwnd As Long).

As long as Dim lngAns

LngAns = FindWindow(vbNullString, "form title")

lngAns = IsWindow(lngAns)

If lngans < > then 0

MsgBox "Form has been loaded!" ,vbOKOnly

end

other

MsgBox "Form not loaded!" ,vbOKOnly

If ... it will be over.

VB6 method 2 Dim frm As Object

Dim blnFlag is a boolean value.

For each frm in the form

If frm. Caption = "Form Title" and then

blnFlag = True

Quit for ...

If ... it will be over.

The next frm

If blnFlag, then

MsgBox "Form Loaded"

other

MsgBox "Form not loaded"

End if VB. NET code (simple need to change, VB6 can also run) public function midchi (byval frmname as string) is Boolean.

Dim windows. Form form

For every thought in my heart. MdiChildren

If Chiffm. Then Name = frmName

If Chiffm. Visible at that time

Chiffm. Activate ()

other

Chiffm. Show ()

If ... it will be over.

Return True

If ... it will be over.

then

Returns False

end function private Sub menuitem 7 _ Click(ByVal sender As System。 Object, ByVal e as the system. EventArgs) processing MenuItem7. click

If midchi(“frm computer ") then

outlet connection

If ... it will be over.

Dim frmCp as the new frmComputer

frmCp。 MdiParent = me

frmCp。 Show ()

End joint