Printscreen on Windows 7
Printscreen on Windows 7
I'm using the following to take a printscreen to the clipboard. It seems as this isn't working anymore on Windows 7.
DLLFUNCTION keybd_event(mvkey,nscan,flags,xtra) USING STDCALL FROM USER32.DLL
PROCEDURE PrintScreen()
keybd_event(PS_SNAPSHOT,1,0,0)
RETURN
After calling this procedure, the screendump was saved to the clipboard. On Windows 7 this is a big black bitmap.
Anyone who has a printscreen which is doing the same and working on Windows7?
DLLFUNCTION keybd_event(mvkey,nscan,flags,xtra) USING STDCALL FROM USER32.DLL
PROCEDURE PrintScreen()
keybd_event(PS_SNAPSHOT,1,0,0)
RETURN
After calling this procedure, the screendump was saved to the clipboard. On Windows 7 this is a big black bitmap.
Anyone who has a printscreen which is doing the same and working on Windows7?
Re: Printscreen on Windows 7
Chris -
Try this. I tested it on XP. I don't have my Win 7 computer here at the moment, but I suspect it will work.
Roger
Try this. I tested it on XP. I don't have my Win 7 computer here at the moment, but I suspect it will work.
Roger
Code: Select all
FUNCTION Main()
SaveScreen2Clipboard()
RETURN nil
PROC appsys ; return
FUNCTION SaveScreen2ClipBoard()
LOCAL oBitmap, oXbp, oSourcePS, oClipBoard
oXbp := AppDeskTop()
oSourcePS := oXbp:LockPS()
oBitmap := GraSaveScreen( oSourcePS, {0,0}, oXbp:currentSize() )
oClipBoard := XbpClipBoard():new():create()
oClipBoard:open()
oClipBoard:setBuffer(oBitMap)
oClipBoard:close()
oClipBoard:destroy()
RETURN nil
The eXpress train is coming - and it has more cars.
Re: Printscreen on Windows 7
Hi Roger,
No, this isn't working on my Windows 7 64 Bit. The result is a black window.
On my XP it is working without problem.
No, this isn't working on my Windows 7 64 Bit. The result is a black window.
On my XP it is working without problem.
Re: Printscreen on Windows 7
hi,
did you have a "clipbrd.exe" on your Win7 PC ?
i have test Roger´s Code, but no Luck under Win7 32bit
btw. if i "press" PrintScreen it work
while GraSaveScreen() is just a UDF, here Code i use[/code]
oBitmap:presSpace( oTargetPS )
oBitmap:make( aSize[1], aSize[2] )
GraBitBlt( oTargetPS, oSourcePS, aTargetRect, aSourceRect )
RETURN oBitmap[/code]
edit : sorry i have to correct, Roger´s Code does get "manuell" PrintScreen into "clipbrd.exe"
this Code does work on my Win7 32bit
edit : correction ... "sometimes" it work ... depends on how many "Windows" i have open ...
... hm .. a SLEEP(100) between keybd_event() and SaveScreen2Clipboard() "seems" to help
did you have a "clipbrd.exe" on your Win7 PC ?
i have test Roger´s Code, but no Luck under Win7 32bit
btw. if i "press" PrintScreen it work
while GraSaveScreen() is just a UDF, here Code i use
Code: Select all
FUNCTION GraSaveScreen( oSourcePS, aPos, aSize )
L[code]OCAL oBitmap := XbpBitmap():new():create( oSourcePS )
LOCAL oTargetPS := XbpPresSpace():new():create()
LOCAL aSourceRect[4], aTargetRect
aSourceRect[1] := aSourceRect[3] := aPos[1]
aSourceRect[2] := aSourceRect[4] := aPos[2]
aSourceRect[3] += aSize[1]
aSourceRect[4] += aSize[2]
aTargetRect := {0, 0, aSize[1], aSize[2]} [code]
oBitmap:presSpace( oTargetPS )
oBitmap:make( aSize[1], aSize[2] )
GraBitBlt( oTargetPS, oSourcePS, aTargetRect, aSourceRect )
RETURN oBitmap[/code]
edit : sorry i have to correct, Roger´s Code does get "manuell" PrintScreen into "clipbrd.exe"
this Code does work on my Win7 32bit
Code: Select all
#INCLUDE "xbp.ch"
#INCLUDE "Gra.ch"
#INCLUDE "DLL.ch"
#INCLUDE "Appevent.ch"
#define VK_SNAPSHOT 0x2C
#define KEYEVENTF_KEYUP 0x2
DLLFUNCTION keybd_event(mvkey,nscan,flags,xtra) USING STDCALL FROM USER32.DLL
FUNCTION Main()
keybd_event(VK_SNAPSHOT, 0, 0, 0)
keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0)
* keybd_event(VK_SNAPSHOT,1,0,0)
SLEEP(100)
SaveScreen2Clipboard()
RETURN nil
PROC appsys ; return
... hm .. a SLEEP(100) between keybd_event() and SaveScreen2Clipboard() "seems" to help
greetings by OHR
Jimmy
Jimmy
Re: Printscreen on Windows 7
Hi Jimmy,
No, it isn't working on My Windows 7 64 Bit.
No, it isn't working on My Windows 7 64 Bit.
Re: Printscreen on Windows 7
as i say : did you have "Clipbrd.exe" on your PC ?skiman wrote:No, it isn't working on My Windows 7 64 Bit.
greetings by OHR
Jimmy
Jimmy
Re: Printscreen on Windows 7
Hi,
When I press printscreen and do a paste in Paint, the window appears. So I suppose it should work.
Anyway, I can't ask this kind of questions to my customers. I thought that there would be an easy solution for this rather simple task. It seems as it is not that simple.
When I press printscreen and do a paste in Paint, the window appears. So I suppose it should work.
Anyway, I can't ask this kind of questions to my customers. I thought that there would be an easy solution for this rather simple task. It seems as it is not that simple.
Re: Printscreen on Windows 7
i know this, but i "think" it is not the same as XbpClipBoard()skiman wrote:When I press printscreen and do a paste in Paint, the window appears. So I suppose it should work.
as i say i have download "Clipbrd.RAR" for some Reason and this work for me.
to verify i must deinstall it so try it yourself on your Machine.
greetings by OHR
Jimmy
Jimmy
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Printscreen on Windows 7
I will test on my Win7 64bit program and my print screen to printer process I use. I think it works but will validate just to be certain.
Cliff.
Cliff.
Re: Printscreen on Windows 7
Hi Cliff,
Have you found some time to test your printscreen function?
Have you found some time to test your printscreen function?