468,241 Members | 1,737 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,241 developers. It's quick & easy.

Help with this code _WIN32_Process

Hello

As you can probably see from my code, I'm new to the Program world and VB.NET is my first language. I'm trying to use the Method from the WIN32_Process, but I don't know how to use it. I tried several syntax (could not figure it out). I Tried the following link below

http://msdn.microsoft.com/library/de...32_process.asp (I could not figure out the syntax)

and Example in VB.NET would really help. here is the code

Function FTerminate(ByVal ComputerName As String, ByVal StrProcessName As String) As Strin
Dim strResult As Strin
Dim objectQuery As New System.Management.ObjectQuery("Select * From Win32_Process"
Dim scope As New System.Management.ManagementScope("\\" & ComputerName & "\root\cimv2"
scope.Connect(
Dim patch As New ManagementObjectSearcher(scope, objectQuery
Dim strProcess As ManagementObjec
For Each strProcess In patch.Ge

If strProcess("Caption") = StrProcessName The

_________________> "TERMINATE METHOD HERE"*********

End I

Nex
Return strResul
End Functio
End Modul

Thank yo

John
Nov 20 '05 #1
2 1118
You may want to have a look at the System.Diagnostics.Process class
instead...
"riverbr" <an*******@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
Hello,

As you can probably see from my code, I'm new to the Program world and VB.NET is my first language. I'm trying to use the Method from the
WIN32_Process, but I don't know how to use it. I tried several syntax (could
not figure it out). I Tried the following link below:
http://msdn.microsoft.com/library/de...32_process.asp
(I could not figure out the syntax)
and Example in VB.NET would really help. here is the code.
Function FTerminate(ByVal ComputerName As String, ByVal StrProcessName As String) As String Dim strResult As String
Dim objectQuery As New System.Management.ObjectQuery("Select * From Win32_Process") Dim scope As New System.Management.ManagementScope("\\" & ComputerName & "\root\cimv2") scope.Connect()
Dim patch As New ManagementObjectSearcher(scope, objectQuery)
Dim strProcess As ManagementObject
For Each strProcess In patch.Get

If strProcess("Caption") = StrProcessName Then

_________________> "TERMINATE METHOD HERE"**********

End If

Next
Return strResult
End Function
End Module

Thank you

John

Nov 20 '05 #2
Thank you
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by sunfox | last post: by
6 posts views Thread by d.warnermurray | last post: by
4 posts views Thread by dixie | last post: by
1 post views Thread by Paul Rubin | last post: by
45 posts views Thread by davy.zou | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.