hoffe hie kann mir einer helfen. :-)
Ich suche eine Möglichkeit den Titel eines fremden Programms auszulesen.
Konkret habe ich eine Transkriptionssoftware, die die aktuelle Position als ersten Wert im Titel anzeigt. Diese würde ich gern auslesen und in Word einfügen.
Ich bin schon auf unten stehendenCode gestoßen, mit dem ich Prüfen kann, ob das Programm offen ist, aber noch nicht den Titel auslesen
Vielen Dank für Eure Hilfe!
Schönen Gruß,
Björn Borggräfe
Option Explicit
Private Declare
Function CreateToolhelp32Snapshot Lib "kernel32.dll" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare
Function Process32First Lib "kernel32.dll" (ByVal hSnapshot As Long, ByRef lppe As PROCESSENTRY32) As Long
Private Declare
Function Process32Next Lib "kernel32.dll" (ByVal hSnapshot As Long, ByRef lppe As PROCESSENTRY32) As Long
Private Declare
Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Private Enum Costant
TH32CS_SNAPPROCESS = &H2
MAX_PATH = 260
End Enum
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Public
Sub Alle_Prozesse()
Dim Snap As Long, Process As PROCESSENTRY32, Result As Long
Snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
If Snap <> -1 Then
Process.dwSize = Len(Process)
Result = Process32First(Snap, Process)
Do Until Result = 0
If InStr(1, UCase$(Process.szExeFile), "BARCODE.EXE") Then
MsgBox "Läuft !"
Exit Do
End If
Result = Process32Next(Snap, Process)
Loop
End If
CloseHandle Snap
End Sub