Page 1 of 1
Howto Save a Screenshot?
Posted: Sat Mar 13, 2004 5:43 pm
by darklordz
Code: Select all
Procedure CaptureScreen(Left.l, Top.l, Width.l, Height.l)
dm.DEVMODE
srcDC.l
trgDC.l
BMPHandle.l
srcDC = CreateDC_("DISPLAY", "", "", dm)
trgDC = CreateCompatibleDC_(srcDC)
BMPHandle = CreateCompatibleBitmap_(srcDC, Width, Height)
SelectObject_( trgDC, BMPHandle)
BitBlt_( trgDC, 0, 0, Width, Height, srcDC, Left, Top, #SRCCOPY)
OpenClipboard_(#NULL)
EmptyClipboard_()
SetClipboardData_(2, BMPHandle)
CloseClipboard_()
DeleteDC_( trgDC)
ReleaseDC_( BMPHandle, srcDC)
ProcedureReturn
EndProcedure
CaptureScreen( 0, 0, 800, 600)
Using the above code how would I save the picture from the clipboard?
Posted: Sat Mar 13, 2004 7:06 pm
by scurrier
Code: Select all
Procedure CaptureScreen(Left.l, Top.l, Width.l, Height.l)
dm.DEVMODE
srcDC.l
trgDC.l
BMPHandle.l
srcDC = CreateDC_("DISPLAY", "", "", dm)
trgDC = CreateCompatibleDC_(srcDC)
BMPHandle = CreateCompatibleBitmap_(srcDC, Width, Height)
SelectObject_( trgDC, BMPHandle)
BitBlt_( trgDC, 0, 0, Width, Height, srcDC, Left, Top, #SRCCOPY)
OpenClipboard_(#NULL)
EmptyClipboard_()
SetClipboardData_(2, BMPHandle)
CloseClipboard_()
DeleteDC_( trgDC)
ReleaseDC_( BMPHandle, srcDC)
ProcedureReturn BMPHandle
EndProcedure
Width=800
Height=600
FileName$="C:\Test.bmp"
*DeskTop=CaptureScreen( 0, 0, Width, Height)
CreateImage(DeskTop, Width, Height)
UseImage(DeskTop)
StartDrawing(ImageOutput())
DrawImage(*DeskTop, 1, 1)
StopDrawing()
SaveImage(DeskTopSprite, FileName$ ,#PB_ImagePlugin_BMP )
you need to return your handle to the BMP then this will work
Sean
Posted: Sat Mar 13, 2004 7:07 pm
by scurrier
i think PB or Rings has shown this befor
thank them
Sean
Posted: Sat Mar 13, 2004 7:38 pm
by cykotic
move on.....

Posted: Sat Mar 13, 2004 8:09 pm
by darklordz
Yes and No, a mistake that could have happenend to anyone... This is gonna follow me to the grave. Ive explained this to numerous people. I kept all of my data on a webserver and after a server reset my index go tdeleted to people (mostly from blitzcoder) could browse my stuff.... (<< the realy short version)
if you need details pm me...i find i kind of embarasing and disrespectfull you confronting me like this...
Posted: Sat Mar 13, 2004 8:18 pm
by Kale
I kept all of my data on a webserver
Even full version of PB? tut tut.. 8O
Posted: Sat Mar 13, 2004 8:20 pm
by darklordz
I kept everything (it happens when u have over 3gb webspace) and like to have access to ur files 24/7.....
the files were only public for a couple of hrs (3/4) the friendly peeps @ blitz irc told me about it....
edit: the final function is
Code: Select all
Procedure.l CaptureScreen(Left.l, Top.l, Width.l, Height.l)
dm.DEVMODE
srcDC.l
trgDC.l
BMPHandle.l
srcDC = CreateDC_("DISPLAY", "", "", dm)
trgDC = CreateCompatibleDC_(srcDC)
BMPHandle = CreateCompatibleBitmap_(srcDC, Width, Height)
SelectObject_( trgDC, BMPHandle)
BitBlt_( trgDC, 0, 0, Width, Height, srcDC, Left, Top, #SRCCOPY)
OpenClipboard_(#NULL)
EmptyClipboard_()
SetClipboardData_(2, BMPHandle)
CloseClipboard_()
DeleteDC_( trgDC)
ReleaseDC_( BMPHandle, srcDC)
ProcedureReturn BMPHandle
EndProcedure
Procedure.l SaveScreen(FileName.s,Left.l,Top.l,Width.l,Height.l)
*DeskTop = CaptureScreen(Left.l,Top.l,Width.l,Height.l)
CreateImage(DeskTop,Width.l,Height.l)
UseImage(DeskTop)
StartDrawing(ImageOutput())
DrawImage(*DeskTop,0,0)
StopDrawing()
SaveImage(DeskTopSprite,FileName.s,#PB_ImagePlugin_BMP)
EndProcedure
SaveScreen("recdta\scr.bmp",50,50,300,200)
thanks! all of you!
Posted: Sat Mar 13, 2004 8:29 pm
by Kale
the files were only public for a couple of hrs
unfortunately thats all it takes!

Posted: Sat Mar 13, 2004 8:31 pm
by cykotic
In no way am I trying to disrespect you.. you seem to have a valid and truthful reason for it being there.. so it was an honest mistake.. no worries. It would be a different story if you came and replied saying "yea hehe.. thats me!" then my post would have been to confront you and in a way disrepect you and let the right people know. But like I said.. you seem to be a respectul/honest person and I fully believe your statement about this. So no hard feelings?

Posted: Sat Mar 13, 2004 8:34 pm
by Kale
Code: Select all
...
OpenClipboard_(#NULL)
EmptyClipboard_()
SetClipboardData_(2, BMPHandle)
CloseClipboard_()
...
Do you really need to also save the screenshot to the clipboard?
