wxWidgets实现屏幕拷贝

#include "wx/wx.h"

int main()
{
    wxImage::AddHandler(new wxBMPHandler);
    wxScreenDC DC;
    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 dirpath;
    dirpath += wxT("C:\\");
    dirpath += wxT("1.bmp");

    //保存文件
    bitmap.SaveFile(dirpath,wxBITMAP_TYPE_BMP);
    return 0;
}

 

from:http://axiii.blog.51cto.com/396236/192057

你可能感兴趣的:(wxwidgets)