Sign in to follow this  

How can I fix this "error C2440: '=' : cannot convert from 'TCHAR *' to 'WCHAR [32]'"

Recommended Posts

I am having trouble with a variable that I am passing into a function...
//I am calling the "Create" function below like so
//Initalize Test Texture from file
m_Texture.Load(&m_Graphics, _T("test.bmp"));


// Create a font
bool cText::Create(cGraphics *Graphics, TCHAR *Name, int Size, bool Italic){

	if(Graphics == NULL || Name == NULL)
		return false;
	if(Graphics->GetDeviceCOM() == NULL)
		return false;

	// Set the font name and height
	lf.Height = Size;
	lf.Width  = 0;
	lf.Weight = 400;
	lf.MipLevels = 0;
	lf.Italic = Italic;
	lf.OutputPrecision = OUT_TT_PRECIS;
	lf.PitchAndFamily = DEFAULT_PITCH;
	lf.Italic = Italic;
	lf.FaceName = Name;
	//strcpy_s(lf.FaceName, Name);

	// Create the font object
	if(FAILED(D3DXCreateFontIndirect(Graphics->GetDeviceCOM(), &lf, &m_Font)))
		return false;

	return true;
This is producing error C2440: '=' : cannot convert from 'TCHAR *' to 'WCHAR [32]' Usually I can just use _T and TCHAR but the [32] seems to be getting in the way. I don't know. Any suggestion would help.... Regards Chad

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this