Public Sub Hook()
OldSub = SetWindowLong(frmMain.TestBox.hwnd, -4, AddressOf WndProc)
DC = GetWindowDC(frmMain.TestBox.hwnd)
'With frmMain.picSrc
'.Picture = LoadPicture(App.Path & "\pic.bmp")
' .PaintPicture .Picture, 0, 0, .ScaleWidth, .ScaleHeight, 0, 0, .ScaleWidth, .ScaleHeight
'BR = CreatePatternBrush(.Picture.Handle)
'Debug.Print LoadImage(0, App.Path & "\pic.bmp" & vbNullChar, 0, 0, 0, 0)
BR = CreatePatternBrush(LoadImage(0, App.Path & "\pic.bmp" & vbNullChar, 0, 0, 0, 0))
'End With
mDC = frmMain.picSrc.hdc
End Sub
Public Function WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal Param1 As Long, ByVal Param2 As Long) As Long
On Error Resume Next
Dim r As RECT
WndProc = CallWindowProc(OldSub, hwnd, Msg, Param1, Param2)
Select Case Msg
Case &H100E, &HF, &H101, &H84, &H20, &H200, &HA0, &H21, &H201, &H215, &H202, &H203, &H204, &H121, &H11F, &H7B, &H205, &H20A, &H207, &H208, &HB1, &HC2, &H302, &H102, &H301, &H307, &H300, &H18, &H306, &H82
'BitBlt DC, 0, 0, 16, 16, mDC, 0, 0, vbMergePaint
'StretchBlt DC, 0, 0, frmMain.TestBox.Width, frmMain.TestBox.Height, _
mDC, 0, 0, frmMain.picSrc.ScaleWidth, frmMain.picSrc.ScaleHeight, vbMergePaint
GetClientRect frmMain.TestBox, r
FillRect DC, r, BR
End Select
End Function
Сейчас этот форум просматривают: Google-бот и гости: 39