ich würde dein Super-Makro auch gern im Büro einsetzen. Dort haben wir
Excel 97 SR-2 und Windows NT 4.0 SR-6. Ich habs probiert aber es
erscheinen aber die Fehlermeldungen:
Laufzeitfehler '453'
Kann Einsprungpunkt CreateToolhelp32Snapshot in der DLL Kernel32 nicht finden
und
Laufzeitfehler '453'
Kann Einsprungpunkt Process 32 First in der DLL Kernel32 nicht finden.
Kann du mir nochmals helfen?
Danke im Voraus
Erwin
Const TH32CS_SNAPHEAPLIST = &H1
Const TH32CS_SNAPPROCESS = &H2
Const TH32CS_SNAPTHREAD = &H4
Const TH32CS_SNAPMODULE = &H8
Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Const TH32CS_INHERIT = &H80000000
Const MAX_PATH As Integer = 260
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
Private Declare
Function CreateToolhelp32Snapshot Lib "Kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare
Function Process32First Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare
Function Process32Next Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare
Sub CloseHandle Lib "Kernel32" (ByVal hPass As Long)
Sub teste_mal()
Dim hSnapShot As Long, uProcess As PROCESSENTRY32, strPro As String, bolOpen As Boolean
hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0&)
uProcess.dwSize = Len(uProcess)
r = Process32First(hSnapShot, uProcess)
Do While r
strPro = Left$(uProcess.szExeFile, IIf(InStr(1, uProcess.szExeFile, Chr$(0)) > 0, InStr(1, uProcess.szExeFile, Chr$(0)) - 1, 0))
r = Process32Next(hSnapShot, uProcess)
If UCase(strPro) = "OUTLOOK.EXE" Then
Exit Sub
bolOpen = True
Exit Do
End If
Loop
CloseHandle hSnapShot
If Not bolOpen Then
Dim out1
out1 = Shell("C:\WIN32APP\outlook\Office\OUTLOOK.EXE /nopreview", 6)
MsgBox "Outlook wurde geöffnet!"
End If
End Sub