WMI Fun !! 〜 WMI に興味がある方・システム管理者必見! 〜 |
|
![]() |
WMI Fun !! > WMI Sample (VB) > 起動中のアプリケーション、プロセスを取得する |
起動中のアプリケーション、プロセスを取得する: Win32_Process - WMI Sample (VB)Topics
起動中のアプリケーション、プロセスを取得するサンプルプログラムです。
Sample Code
Private Sub Command1_Click()
Dim PrcSet As SWbemObjectSet Dim Prc As SWbemObject Dim Locator As SWbemLocator Dim Service As SWbemServices Dim MesStr As String Set Locator = New WbemScripting.SWbemLocator Set Service = Locator.ConnectServer Set PrcSet = Service.ExecQuery("Select * From Win32_Process") For Each Prc In PrcSet MesStr = MesStr & Prc.Description & ": " & _ CStr(Prc.ProcessId) & vbCrLf Next MsgBox "実行中アプリケーションです" & vbCrLf & vbCrLf & _ MesStr & vbCrLf & "ですよ。" Set Prc = Nothing Set Service = Nothing Set Locator = Nothing End Sub
![]() Comment
では実行してみましょう。 ![]() Recommended book
個人的にお勧めする本の紹介です。 ![]() |
ご意見・ご要望・ご感想をこちらのアンケートからお待ちしています |
∧ ページの先頭へ… |