AW: Userform als Messagebox
18.04.2009 08:20:34
ransi
HAllo Horst
Da das aber nicht funktioniert (weder über SendKeys noch über API),...
Stimmt so nicht ganz.
Ist zwar etwas Aufwand, aber machbar:
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Dim hEvent
Private Declare Function SetTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Sub keybd_event Lib "user32.dll" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Public Sub Aufruf()
EnableTimer 500
MsgBox "Test"
End Sub
Public Sub TimerProc(ByVal hWnd As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long)
screenshot
'Jetzt liegt die Msgbox in der Zwischenablage.
DisableTimer
End Sub
Public Function EnableTimer(ByVal msInterval As Long)
If hEvent <> 0 Then Exit Function
hEvent = SetTimer(0&, 0&, msInterval, AddressOf TimerProc)
End Function
Public Function DisableTimer()
If hEvent = 0 Then Exit Function
KillTimer 0&, hEvent
hEvent = 0
End Function
Public Sub screenshot()
keybd_event &H2C, 1, 0, 0
End Sub
Ich würde es aber trotzdem mit der Userform machen.
(Ist einfacher)
ransi