wxWidgets 101 - 14 Easiest Way to Capture the Screen

wxSize screenSize = wxGetDisplaySize();
wxBitmap bitmap(screenSize.x, screenSize.y);
wxScreenDC dc;
wxMemoryDC memDC;
memDC.SelectObject(bitmap);
memDC.Blit(0, 0, screenSize.x, screenSize.y, &dc, 0, 0);
memDC.SelectObject(wxNullBitmap);
wxString fname = wxFileName::CreateTempFileName(wxT("screenshot"));
bitmap.SaveFile(fname, wxBITMAP_TYPE_PNG);

你可能感兴趣的:(wxWidgets 101 - 14 Easiest Way to Capture the Screen)