Click here to Skip to main content
15,881,248 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Helper Wanted Pin
Michael Schubert4-Oct-09 5:19
Michael Schubert4-Oct-09 5:19 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre4-Oct-09 5:23
MrMcIntyre4-Oct-09 5:23 
GeneralRe: C++ Helper Wanted Pin
Michael Schubert4-Oct-09 5:34
Michael Schubert4-Oct-09 5:34 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre4-Oct-09 5:39
MrMcIntyre4-Oct-09 5:39 
GeneralRe: C++ Helper Wanted Pin
Maximilien4-Oct-09 5:58
Maximilien4-Oct-09 5:58 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre4-Oct-09 6:09
MrMcIntyre4-Oct-09 6:09 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre4-Oct-09 7:11
MrMcIntyre4-Oct-09 7:11 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre4-Oct-09 7:19
MrMcIntyre4-Oct-09 7:19 
When I wrote the code I had 1 failed error. Here the code for the Client, and if someone could tell me what I have done wrong.

#include <windows.h><br />
<br />
const char g_szClassName[] = "MyProject";<br />
<br />
//Step 4: The Window Procedure<br />
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
	switch(msg)<br />
	{<br />
	case WM_CLOSE:<br />
		DestroyWindow(hwnd);<br />
		break;<br />
	case WM_DESTROY:<br />
		PostQuitMessage(0);<br />
		default;<br />
			return DefWindowProc(hwnd, msg, wParam, lParam);<br />
	}<br />
	return 0;<br />
}<br />
<br />
	int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,<br />
		LPSTR lpCmdLine, int nCmdShow)<br />
	{<br />
		WNDCLASSEX wc;<br />
		HWND hwnd;<br />
		MSG Msg;<br />
<br />
		//Step 1: Registering the Window Class<br />
		wc.cbSize			= sizeof (WNDCLASSEX);<br />
		wb.style			= 0;<br />
		wc.lpfnWndProc		= WndProc;<br />
		wc.cbClsExtra		= 0;<br />
		wc.cbWndExtra		= 0;<br />
		wc.hInstance		= hInstance;<br />
		wc.hIcon			= LoadIcon(NULL, IDI_APPLICATION);<br />
		wc.hCursor			= LoadCursor(NULL, IDC_ARROW);<br />
		wc.hbrBackground	= (HBRUSH) (COLOR_WINDOW+1);<br />
		wc.lpszMenuName		= NULL;<br />
		wc.lpszClassName	= g_szClassName;<br />
		wc.hIconSm			= LoadIcon(NULL, IDI_APPLICATION);<br />
<br />
		if(!RegisterClassEx(&wc))<br />
		{<br />
			MessageBox(NULL, "Window Registration Failed!", "Error",<br />
				MB_ICONEXCLAMATION | MB_OK);<br />
			return 0;<br />
		}<br />
<br />
		//Step 2: Creating the Window<br />
		hwnd = CreateWindowEx(<br />
			WS_EX_CLIENTEDGE,<br />
			g_szClassName,<br />
			"The title of my window",<br />
			WS_OVERLAPPEDWINDOW,<br />
			CW_USERDEFAULT, CS_USERDEFAULT, 903, 729,<br />
			NULL, NULL, hInstance, NULL);<br />
<br />
		if(hwnd == NULL)<br />
		{<br />
			MessageBox(NULL, "Window Creation Failed", "Error!",<br />
				MB_ICONEXCLAMAION | MB_OK);<br />
			return 0;<br />
		}<br />
<br />
		ShowWindow(hwnd, nCmdShow);<br />
		UpdateWindow(hwnd);<br />
<br />
		//Step 3: The Messag Loop<br />
		while(GetMessage(&Msg, NULL, 0,0) > 0)<br />
		{<br />
			TranslateMessage(&Msg);<br />
			DispatchMessage(&Msg);<br />
		}<br />
		return Msg.wParam;<br />
	}<br />


Thanks.

Andrew McIntyre

GeneralRe: C++ Helper Wanted [modified] Pin
Michael Schubert4-Oct-09 11:33
Michael Schubert4-Oct-09 11:33 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre4-Oct-09 11:51
MrMcIntyre4-Oct-09 11:51 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre5-Oct-09 9:57
MrMcIntyre5-Oct-09 9:57 
QuestionRe: C++ Helper Wanted Pin
David Crow5-Oct-09 10:09
David Crow5-Oct-09 10:09 
AnswerRe: C++ Helper Wanted Pin
MrMcIntyre5-Oct-09 10:16
MrMcIntyre5-Oct-09 10:16 
GeneralRe: C++ Helper Wanted Pin
David Crow5-Oct-09 10:19
David Crow5-Oct-09 10:19 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre5-Oct-09 10:21
MrMcIntyre5-Oct-09 10:21 
GeneralRe: C++ Helper Wanted Pin
Richard MacCutchan5-Oct-09 10:44
mveRichard MacCutchan5-Oct-09 10:44 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre5-Oct-09 10:52
MrMcIntyre5-Oct-09 10:52 
GeneralRe: C++ Helper Wanted Pin
Richard MacCutchan5-Oct-09 11:32
mveRichard MacCutchan5-Oct-09 11:32 
AnswerRe: C++ Helper Wanted Pin
David Crow5-Oct-09 10:31
David Crow5-Oct-09 10:31 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre5-Oct-09 10:37
MrMcIntyre5-Oct-09 10:37 
GeneralRe: C++ Helper Wanted Pin
David Crow6-Oct-09 2:19
David Crow6-Oct-09 2:19 
AnswerRe: C++ Helper Wanted Pin
Richard MacCutchan6-Oct-09 3:08
mveRichard MacCutchan6-Oct-09 3:08 
GeneralRe: C++ Helper Wanted Pin
MrMcIntyre6-Oct-09 5:25
MrMcIntyre6-Oct-09 5:25 
GeneralRe: C++ Helper Wanted Pin
Richard MacCutchan6-Oct-09 5:49
mveRichard MacCutchan6-Oct-09 5:49 
GeneralRe: C++ Helper Wanted Pin
Big Daddy Farang6-Oct-09 8:22
Big Daddy Farang6-Oct-09 8:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.