How do I fix the following errors?

CDev-8220 220 Reputation points

I'm using the example code here, but getting errors in this area.

for (i = 0; i < CPENS; i++) {

phbmp[i] = CreateCompatibleBitmap(

hdcMain, wLineX, wLineY);

if (i == 0) {

hbmpOld = SelectObject(hdcLines, phbmp[i]);


else {

SelectObject(hdcLines, phbmp[i]);



hdcLines, 0, 0, crMenuClr, FLOODFILLBORDER);



phbmp[i] = CreateCompatibleBitmap(hdcMain, wLineX, wLineY);


no operator "=" matches these operands operand types are HBITMAP__=HBITMAP


hbmpOld = SelectObject(hdcLines, phbmp[i]);


a value of type "HGDIOBJ" cannot be assigned to an entity of type "HBITMAP" no suitable conversion function from "HBITMAP__" to "HGDIOBJ" exists

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,513 questions
{count} votes

Accepted answer
  1. Viorel 111.5K Reputation points

    Probably some characters were lost. To fix the first error, try to add “[ ]” to these parameters: HPEN phpen[], HBITMAP phbmp[].

    To fix the conversion problems, try to use HGDIOBJ instead of HBRUSH and HBITMAP for corresponding local variables, for example: HGDIOBJ hbmpOld.

    Maybe you can use the Feedback button to report the found documentation errors.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful