3 Replies - 2766 Views - Last Post: 07 March 2011 - 10:26 AM Rate Topic: -----

#1 marinus   User is offline

  • D.I.C Addict
  • member icon

Reputation: 138
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Error 1 error C2664: 'TextOutW' : cannot convert parameter 4 f

Posted 07 March 2011 - 09:34 AM

Hi all i was wondering WTF is this error C2664: 'TextOutW' : cannot convert parameter 4 from 'char' to 'LPCWSTR

Im learning C++ , but i cant undestand what this means , i have tried to google it but there is no good answers


I am getting it at the COMMENTED LINE

PAINTSTRUCT paintStruct;
	/*	Device Context*/
	HDC hDC; 
	/*	Text for display*/
	char string[] = "Hello, World!"; 
	/*	Switch message, condition that is met will execute*/
	switch(message)
	{
		/*	Window is being created*/
		case WM_CREATE: 
			return 0;
			break;
		/*	Window is closing*/
		case WM_CLOSE: 
			PostQuitMessage(0);
			return 0;
			break;
		/*	Window needs update*/
		case WM_PAINT: 
			hDC = BeginPaint(hwnd,&paintStruct);
			/*	Set txt color to blue*/
			SetTextColor(hDC, COLORREF(0x00FF0000));
		 	/*	Display text in middle of window*/
		    TextOut(hDC,150,150,string,sizeof(string)-1);//GETTING MY ERROR HERE 
			EndPaint(hwnd,&paintStruct);
			return 0;
			break;
		default:
			break;
	}
	return (DefWindowProc(hwnd,message,wParam,lParam));



and Idea

Thanks for the help :)

This post has been edited by marinus: 07 March 2011 - 09:36 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Error 1 error C2664: 'TextOutW' : cannot convert parameter 4 f

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: Error 1 error C2664: 'TextOutW' : cannot convert parameter 4 f

Posted 07 March 2011 - 09:45 AM

See the FAQs topic, scroll down to "Common Windows/Visual Studio Errors".
Was This Post Helpful? 1
  • +
  • -

#3 r.stiltskin   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2034
  • View blog
  • Posts: 5,436
  • Joined: 27-December 05

Re: Error 1 error C2664: 'TextOutW' : cannot convert parameter 4 f

Posted 07 March 2011 - 10:20 AM

Quote

... change the Character Set option to Use Multi-Byte Character Set or Not Set.


@JackOfAllTrades:

Just out of curiosity, would you please explain what that means in English (including the "or Not Set" part).

This post has been edited by r.stiltskin: 07 March 2011 - 10:21 AM

Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: Error 1 error C2664: 'TextOutW' : cannot convert parameter 4 f

Posted 07 March 2011 - 10:26 AM

There are three options: Use Unicode Character Set, Use Multi-Byte Character Set, and Not Set. I believe Not Set == ASCII (single-byte character set).
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1