我看msdn上的是: 
BOOL CreateCompatibleBitmap( CDC* pDC, int nWidth, int nHeight ); 
可是看网上很多例子都是 
HDC = hDC; 
hDC = GetDC(0); 
bitmap.CreateCompatibleBitmap(hDC,.....) 
  
我用CDC*做第一的参数,总是出一个ASSERT错误啊! 
用HDC,则编译不通过:
error C2664: 'CreateCompatibleBitmap' : cannot convert parameter 1 from 'struct HDC__ *' to 'class CDC *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
哪位大侠知道怎么回事儿?

解决方案 »

  1.   

    SDK中的CreateCompatibleBitmap第一个参数是HDC
    而CBitmap的CreateCompatibleBitmap第一个参数是CDC
      

  2.   

    在vc里面的,是不是都不是SDK?
    我刚才发现
    HDC GetDC(
      HWND hWnd   // handle to a window
    );CDC* GetDC( );
    前面的那个也是SDK里面的了?
    缺省情况下,是不是都不是SDK?什么情况下是SDK?
      

  3.   

    如果调用sdk的话
    应该加::
      

  4.   

    ::GetDC()
    这样调用的是raw API
      

  5.   

    如果想用sdk,用::表示
    HBITMAP bBmp = ::CreateCompatibleBitmap(hDC);