Jump to content

DirectX (3D) ScreenCapture issues


Recommended Posts

I realize this should be pretty straight forward, but....

I need to be able to do a screen capture and save it to a file. Normally, the "_ScreenCapture_Capture" function would work just fine, except that it won't get Screen Images from the 3D screen (DirectX). However, the Windows "PrtScreen" function will get the associated screen image and put it into the clipboard just fine.

So I've got the {PrintScreen} keypress being sent from a function just fine. I can open the Clipboard contents with Windows Paint and I see the data is there. So it appears that 'Send("{PrintScreen}")' does the job of getting my image loaded into the clipboard OK!

I just can't seem to get the data in the clipboard saved into a file. I've tried all kinds of permutations of the following code, but it just seems I can not get the function to work. If someone could please tell me what I am doing wrong, it would surely be appreciated! (The following sample code runs from a hotkey function)

#include <ClipBoard.au3>
#Include <ScreenCapture.au3>


While 1

Func ScreenCapture()

    $hBitmap = _ClipBoard_GetData($CF_BITMAP)
;   $HBitmap = _ScreenCapture_Capture("") ; This works for 2D screen!
    _ScreenCapture_SaveImage("ScreenCap.bmp", $hBitmap)



Link to comment
Share on other sites

Updated Info:

The above code seems to work just fine on a Windows XP system but not on my Windows 7 (Ult-64) development platform. I've tried disabling my Anti-Virus but it appears to be something else. The "$hBitmap" handle in the code always comes back with a value of "0" on the Win7 machine. Its curious that the ScreenCapture_Capture function seems to work (but not for 3D screens).

Anyone have any ideas or suggested "code-a-rounds"?

Still Searching...

Link to comment
Share on other sites

In doing some "@error" analysis, it appears that the "_MemGlobalAlloc" call in "_ClipBoard_GetData" is failing under Win7-64 (@error = -4). I can't find any reference to anything related in the forums. Maybe its a 64 bit thing, maybe it has something to do with additional Win7 security. Anyone have any ideas or thoughts on how I should continue?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...