|
-
Mar 27th, 2001, 12:23 PM
#1
Thread Starter
Fanatic Member
I want to capture the desktop including all the icons and save it to a file. VB World has an example, but it gives me an error... stack overflow!. HELP!!!
-
Mar 27th, 2001, 12:56 PM
#2
Fanatic Member
Code:
Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Integer, ByVal x As Integer, _
ByVal y As Integer, ByVal nWidth As Integer, _
ByVal nHeight As Integer, ByVal _
hSrcDC As Integer, ByVal xSrc As Integer, _
ByVal ySrc As Integer, ByVal dwRop As _
Long) As Integer
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetDC Lib "user32" _
(ByVal hwnd As Long) As Long
Sub Grabscreen(Dest As PictureBox)
Dim DeskhWnd As Long, DeskDC As Long
'Get the hWnd of the desktop
DeskhWnd = GetDesktopWindow()
'BitBlt needs the DC to copy the image. So, we
'need the GetDC API.
DeskDC = GetDC(DeskhWnd)
Dest.AutoRedraw = True
BitBlt Dest.hDC, 0, 0, _
Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, DeskDC, _
0, 0, vbSrcCopy
Dest.Refresh
End Sub
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Mar 28th, 2001, 01:09 AM
#3
Thread Starter
Fanatic Member
No Luck
Thanks 4 trying to help, but I still get stack overflow error both in 640*480 pxl and 800*600 pxl!
-
Mar 28th, 2001, 02:36 AM
#4
Fanatic Member
That's weird, are you getting the error in the BitBlt line? (that's the only possibility I guess)...
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Mar 28th, 2001, 06:02 AM
#5
PowerPoster
Try my Screenshot demo...
-
Mar 28th, 2001, 12:46 PM
#6
Thread Starter
Fanatic Member
BitBlt
Yes, u r right. Even in the example in the VB-World Graphics section, I am getting the same error
Error: Stack overflow!
If I get things right, I'll post a reply
-
Mar 28th, 2001, 01:05 PM
#7
PowerPoster
weird... whats your graphics card?
-
Mar 30th, 2001, 10:52 AM
#8
Thread Starter
Fanatic Member
Got it
I got it. I tried the project from screenshot.zip from FOX's website. The only difference was he captured it to a Picture Box. Maybe thats where I got the error
-
Mar 30th, 2001, 10:58 AM
#9
PowerPoster
My demos are proofed
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|