Page 2 of 3
					
				
				Posted: Mon Mar 15, 2004 10:47 pm
				by Kale
				Also, to be able to publish high quality pictures, I don't want to scale up an original screen resolution screen grab.... 
Impossible! Images can only be scaled down 'without' image quality loss, not scaled up to higher resolutions. If an image is scaled up a 'blurring' occurs.
 
			 
			
					
				
				Posted: Mon Mar 15, 2004 11:18 pm
				by dell_jockey
				Kale, 
for that very reason I stated that I don't want to scale up.  I'd like to see a solution that gives a much higher resolution bitmap, perhaps by re-rendering the selected window/control somewhere else in memory and then grab the image from that much larger presentation.
			 
			
					
				
				Posted: Tue Mar 16, 2004 12:19 am
				by Kale
				for that very reason I stated that I don't want to scale up. I'd like to see a solution that gives a much higher resolution bitmap
So its pointless taking a screen grap then. You will have to draw whatever you need.
 
			 
			
					
				
				Posted: Tue Mar 16, 2004 9:39 am
				by dagcrack
				How do you highlight the roll overed region (with the mouse, so you can capture that active region only) and it must be highlighted to better see.
			 
			
					
				
				Posted: Mon Apr 05, 2004 12:52 pm
				by dell_jockey
				Einander,
thank you for pointing out this redundancy: a control is a window too... 

 
			 
			
					
				
				Posted: Thu Dec 30, 2004 5:11 am
				by Shannara
				cecilcheah wrote:Hi there
Code: Select all
keybd_event_(#VK_SNAPSHOT,0,0,0) ; Snapshot of entire desktop.
looks like it does not work for win 95/98, it needs to be:
Code: Select all
keybd_event_(#VK_SNAPSHOT,1,0,0) ; Snapshot of entire desktop.
Anyone knows what about Win NT, Win 2000 or Win XP?
Cecil
 
Had to drag this up as I was looking for working screenshot code ... the above does not work because the snapshot thingie doesnt work some times 

 For example, at the time of this post the print screen function works for all windows that do not have a dx screen on them. So I have to find some alternate means of taking a screenshot and PB code that doesnt require the scrnprnt function works perfectly 
Anyways ...
The code provided here is missing the DEVMODE structure ... ... .. so they dont work.
 
			 
			
					
				
				Posted: Thu Dec 30, 2004 4:26 pm
				by Kale
				The code provided here is missing the DEVMODE structure ... ... .. so they dont work.
It should do, its defined in PB itself. press alt-s in the pb ide to see the predefined structures.
 
			 
			
					
				
				Posted: Sat Jan 01, 2005 3:44 am
				by Shannara
				Thanks for the info 

 Just a tip for the rest 

 If your taking a screenshot of just a window of yours, the following is required when taking the shot, or else the screenshot will cut off the window on the left and right. erk!
Notice, I am using winXP SP 2 on regular mode (no eye candy junk/theme).
Code: Select all
CaptureScreen(WindowX(),WindowY(),WindowWidth() + 5,WindowHeight() + 25)
Notice the + 5 and + 25 in the code.
 
			 
			
					
				
				Posted: Sat Jan 01, 2005 9:57 am
				by newbie
				To take a screenshot of all of the screen I use this line :
Code: Select all
 ScreenCaptureAddress = CaptureScreen(0, 0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN))
and it seems to take the whole desktop no matter the resolution (the easiest way I found to do so).
Thx to Kale for the code 

 
			 
			
					
				
				Posted: Mon Feb 14, 2005 8:05 am
				by J. Baker
				Trying to figure out how to capture the screen every few seconds. I know there's Delay() and ElapsedMilliseconds() but I'm not sure if these are the correct commands to use for this? At least I haven't had any success with them (probably my lack of knowledge with setting a timer in PB). Any help would be great, thanks.
			 
			
					
				
				Posted: Mon Feb 14, 2005 2:51 pm
				by Psychophanta
				Baker,
use Delay() function into a loop. It should work.
Kale,
A bitmap handle is a memory address?
			 
			
					
				
				Posted: Mon Feb 14, 2005 6:59 pm
				by Kale
				J. Baker wrote:Trying to figure out how to capture the screen every few seconds. I know there's Delay() and ElapsedMilliseconds() but I'm not sure if these are the correct commands to use for this? At least I haven't had any success with them (probably my lack of knowledge with setting a timer in PB). Any help would be great, thanks.
I would put all needed repeating code into a procedure then use:
Code: Select all
SetTimer_(WindowID(), #Timer, millisecs, @Procedure())
this then repeats the procedure at the millisec interval you specify. 

 
			 
			
					
				
				Posted: Mon Feb 14, 2005 7:53 pm
				by Psychophanta
				Code: Select all
ScreenCaptureAddress = CaptureScreen(192, 112, 256, 256)
Kale,
here you assign as "Address" to a "bitmap handle".
If you know what the hell is exactly internally a handle (named by microsoft), please tell us, else forget this.
 
			 
			
					
				Re: Screen Capture
				Posted: Thu Apr 25, 2019 11:19 am
				by rotacak
				This screengrabber is nice and works good. But only when you using it for capturing into clipboard. If you use the version from Kale, then there can be memory problem. Basically if you will remove that clipboard part then your memory is not released and still filling up. Not good when you want to repeatedly capture images.
I don't know why clipboard part can fix that.
Try this and look at your rising memory usage:
Code: Select all
Procedure CaptureScreen(Left, Top, Width, Height)
  dm.DEVMODE ;structure for CreateDC()
  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
Repeat
  CaptureScreen( 0, 0, 800, 600)
  Delay(1)
ForEver
Uncomment the clipboard part and try again. No memory usage is rising anymore. Why?
 
			 
			
					
				Re: Screen Capture
				Posted: Sat Mar 19, 2022 10:11 pm
				by doctorized
				In my case, "My computer" window is captured with some extra pixels. Why? See the image below. Win 10 Pro x64 fully updated
https://ibb.co/qdPggpj