yeah psy is right...
well here the code
you can delete some parts and clean it up and make the picbox invisible...
next time try to be little more polite... look at the other posts and you wont find a lot of F*** and *** there...
I keep the bad programming habit given by your sample code..
VB Code:
Private Declare Function GetDC 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 GetWindowDC Lib "user32" (ByVal hwnd 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 Sub Command1_Click() Dim wScreen As Long Dim hScreen As Long Dim w As Long Dim h As Long Picture1.Cls wScreen = Screen.Width \ Screen.TwipsPerPixelX hScreen = Screen.Height \ Screen.TwipsPerPixelY Picture1.ScaleMode = vbPixels Picture1.AutoRedraw = True w = Screen.Width / Screen.TwipsPerPixelX h = Screen.Height / Screen.TwipsPerPixelY hdcScreen = GetDC(0) 'hdcScreen = GetWindowDC(0) 'StretchBlt Picture1.hdc, 0, 0, w, h, hdcScreen, 0, 0, w, h, &HCC0020 Form1.ScaleMode = vbPixels Picture1.Width = w Picture1.Height = h BitBlt Picture1.hdc, 0, 0, w, h, hdcScreen, 0, 0, &HCC0020 SavePicture Picture1.Image, "C:\yourfile.bmp" End Sub




Reply With Quote