我在1024*768分辨率,24为真彩色的下调用::GetDC没有问题,但是在1280*1024,256色下调用::GetDC失败!请问这是什么原因?如何解决?

解决方案 »

  1.   

    Res
    The GetDC function retrieves a common, class, or private DC depending on the class style specified for the specified window. For common DCs, GetDC assigns default attributes to the DC each time it is retrieved. For class and private DCs, GetDC leaves the previously assigned attributes unchanged. Note that the handle to the DC can only be used by a single thread at any one time.After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do not have to be released. ReleaseDC must be called from the same thread that called GetDC. The number of DCs is limited only by available memory. Windows 95/98: There are only 5 common DCs available per thread, thus failure to release a DC can prevent other applications from accessing one.
      

  2.   

    Windows NT/2000: To get extended error information, call GetLastError.
    _________
    首先看看是什么错误.After painting with a common DC, the ReleaseDC function must be called to release the DC.
    ___________
    所有的DC都释放了吗?
    Windows 95/98: There are only 5 common DCs available per thread
    __________
    达到这个限制了没有?
      

  3.   

    所有的DC都释放了吗?
    There are limited DC's in windows system.
      

  4.   

    我这里用的都是1280*1024@24色GetDC没问题,应该试试楼上几为的
      

  5.   

    不好意思,今天才来!
    我忘了说明一点,我的程序不能正常获取dc的时候就崩溃了,出现严重的内存错误!所以我也不能GetLastError。
    同时我觉得超过5个dc的情况也不会出现的。主要是前一次和后一次的操作完全一致。