Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help on: error C2664: cannot convert from type1 to type2

Status
Not open for further replies.

sedawk

Programmer
Joined
Feb 5, 2002
Messages
247
Location
US
Hi,

Thanks for all the inputs to my post about detecting downloadable links. I will try the last two posts.

Now I am using VC++ 6 to compile a program written in VC++ 4. The code should be ok in VC++ 4. However, when I compiled it, I got error C2664:

error C2664: 'DrawTextW' : cannot convert parameter 2 from 'char *' to 'const unsigned short *'

I read MSDN about C2664, it says it is about the conversion from earlier version of VC and read more info from an tech paper. But I don't understand how to fix it.

Anyone has experience about fixing this old --> new conversion?

Thanks
 
In your case, it is not that bad. Where the issue is not with the types but the unsigned (I believe). Try casting it as an unsigned char* and see what happens.

matt
 
The source line caused problem is like this:

DrawText( hDC, &szStr, -1, &rc, DT_RIGHT | DT_BOTTOM | DT_SINGLELINE);

Why the problem happened at parameter 2?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top