Code:

hWnd = CreateWindow( L"3ngine", L"lars",
                              WS_OVERLAPPEDWINDOW, xPos, yPos, xSize, ySize,
							  NULL, NULL, wc.hInstance, NULL );

I want to make L"lars" variable. Searched on google, but i cant find the right answer.

Is there a simple solution?

thanks!

Oritm
Deleted Member

What's the problem? just replace that static text with a wchar_t* variable

TCHAR buf[] = L"lars";

hWnd = CreateWindow( L"3ngine",  buf,
                              WS_OVERLAPPEDWINDOW, xPos, yPos, xSize, ySize,
							  NULL, NULL, wc.hInstance, NULL );

What's the problem? just replace that static text with a wchar_t* variable

TCHAR buf[] = L"lars";

hWnd = CreateWindow( L"3ngine",  buf,
                              WS_OVERLAPPEDWINDOW, xPos, yPos, xSize, ySize,
							  NULL, NULL, wc.hInstance, NULL );

My function contains a string:

createWindow(string title);

Can i convert a string into a TCHAR?

Found another solution:

In function like:

void Window::createWindow()
{
...
            wc.lpszClassName = L"MyClass";
...
}

In your project (if your using visual studio) choose:
Unicode: "NOT SET" then use 'name.c_str'

void Window::createWindow(string name)
{
...
            wc.lpszClassName = name.c_str;
...
}

Thanks Alot!

Edited 7 Years Ago by Oritm: n/a

This article has been dead for over six months. Start a new discussion instead.