Ich hab mal die Tastenkombination auf „Strg + Alt +…“ geändert.
An Shift kanns nicht liegen.
An VB6.0 kanns auch nicht liegen, weil ich das Programm auch als .exe ausprobiert hab.
Ich kann mir nur vorstellen, dass etwas bei den Variablen schief gegangen ist.
Dim Ablage2_Pic As Object
oder
Dim Ablage2_Pic As New StdPicture
Beim Object wird nichts eingefügt und bei Letzterem bekomm ich das Symbol…
Option Explicit
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String \* 64
End Type
Private Declare Function Shell\_NotifyIcon Lib "shell32.dll" Alias "Shell\_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const NIF\_ICON = &H2
Private Const NIF\_MESSAGE = &H1
Private Const NIF\_TIP = &H4
Private Const NIM\_ADD = &H0
Private Const NIM\_DELETE = &H2
Private Const NIM\_MODIFY = &H1
Dim IC As NOTIFYICONDATA
Dim Ablage1 As String
Dim Ablage1\_Pic As Object
Dim Ablage1\_Pic2 As New StdPicture
Dim Ablage2 As String
Dim Ablage2\_Pic As Object
Dim Ablage2\_Pic2 As New StdPicture
Private Sub Form\_Load()
Timer1.Interval = 200
Timer1.Enabled = True
Form1.Visible = False
With IC
.cbSize = Len(IC)
.hwnd = Picture1.hwnd 'an welches Fenster sollen die Nachrichten?
.uID = 2& 'unveränderlich
.uFlags = NIF\_MESSAGE Or NIF\_ICON Or NIF\_TIP
.uCallbackMessage = &H200 '= MouseMove
.hIcon = Picture1.Picture 'hier bekommen wir das Bild/Icon her
.szTip = "Clipboard 2x" + vbNullChar
End With
Shell\_NotifyIcon NIM\_ADD, IC
End Sub
Private Sub menuExit\_Click()
End
End Sub
Private Sub Timer1\_Timer()
Dim i As Integer
Dim arr(122) As Boolean
For i = 10 To 127
If GetAsyncKeyState(i) 0 Then
arr(i) = True
End If
Next
If arr(17) = True And arr(16) = True And arr(67) = True Then
SendKeys "^C"
Ablage1 = Clipboard.GetText
Set Ablage1\_Pic = Clipboard.GetData
End If
If arr(17) = True And arr(16) = True And arr(86) = True Then
Clipboard.SetText Ablage1
Clipboard.SetData Ablage1\_Pic
SendKeys "^V"
End If
If arr(17) = True And arr(16) = True And arr(68) = True Then
SendKeys "^C"
Ablage2 = Clipboard.GetText
Set Ablage2\_Pic2 = Clipboard.GetData
End If
If arr(17) = True And arr(16) = True And arr(70) = True Then
Clipboard.SetText Ablage2
Clipboard.SetData Ablage2\_Pic2
SendKeys "^V"
End If
End Sub
ich bekomme SendKeys nicht dazu, ‚copy and paste‘ so zu senden, daß sie ausgeführt werden.
Ich habe einen Alternativvorschlag:
1.) Strg & C tippen um zu kopieren.
2.) Strg & Shift & (eine Zahl) tippen, um die Zwischenablage in ein Objekt zu schreiben.
3.) Schritte 1 und 2 mit anderen Zahlen wiederholen.
4.) Strg & Alt & (eine Zahl) tippen, um die Zwischenablage mit den Daten aus den Objekten zu füllen.
5.) Strg & V tippen um die Daten aus der Zwischenablage einzufügen.
Nachteil:
Das Kopieren in das Objekt passiert nicht mit einem Tastendruck.
Vorteil:
Du kannst 10 verschiedene Bilder im Speicher haben und der Zwischenablage zuweisen.
… übrigens: Dein Code zeigt mir kein Trayicon, aber das ist ein anderes Thema, den betreffenden Programmteil habe ich gelassen, wie er war.
Gruß Rainer
Code für zwei Speicher. Erweitern auf 10 wird Dir nicht schwer fallen.
Option Explicit
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String \* 64
End Type
Private Declare Function Shell\_NotifyIcon Lib "shell32.dll" Alias "Shell\_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const NIF\_ICON = &H2
Private Const NIF\_MESSAGE = &H1
Private Const NIF\_TIP = &H4
Private Const NIM\_ADD = &H0
Private Const NIM\_DELETE = &H2
Private Const NIM\_MODIFY = &H1
Dim IC As NOTIFYICONDATA
Dim Ablage(9) As String
Dim Ablage\_Pic(9) As New StdPicture
Private Sub Form\_Load()
Timer1.Interval = 200
Timer1.Enabled = True
Form1.Visible = False
With IC
.cbSize = Len(IC)
.hwnd = Picture1.hwnd 'an welches Fenster sollen die Nachrichten?
.uID = 2& 'unveränderlich
.uFlags = NIF\_MESSAGE Or NIF\_ICON Or NIF\_TIP
.uCallbackMessage = &H200 '= MouseMove
.hIcon = Picture1.Picture 'hier bekommen wir das Bild/Icon her
.szTip = "Clipboard 2x" + vbNullChar
End With
Shell\_NotifyIcon NIM\_ADD, IC
End Sub
Private Sub menuExit\_Click()
End
End Sub
Private Sub Timer1\_Timer()
Dim i As Integer
Dim arr(122) As Boolean
For i = 10 To 127
If GetAsyncKeyState(i) 0 Then
arr(i) = True
End If
Next
If arr(17) = True And arr(16) = True And arr(49) = True Then
Ablage(1) = Clipboard.GetText
Set Ablage\_Pic(1) = Clipboard.GetData
End If
If arr(17) = True And arr(18) = True And arr(49) = True Then
Clipboard.Clear
Clipboard.SetText Ablage(1)
Clipboard.SetData Ablage\_Pic(1)
End If
If arr(17) = True And arr(16) = True And arr(50) = True Then
Ablage(2) = Clipboard.GetText
Set Ablage\_Pic(2) = Clipboard.GetData
End If
If arr(17) = True And arr(18) = True And arr(50) = True Then
Clipboard.Clear
Clipboard.SetText Ablage(2)
Clipboard.SetData Ablage\_Pic(2)
End If
End Sub
Hallo Rainer,
So. Das Programm ist fertig. Ich möchte dir vom Herzen danken, dass du mich bei der Entwicklung so tatenkräftig unterstützt hast.
Vielen Dank!
Man liest sich das nächste Mal, wenn mir wieder was auf dem Herzen liegt ;D