Ich möchte eine Hardcopy vom Display mit Druck/S-Abf machen und diesen dann in der UserForm mit einem CommandButton im Image1 öffnen.
Ist dies möglich?
Gruß
Fatih
Sub Schaltfläche11_Click()
End Sub
Option Explicit
Private Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal _
lParam As Long) As Boolean
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As _
Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" ( _
ByVal hwnd As Long) As Long
Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As _
Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As _
Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_VISIBLE = &H10000000
Private Const WS_BORDER = &H800000
Private llngRow As Long
Public Sub Start()
llngRow = 1
Columns("A:C").ClearContents
With Range("A1:C1")
.Value = Array("Hwnd", "Klasse", "Caption")
.Font.Bold = True
End With
Call EnumWindows(AddressOf WindowCallBack, ByVal 0&)
Columns("A:C").AutoFit
Tabelle1.Sort.SortFields.Clear
Tabelle1.Sort.SortFields.Add Key:=Columns(2)
With Tabelle1.Sort
.SetRange Columns("A:C")
.Header = xlYes
.MatchCase = False
.Apply
End With
End Sub
Private Function WindowCallBack(ByVal lngHwnd As Long, ByVal lngParam As Long) As Long
Dim strCaption As String, strClassName As String
Dim lngReturn As Long, lngStyle As Long
lngStyle = GetWindowLong(lngHwnd, GWL_STYLE)
If (lngStyle And (WS_VISIBLE Or WS_BORDER)) = (WS_VISIBLE Or WS_BORDER) Then
strClassName = Space$(256)
lngReturn = GetClassName(lngHwnd, strClassName, 256)
lngReturn = GetWindowTextLength(lngHwnd)
strCaption = Space$(lngReturn)
Call GetWindowText(lngHwnd, strCaption, lngReturn + 1)
llngRow = llngRow + 1
Cells(llngRow, 1).Resize(1, 3) = Array(lngHwnd, Trim$(strClassName), strCaption)
End If
WindowCallBack = 1
End Function
End Sub
If My.Computer.Clipboard.ContainsImage() Then
Dim grabpicture As System.Drawing.Image
grabpicture = My.Computer.Clipboard.GetImage()
PictureBox1.Image = grabpicture
End If
Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32.dll" ( _
ByRef PicDesc As PICT_DESC, _
ByRef RefIID As GUID, _
ByVal fPictureOwnsHandle As LongPtr, _
ByRef IPic As IPicture) As LongPtr
Gruß