Thread: Help me, I am beginner at this......

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Help me, I am beginner at this......

    Code:
    
    #include <windows.h>
    
    #include "resource.h" 
    
    const char g_szClassName[] = "myWindowClass";
    
    BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	switch(Message)
    	{
    		case WM_INITDIALOG:
    
    		return TRUE;
    		case WM_COMMAND:
    			switch(LOWORD(wParam))
    			{
    				case IDOK:
    					EndDialog(hwnd, IDOK);
    				break;
    				case IDCANCEL:
    					EndDialog(hwnd, IDCANCEL);
    				break;
    			}
    		break;
    		default:
    			return FALSE;
    	}
    	return TRUE;
    }
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	switch(Message)
    	{
    		case WM_COMMAND:
    			switch(LOWORD(wParam))
    			{
    				case ID_FILE_EXIT:
    					PostMessage(hwnd, WM_CLOSE, 0, 0);
    				break;
    				case ID_HELP_ABOUT:
    				{
    					int ret = DialogBox(GetModuleHandle(NULL), 
    						MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
    					if(ret == IDOK){
    						MessageBox(hwnd, "Dialog exited with IDOK.", "Notice",
    							MB_OK | MB_ICONINFORMATION);
    					}
    					else if(ret == IDCANCEL){
    						MessageBox(hwnd, "Dialog exited with IDCANCEL.", "Notice",
    							MB_OK | MB_ICONINFORMATION);
    					}
    					else if(ret == -1){
    						MessageBox(hwnd, "Dialog failed!", "Error",
    							MB_OK | MB_ICONINFORMATION);
    					}
    				}
    				break;
    			}
    		break;
    		case WM_CLOSE:
    			DestroyWindow(hwnd);
    		break;
    		case WM_DESTROY:
    			PostQuitMessage(0);
    		break;
    		default:
    			return DefWindowProc(hwnd, Message, wParam, lParam);
    	}
    	return 0;
    }
    
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    	LPSTR lpCmdLine, int nCmdShow)
    {
    	WNDCLASSEX wc;
    	HWND hwnd;
    	MSG Msg;
    
    	wc.cbSize		 = sizeof(WNDCLASSEX);
    	wc.style		 = 0;
    	wc.lpfnWndProc	 = WndProc;
    	wc.cbClsExtra	 = 0;
    	wc.cbWndExtra	 = 0;
    	wc.hInstance	 = hInstance;
    	wc.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);
    	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
    	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    	wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MYMENU);
    	wc.lpszClassName = g_szClassName;
    	wc.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);
    
    	if(!RegisterClassEx(&wc))
    	{
    		MessageBox(NULL, "Window Registration Failed!", "Error!",
    			MB_ICONEXCLAMATION | MB_OK);
    		return 0;
    	}
    
    	hwnd = CreateWindowEx(
    		WS_EX_CLIENTEDGE,
    		g_szClassName,
    		"The title of my window",
    		WS_OVERLAPPEDWINDOW,
    		CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
    		NULL, NULL, hInstance, NULL);
    
    	if(hwnd == NULL)
    	{
    		MessageBox(NULL, "Window Creation Failed!", "Error!",
    			MB_ICONEXCLAMATION | MB_OK);
    		return 0;
    	}
    
    	ShowWindow(hwnd, nCmdShow);
    	UpdateWindow(hwnd);
    
    	while(GetMessage(&Msg, NULL, 0, 0))
    	{
    		TranslateMessage(&Msg);
    		DispatchMessage(&Msg);
    	}
    	return Msg.wParam;
    }



    I just want to know when after what is CALLBACK AboutDlgProc called..........Please I need help really bad
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    I think I got it........my God this stuff is hard!!!!!!!!
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    73
    Are you certain you have it now? This stuff is not meant to be hard. Are you learing this from a tutorial or just teaching yourself from a refrence? If it is the latter, get a good tutorial! Teaching yourself this is not really a viable option. Good luck!

  4. #4
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    I am using a book BTW. I thought this thread was long dead, but I guess you resurected it.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  5. #5
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    What book?

  6. #6
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    I was reading some about Windows from a Tutorial online, but I am learning from Isometric Game Programming With Direct X.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please Help Me with this beginner C++ Program!
    By ClearSights in forum C++ Programming
    Replies: 7
    Last Post: 09-24-2008, 10:22 AM
  2. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 11:48 AM
  3. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 02:02 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM