I can't work this out

This is a discussion on I can't work this out within the Windows Programming forums, part of the Platform Specific Boards category; This is my code: Code: #include <tchar.h> #include "resource.h" BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    109

    I can't work this out

    This is my code:

    Code:
    #include <tchar.h>
    #include "resource.h"
    
    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	switch (uMsg)
    	{
    	case WM_COMMAND:
    		return MainDialog_OnCommand(hWnd, LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
    
    	case WM_CLOSE:
    		EndDialog(hWnd, 0);
    		return TRUE;
    	}
    	return FALSE;
    }
    
    BOOL MainDialog_OnCommand(HWND hWnd, WORD wCommand, WORD wNotify, HWND hControl)
    {
    	switch (wCommand)
    	{
    	case IDOK:
    		MessageBox(hWnd, _T("Bye-bye world!"), _T("Sample Application"), MB_OK);
    
    		// fall through
    
    	case IDCANCEL:
    		EndDialog(hWnd, wCommand);
    		break;
    	}
    	return TRUE;
    }
    
    
    
    int _tmain(void)
    {
    	DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1),
    		NULL, (DLGPROC)MainDialogProc, 0);
    	return 0;
    }
    When I go to complie it it comes back with two warnings:

    dialog.c: 10 missing prototype for MainDialog_OnCommand

    and

    dialog.c: 20 declaration of 'MainDialog_OnCommand' does not match previous declaration at dialog.c: 10

    Please help me thanks
    Daniel Granger

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    put this line above MainDialogProc:

    BOOL MainDialog_OnCommand(HWND hWnd, WORD wCommand, WORD wNotify, HWND hControl);
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp returning 1...
    By Axel in forum C Programming
    Replies: 12
    Last Post: 09-08-2006, 07:48 PM
  2. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 10:50 AM
  3. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. DLL __cdecl doesnt seem to work?
    By Xei in forum C++ Programming
    Replies: 6
    Last Post: 08-21-2002, 04:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21