I have this code:

HWND handle = CreateWindowExA(0,name,name,
		WS_POPUP+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_SYSMENU+WS_CAPTION,
		0x13D,0x86, // x y
		0x320,0x258, // width height
		0,0,hInst,0);

But my window's name only contains one letter oO My final window name is "W"...

what am I doing wrong?

It's pretty difficult to say since you don't tell us what type "name" is or what value it contains. I also notice that you're using the same variable for the window class and the window title. Is this what you intended?

LPCSTR Name = "Window";

Just this.

There's nothing wrong with the call itself, though I wonder why you're calling the ANSI version explicitly. How is the window class registered?

WNDCLASSEX wc;
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style=0;
	wc.cbClsExtra = 0;
	wc.lpfnWndProc = (WNDPROC)0x414820;
	wc.cbWndExtra = 0;
	wc.hInstance=hInst;
	HICON icon = LoadIconA(hInst,(LPCSTR)111);
	wc.hIcon = icon;
	wc.hIconSm = icon;
	wc.hCursor = LoadCursor(NULL,IDC_ARROW);
	wc.hbrBackground =(HBRUSH)GetStockObject(BLACK_BRUSH);
	wc.lpszMenuName = NULL;
	wc.lpszClassName = TEXT("Window");
	RegisterClassEx(&wc);

I'm using VS 2010, but it works fine with C++ 6.0 or DevC++. But I dont want to use them.

Solved.
RegisterClassA(&wc);

:P Thanks;

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.