Amitava Choudhury
Amitava Choudhury

Reputation: 11

object declare in vc++

a.hbrBackground=GetStockObject(WHITE_BRUSH);

error: cannot convert from 'void *' to 'struct HBRUSH__ ' Conversion from 'void' to pointer to non-'void' requires an explicit cast

Cannot execute the above code in vc++

Please check the code.

Upvotes: 1

Views: 137

Answers (1)

Rup
Rup

Reputation: 34418

That's normal for GetStockObject. You just need to cast it

a.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);

Upvotes: 1

Related Questions