15,896,545 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 11806482 (Top 3 by date)
Member 11806482
8-Jul-15 14:49pm
View
I also changed my code to this:
void captureScreenD3d()
{
UINT screenW = GetSystemMetrics(SM_CXSCREEN);
UINT screenH = GetSystemMetrics(SM_CYSCREEN);
IDirect3DSurface9* pbackBuffer;
d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pbackBuffer, NULL);
d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pbackBuffer);
D3DXSaveSurfaceToFile(L"screen.bmp", D3DXIFF_BMP, pbackBuffer, NULL, NULL);
pbackBuffer->Release();
}
Now it returns a black screen for every application, not just fullscreen games. Initial GetFrontBuffer worked fine for everything else. Just returned blackscreen for fullscreen games.
What am I doing wrong here?
Member 11806482
8-Jul-15 14:12pm
View
So I should change d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pSurface, NULL); to d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &pSurface, NULL); ?
I also changed it to
d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, NULL);
I did this. But it is still returning a black screen. I apologize if I am sounding novice and I interpreted your solution incorrectly. I am new to DirectX programming.
Member 11806482
8-Jul-15 4:00am
View
I am also trying to write a screencapture application.
I hope you figured out how to get rid of the black screen by now.
[Here](http://stackoverflow.com/q/31286503/4794952) is a link to my problem. I am presently using GetFrontBufferData. If the solution given above worked for you please let me know.