VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Paints a picture from a picture box onto the screen. It will paint over any program or you can chan

by Nepveux Software (4 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 29th June 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Paints a picture from a picture box onto the screen. It will paint over any program or you can change the handle to a specific program. Notes:

API Declarations


Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc 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

Rate Paints a picture from a picture box onto the screen. It will paint over any program or you can chan



Dim hParent As Long, hHandle As Long, hHDC As Long

'these two get the handle of the screen to paint on
hParent = FindWindow("Progman", "")
hHandle = FindWindowEx(hParent, 0, "SHELLDLL_DefView", vbNullString)

'convert the handle to an hDC
'this is needed to paint the picture onto the screen
hHDC = GetWindowDC(hHandle)

'paint Picture1 onto the desktop/screen
BitBlt hHDC, 0, 0, Picture1.ScaleWidth / 15, Picture1.ScaleHeight / 15, Picture1.hdc, 0, 0, vbSrcCopy

'do not remove this line!
ReleaseDC hHandle, hHDC
End Sub

Download this snippet    Add to My Saved Code

Paints a picture from a picture box onto the screen. It will paint over any program or you can chan Comments

No comments have been posted about Paints a picture from a picture box onto the screen. It will paint over any program or you can chan. Why not be the first to post a comment about Paints a picture from a picture box onto the screen. It will paint over any program or you can chan.

Post your comment

Subject:
Message:
0/1000 characters