Home > Software engineering >  Similar to the Windows 7 taskbar thumbnails functional programming (ace)
Similar to the Windows 7 taskbar thumbnails functional programming (ace)

Time:09-28

I want to achieve similar to Windows 7 taskbar thumbnails function,

Is the current application window with a smaller window (150 * 150, for example, the reduced, the layout of the inside and the corresponding scaling, and is a real-time, such as video)
In my program interface,

Hope ace shows the code, after open stickers again thank,

CodePudding user response:

To learn, and roof

CodePudding user response:

You are the requirements for this screenshot and narrow displayed is not?
 
Option Explicit
Private Type the RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetDC Lib "user32" (ByVal HWND) As Long As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal HDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal HDC) As Long As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal HDC As Long, ByVal hObject As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal HDC) As Long As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal HWND As Long, ByVal HDC) As Long As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal HWND As Long, lpRect As the RECT) As Long
Private Declare Function GetForegroundWindow Lib "user32 () As" Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal HWND) As Long As Long

Private Declare Function StretchBlt Lib "gdi32" (ByVal HDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function SetStretchBltMode Lib "gdi32" (ByVal HDC As Long, ByVal nStretchMode As Long) As Long
Private Const STRETCH_HALFTONE=4

Dim topWnd As Long
H is Dim w As Long As Long, fW As Long, fH As Long, rc As the RECT
Dim dskHDC As Long
Dim MemDC As Long
Dim MemBitmap As Long


Private Sub Form_Load ()
With Picture1
SetStretchBltMode HDC, STRETCH_HALFTONE
. The ScaleMode=vbPixels
FW=. ScaleWidth
FH=. ScaleHeight
End With
DskHDC=GetDC (0)
MemDC=CreateCompatibleDC (dskHDC)

Timer1. Interval=100
Timer1. Enabled=True
End Sub

Private Sub Form_Unload (Cancel As Integer)
DeleteObject MemBitmap
DeleteDC MemDC
ReleaseDC 0, dskHDC
End Sub

Private Sub Timer1_Timer ()
TopWnd=GetForegroundWindow ()
If IsWindowVisible (topWnd) Then
Call GetWindowRect (topWnd, rc)
W=rc. Right - rc. Left
H=rc. Bottom - rc. Top

The Debug Print w, h
DeleteObject MemBitmap
MemBitmap=CreateCompatibleBitmap (dskHDC, w, h)
If MemBitmap & lt;> 0 Then
Call SelectObject (MemDC MemBitmap)
Call BitBlt (MemDC, 0, 0, w, h, dskHDC, rc, Left, rc, Top, vbSrcCopy Or & amp; H40000000)
StretchBlt Picture1. HDC, 0, 0, fW, fH, MemDC, 0, 0, w, h, vbSrcCopy
End the If
End the If
End Sub


  • Related