-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScreenCaptureforHWND: How to get the byte data of the captured frame? #132
Comments
First, make sure you're setting the When frames come in they will be queued up, and calling TryGetNextFrame will give you a queued frame or block until it receives one. |
Oh, one more thing, you'll want to observe the |
Thanks so much for your reply! I've updated my code here based on your suggestions, but still can't capture the image. The OnFrameArrived function doesn't seem to be triggered. What should I do next? // add DXGICapture.lib to library
#include "pch.h"
#include <iostream>
#include "DXGICapture.h"
int main()
{
HWND hwnd = FindWindow(NULL, L"Ice.mp4 - PotPlayer");
if (hwnd == NULL)
{
std::cout << "FindWindow failed" << std::endl;
return 1;
}
auto cap = CreateCapture(hwnd);
StartCapture(cap);
BYTE* buffer = new BYTE[1920 * 1080 * 4];
Grab(cap, buffer);
// delay
Sleep(1000);
} |
Since you're calling |
I've built a DLL project to capture window screens, based on the ScreenCaptureforHWND example. However, all the frames I captured are zeros. How can I get the byte data?
Here's my capture code (repository here):
The text was updated successfully, but these errors were encountered: