First, I prepared the class blow :

class UserDefinedWindow
{
public:
	WNDCLASSEX WindowClass;
	
	DWORD	dwExStyle;
	LPCTSTR	lpClassName;
	LPCTSTR	lpWindowName;
	DWORD	dwStyle;
	int		x;
	int		y;
	int		nWidth;
	int		nHeight;
	HWND	hWndParent;
	HMENU	hMenu;
	HINSTANCE hProgInst;
	LPVOID	lpParam;
	char	ClassName[MAX_LOADSTRING];
    char	Caption[MAX_LOADSTRING];
	HWND	hWnd;
	
	UserDefinedWindow()
	{
		dwExStyle		= 0;			//These are default parameters for CreateWindowEx()
		lpClassName		= "ClassName";
		lpWindowName	= "Caption";
		dwStyle			= WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE;
		x				= 100;
		y				= 100;
		nWidth			= 100;
		nHeight			= 100;
		hWndParent		= HWND_DESKTOP;
		hMenu			= NULL;
		hProgInst		= hInstance;
		lpParam			= NULL;

		WindowClass.cbSize			= (UINT)	sizeof(WNDCLASSEX);		//Defaults for WNDCLASSEX
		WindowClass.style			= (UINT)	CS_DBLCLKS;
		WindowClass.lpfnWndProc		= (WNDPROC)	WindowProcedure;
		WindowClass.cbClsExtra		= (INT)		0;
		WindowClass.cbWndExtra		= (INT)		0;
		WindowClass.hInstance		= (HINSTANCE)	hProgInst;
		WindowClass.hIcon			= (HICON)	LoadIcon (NULL, IDI_APPLICATION);
		WindowClass.hCursor			= (HCURSOR)	LoadCursor (NULL, IDC_ARROW);
		WindowClass.hbrBackground	= (HBRUSH)	COLOR_BACKGROUND;
		WindowClass.lpszMenuName	= (LPCTSTR)	NULL;
		WindowClass.lpszClassName	= (LPCTSTR)	ClassName;
		WindowClass.hIconSm			= (HICON)	LoadIcon (NULL, IDI_APPLICATION);
	}
	void Create(void)
	{
		if (!RegisterClassEx(&WindowClass)) MessageBox(NULL, "Error registering.", "Error", MB_OK);
		hWnd = CreateWindowEx(	(DWORD)		dwExStyle,
								(LPCTSTR)	lpClassName,
								(LPCTSTR)	lpWindowName,
								(DWORD)		dwStyle,
								(int)		x,
								(int)		y,
								(int)		nWidth,
								(int)		nHeight,
								(HWND)		hWndParent,
								(HMENU)		hMenu,
								(HINSTANCE)	hProgInst,
    							(LPVOID)	lpParam);
	}
};

And the main() block of the program is...

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
	hInstance = hInst;
	UserDefinedWindow MainWnd;
	MainWnd.Create();
	
	while (GetMessage(&Msg, NULL, 0, 0))
	{
		TranslateMessage(&Msg);
		DispatchMessage(&Msg);
	}
	return (INT) Msg.wParam;
}

And finally the problem is, nothing appears. Program seems to be running, but no window appears on the screen. There is no errors or even warnings given.

Can you give an idea why the window doesn't pop up?

Notes
-----
-Compiler is Visual Studio 2005.
-I didn't use ShowWindow(), because WS_VISIBLE already exists in dwStyle.
-hInstance is global defined variable.

This part returns NULL.

hWnd = CreateWindowEx(	(DWORD)		dwExStyle,
								(LPCTSTR)	lpClassName,
								(LPCTSTR)	lpWindowName,
								(DWORD)		dwStyle,
								(int)		x,
								(int)		y,
								(int)		nWidth,
								(int)		nHeight,
								(HWND)		hWndParent,
								(HMENU)		hMenu,
								(HINSTANCE)	hProgInst,
    							(LPVOID)	lpParam);
		if ( hWnd == NULL )
		{
			MessageBox(NULL, "CreateWindow Returned NULL", "Error", MB_OK );
			return;
		}

Thanks for your help.
It OK now!

VOID ErrorTest(LPSTR lpzsErrorText);
VOID ErrorTest(INT nText);
class UserDefinedWindow
{
public:
	WNDCLASSEX WindowClass;
	
	DWORD	dwExStyle;
	//LPCTSTR	lpClassName;
	//LPCTSTR	lpWindowName;
	char	lpClassName[MAX_LOADSTRING];
    char	lpWindowName[MAX_LOADSTRING];
	DWORD	dwStyle;
	int		x;
	int		y;
	int		nWidth;
	int		nHeight;
	HWND	hWndParent;
	HMENU	hMenu;
	HINSTANCE hProgInst;
	LPVOID	lpParam;
	HWND	hWnd;
	
	UserDefinedWindow()
	{
		dwExStyle		= 0;			//These are default parameters for CreateWindowEx()
		strcpy(lpClassName, "ClassName");
		strcpy(lpWindowName, "Caption");
		dwStyle			= WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE;
		x				= 100;
		y				= 100;
		nWidth			= 200;
		nHeight			= 200;
		hWndParent		= HWND_DESKTOP;
		hMenu			= NULL;
		hProgInst		= hInstance;
		lpParam			= NULL;

		WindowClass.cbSize			= (UINT)	sizeof(WNDCLASSEX);		//Defaults for WNDCLASSEX
		WindowClass.style			= (UINT)	CS_DBLCLKS;
		WindowClass.lpfnWndProc		= (WNDPROC)	WindowProcedure;
		WindowClass.cbClsExtra		= (INT)		0;
		WindowClass.cbWndExtra		= (INT)		0;
		WindowClass.hInstance		= (HINSTANCE)	hProgInst;
		WindowClass.hIcon			= (HICON)	LoadIcon (NULL, IDI_APPLICATION);
		WindowClass.hCursor			= (HCURSOR)	LoadCursor (NULL, IDC_ARROW);
		WindowClass.hbrBackground	= (HBRUSH)	COLOR_BACKGROUND;
		WindowClass.lpszMenuName	= (LPCTSTR)	NULL;
		WindowClass.lpszClassName	= (LPCTSTR)	lpClassName;
		WindowClass.hIconSm			= (HICON)	LoadIcon (NULL, IDI_APPLICATION);
	}
	void Create(void)
	{
		if (!RegisterClassEx(&WindowClass)) MessageBox(NULL, "Error registering.", "Error", MB_OK);
		hWnd = CreateWindowEx(	(DWORD)		dwExStyle,
								(LPCTSTR)	lpClassName,
								(LPCTSTR)	lpWindowName,
								(DWORD)		dwStyle,
								(int)		x,
								(int)		y,
								(int)		nWidth,
								(int)		nHeight,
								(HWND)		hWndParent,
								(HMENU)		hMenu,
								(HINSTANCE)	hProgInst,
    							(LPVOID)	lpParam);
		if (hWnd == NULL)
		{
			//1407 Cannot find window class. ERROR_CANNOT_FIND_WND_CLASS
			DWORD ErrCode = GetLastError();
			MessageBox(NULL, "Error creating.", "Error", MB_OK);
			ErrorTest(ErrCode);
		}
	}
};
VOID ErrorTest(LPSTR lpzsErrorText)
{
	if (MessageBox(NULL, lpzsErrorText, "Error", MB_ICONERROR | MB_OKCANCEL)==IDCANCEL);//PostQuitMessage(0);
}
VOID ErrorTest(INT nText)
{
	CHAR lpzsErrorText[32];
	_itoa(nText, lpzsErrorText, 10);
	if (MessageBox(NULL, lpzsErrorText, "Error", MB_ICONERROR | MB_OKCANCEL)==IDCANCEL);//PostQuitMessage(0);
}

ClassName was defined as the name of the class, but in the WNDCLASSEX structure, lpClassName was used.
So, because of not matching the class names in WNDCLASSEX and CreateWindowEx(), the system returned the error :
Error Code :1407
Meaning :Cannot find window class.
Constant :ERROR_CANNOT_FIND_WND_CLASS

Now the code is error-free.

Peace...
Can anyone explain that more, step by step.

First, you read the date that conversation was initiated.
Second, you start a new thread, making sure you have done your part to follow the rules of posting.
Third, you link or point to the old conversation, if it is relevant to what you are going to ask.
Fourth, you ask in a clear and intelligent way, what your question is, and how you would like to obtain help.
Fifth, you wait patiently, for someone to be gracious enough to take the time to respond.
Sixth, you show gratitude, and mark the post solved if your problem has been resolved or question has been answered satisfactory.

[Disclaimer] Steps are only a guide to understanding, and not absolute
nor authoritative in nature. Differences in personality may or may not
lengthen or shorten the measure of the stride.

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