2つのパワーポイントファイル(A,B)を開き
それぞれのファイルからアクティブウインドウを切り替えたいです。
実行中のアプリケーションのプロセスIDを取得して
開いているパワポのウインドウハンドルを切り替えようと思ったのですが、
パワポ自体のプロセスIDはいつしか検出されず、ファイ名ではなくexe単位のようでした。
A、Bそれぞれスライドショーを実行している状態で
AからB、BからAをアクティブに切り替える方法はないでしょうか。。
VBA
1 2'WMIにて使用する各種オブジェクトを定義・生成する。 3Dim oClassSet 4Dim oClass 5Dim oLocator 6Dim oService 7Dim sMesStr 8 9'ローカルコンピュータに接続する。 10Set oLocator = CreateObject("WbemScripting.SWbemLocator") 11Set oService = oLocator.ConnectServer 12 13'クエリー条件を WQL にて指定する。 14Set oClassSet = oService.ExecQuery("Select * From Win32_Process") 15 16'コレクションを解析する。 17For Each oClass In oClassSet 18 19sMesStr = sMesStr & oClass.Description & ": " & _ 20CStr(oClass.ProcessId) & vbCrLf 21 22Next 23 24Debug.Print "実行中アプリケーションに関する情報です。" & vbCrLf & vbCrLf & sMesStr 25 26'使用した各種オブジェクトを後片付けする。 27Set oClassSet = Nothing 28Set oClass = Nothing 29Set oService = Nothing 30Set oLocator = Nothing
svchost.exe: 7116 POWERPNT.EXE: 6388 ImeBroker.exe: 2868 WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.exe: 364 dllhost.exe: 1592 Microsoft.Photos.exe: 1596 RuntimeBroker.exe: 6656 SearchProtocolHost.exe: 3556 audiodg.exe: 2204 SearchFilterHost.exe: 1012 notepad.exe: 6196
回答1件
あなたの回答
tips
プレビュー