
23/07/2009, 13:09
|
| | Fecha de Ingreso: abril-2005
Mensajes: 351
Antigüedad: 20 años Puntos: 3 | |
Respuesta: Capturar pantalla hola poniendo atributos LAYERED al formulario BitBlt no lo captura.
Código:
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32.dll" (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
Const LWA_ALPHA As Long = &H2
Const GWL_EXSTYLE As Long = (-20)
Const WS_EX_LAYERED As Long = &H80000
Private Sub Command1_Click()
Dim DC As Long
DC = GetDC(0)
BitBlt Picture1.hdc, 0, 0, Screen.Width / 15, Screen.Height / 15, DC, 0, 0, vbSrcCopy
Picture1 = Picture1.Image
DeleteDC DC
End Sub
Private Sub Form_Load()
With Picture1
.AutoRedraw = True
.Move 0, 0, Screen.Width, Screen.Height
End With
Command1.ZOrder 0
SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.hwnd, 0, 255, LWA_ALPHA
End Sub
Saludos |