Hello all
How do you let the program to push a key while playing a full screen game? Iv'e been trying with keybd_event but did not succeed?
Thank you
			
			
									
									
						Press key while on a full screen game
Re: Press key while on a full screen game
use ExamineKeyboard() and KeyboardPushed(#PB_Key_whatever) in you eventloop
an examples resides in pb-help under sprite , named sprite.pb
			
			
									
									an examples resides in pb-help under sprite , named sprite.pb
사십 둘 .
						- Rook Zimbabwe
 - Addict

 - Posts: 4322
 - Joined: Tue Jan 02, 2007 8:16 pm
 - Location: Cypress TX
 - Contact:
 
Re: Press key while on a full screen game
I have a similar problem... I wanna take a screenshot but I can't out to the capture program while running my game... have to take a bad photo of my computer screen... very lame solution!  
			
			
									
									
						Re: Press key while on a full screen game
bobobo: Not my own program. While another program is runnning.
Rook: I think this works, while having a full screen program runnning:I think it says that Kale / Droopy made it.
			
			
									
									
						Rook: I think this works, while having a full screen program runnning:
Code: Select all
;/ Author : Kale / Droopy
; Return pointer to BMP SnapShot
Global CaptureScreenWidth , CaptureScreenHeight , CaptureScreenBMPHandle
Procedure CaptureScreenPart(Left.l, Top.l, Width.l, Height.l)
  dm.DEVMODE
  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)
  DeleteDC_( trgDC)
  ReleaseDC_( BMPHandle, srcDC)
 
  CaptureScreenHeight=Height
  CaptureScreenWidth=Width
  CaptureScreenBMPHandle=BMPHandle
  ProcedureReturn BMPHandle
EndProcedure
Procedure CaptureFullScreen()
  ProcedureReturn CaptureScreenPart(0,0,GetSystemMetrics_(#SM_CXSCREEN),GetSystemMetrics_(#SM_CYSCREEN))
EndProcedure
Procedure CaptureWindow(Handle.l) ; ### The Window must be visible !
    If Handle
      WindowSize.RECT
      GetWindowRect_(Handle, @WindowSize)
      ProcedureReturn CaptureScreenPart(WindowSize\Left, WindowSize\Top, WindowSize\Right - WindowSize\Left, WindowSize\Bottom - WindowSize\Top)
    EndIf
   
EndProcedure
; #PB_ImagePlugin_BMP / #PB_ImagePlugin_JPEG / #PB_ImagePlugin_PNG
; JpegCompression 0 (Bad) to 10 (Best) --> Only for Jpeg
Procedure SaveCapture(File.s, ImagePlugin , JpegCompression)
 
  If CaptureScreenBMPHandle
    Id=CreateImage(#PB_Any, CaptureScreenWidth, CaptureScreenHeight)
    StartDrawing(ImageOutput(Id))
    DrawImage(CaptureScreenBMPHandle,0,0)
    StopDrawing()
   
    Select ImagePlugin
     
      Case #PB_ImagePlugin_JPEG
        UseJPEGImageEncoder()
        Retour=SaveImage(Id, File,#PB_ImagePlugin_JPEG,JpegCompression)
       
      Case #PB_ImagePlugin_PNG
        UsePNGImageEncoder()
        Retour=SaveImage(Id, File,#PB_ImagePlugin_PNG)
       
      Default
        Retour=SaveImage(Id, File)
       
    EndSelect
    FreeImage(Id)
   
  EndIf
 
  ProcedureReturn Retour
EndProcedure
;/ Test
CaptureFullScreen()
SaveCapture("c:\CaptureFullScreen.png",#PB_ImagePlugin_PNG,0)
SaveCapture("c:\CaptureFullScreen.bmp",#PB_ImagePlugin_BMP,0)
SaveCapture("c:\CaptureFullScreen.Jpg",#PB_ImagePlugin_JPEG,10)- 
				Zach
 - Addict

 - Posts: 1677
 - Joined: Sun Dec 12, 2010 12:36 am
 - Location: Somewhere in the midwest
 - Contact:
 
Re: Press key while on a full screen game
Most capture programs allow you to set hotkey combos... that should work?Rook Zimbabwe wrote:I have a similar problem... I wanna take a screenshot but I can't out to the capture program while running my game... have to take a bad photo of my computer screen... very lame solution!


