|
-
Jun 7th, 2000, 12:48 AM
#1
Thread Starter
Junior Member
How can I make a screenshot when my form is starting??
-
Jun 7th, 2000, 01:34 AM
#2
-
Jun 7th, 2000, 02:15 AM
#3
PowerPoster
You forgot a quotation mark 
I have a demo on my site... (right-click -> Save as...)
-
Jun 7th, 2000, 07:07 PM
#4
Thread Starter
Junior Member
Thanks!!
Thanks for the hints!
Neon
-
Jun 7th, 2000, 07:27 PM
#5
Thread Starter
Junior Member
Ahhhhhhh!
I downloaded the Demoe made by Fox but it contained some mistakes!!
For instance there was a variable not declared so that I wasn't able to use it!!
Can just someone give me the source code, or the name under which I can search for in the help file, but I use a german VB5!! And I didn't find anything about it!
Thanks Neon
-
Jun 7th, 2000, 08:04 PM
#6
PowerPoster
I looked at the source and Option Explicit is defined so there can't be any undefined variable. Maybe because it's made in VB6, you should make a new project and add the form/module of my project to it.
(That's also a point why I linked to the HP so people see the FAQ, and not only download the demos and when having trouble dunno why...)
-
Jun 7th, 2000, 08:13 PM
#7
PowerPoster
BTW: You won't find anything in the help without having MSDN installed because
it's API stuff. And my demos are tested, they all work (or I at least hope so )
Anyway, here's a tutorial for YOU:
Open a new project, add a PictureBox "Buffer" to it, don't forget to set all ScaleModes
to pixel. Then add two buttons "cmdBitBlt" and "cmdStretchBlt".
Finally add this code:
Code:
'To your module
'API
Public 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
Public 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
Public Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
'In the form
Private Sub cmdBitBlt_Click()
Dim DC As Long
'Get DC of desktop (=screen)
DC = GetWindowDC(GetDesktopWindow)
'BitBlt to Buffer
BitBlt Buffer.hdc, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, DC, 0, 0, vbSrcCopy
'Release DC
ReleaseDC frmMain.hwnd, DC
End Sub
Private Sub cmdStretchBlt_Click()
Dim DC As Long
'Get DC of desktop (=screen)
DC = GetWindowDC(GetDesktopWindow)
'BitBlt to Buffer
StretchBlt Buffer.hdc, 0, 0, Buffer.Width, Buffer.Height, DC, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, vbSrcCopy
'Release DC
ReleaseDC frmMain.hwnd, DC
End Sub
If you want to save the file set the AutoRedraw property of the picturebox to true and
add another button with this code:
Code:
SavePicture Buffer.Image, "C:\Test.bmp" 'Or any other file
Note that you won't see the picture now unless you save it!
-
Jun 7th, 2000, 09:32 PM
#8
his demo worked fine for me.
the only demos that dont work for me is 2 ddraw demo's,
the mouse one worked, but the other 2 didnt....
-
Jun 7th, 2000, 09:59 PM
#9
Thread Starter
Junior Member
OK,ok!
Ok, it might be as Fox suggested! I am using VB5 and he wrot it with VB6 as far as I could understand it.
So I'll try his code later on cause I have to do a lot for the school!!!
Thanks Neon
-
Jun 7th, 2000, 10:37 PM
#10
PowerPoster
np 
btw: You're german?
-
Jun 8th, 2000, 02:02 AM
#11
Thread Starter
Junior Member
German??
Yes I am! Why do you ask??
What about you, where do you come from??
Neon
-
Jun 8th, 2000, 02:45 AM
#12
PowerPoster
[german]
Ich frag nur Hatte auch mal das deutsche VS, aber das englische ist mir doch lieber...
[/german]
Switzerland
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
|