开发者

please detect the Visual c++ error [closed]

开发者 https://www.devze.com 2023-01-06 03:37 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.
case WM_LBUTTONDOWN:
    x1=LOWORD(z);
    y1=HIWORD(z);
    d=GetDC (w);
    TextOut(d,x1,y1,"AMITA",6);
    ReleaseDC (w,&d);
    break;

Error:: error C2664: 'ReleaseDC' : canno开发者_开发知识库t convert parameter 2
    from 'struct HDC__ ** ' to 'struct HDC__ *


ReleaseDC (w,&d); should be ReleaseDC (w,d);


Use:

ReleaseDC (w,d);

instead.

It's because GetDC returns an HDC and ReleaseDC is expecting an HDC as well, but you're giving it the address of your HDC.

Cannot convert from X** to X* and Cannot convert from X* to X** are two of the canonical error messages you will hopefully be able to spot immediately at some point in your life :-) It's almost always the same problem (too many, or too few, levels of indirection).

0

精彩评论

暂无评论...
验证码 换一张
取 消