Member Avatar for Oritm

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!

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 );
Member Avatar for Oritm

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?

Member Avatar for Oritm

read this thread

Thanks again Ancient Dragon, your the best! :D

Member Avatar for Oritm

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.