程序在WIN10下运行正常,win7下发现是复制DDB函数是空白的,高手指教?

void CopyBitmap(HWND hwnd, HBITMAP* Dbmp, const HBITMAP* Sbmp)
{
    char* bits = nullptr;
    static BITMAP bm;
    TCHAR Error[MAX_PATH];
    GetObject(*Sbmp, sizeof(BITMAP), &bm); 
    unsigned bitsize = bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
    try
    {
        bits = new char[bitsize];
    }
    catch (const std::exception& e)
    {
        auto len = MultiByteToWideChar(CP_ACP, 0, e.what(), -1, Error, MAX_PATH);
        Error[len] = '\0';  
        MessageBox(hwnd, Error, NULL, MB_OK);
        return;
    }
    GetBitmapBits(*Sbmp, bitsize, bits);
    *Dbmp = CreateBitmapIndirect(&bm);
    SetBitmapBits(*Dbmp, bitsize, bits);
    delete[]bits;    
}