I've tried making a programme in Windows but the problem is that DestroyWindow() isn't working on my buttons when i put it in wm_command:. There is a main menu and when you click on the options like continue i wanted the main menu buttons to be deleted but they don't get deleted.

Code:
#include <windows.h>




LRESULT CALLBACK WindProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

HINSTANCE hInstGlobal;

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nCmdShow)
{
    hInstGlobal = hInstance;
    WNDCLASSEX  WndCls;
    static char szAppName[] = "Kazalio Studios";
    MSG         Msg;

    WndCls.cbSize        = sizeof(WndCls);
    WndCls.style         = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
    WndCls.lpfnWndProc   = WindProcedure;
    WndCls.cbClsExtra    = 0;
    WndCls.cbWndExtra    = 0;
    WndCls.hInstance     = hInstance;
    WndCls.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    WndCls.hCursor       = LoadCursor(NULL, IDC_ARROW);
    WndCls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    WndCls.lpszMenuName  = NULL;
    WndCls.lpszClassName = szAppName;
    WndCls.hIconSm       = LoadIcon(hInstance, IDI_APPLICATION);
    RegisterClassEx(&WndCls);

    CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
                   szAppName, "Dog Simulator 2",
                   WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                   CW_USEDEFAULT, CW_USEDEFAULT, 600, 400,
                   NULL, NULL, hInstance, NULL);

    while( GetMessage(&Msg, NULL, 0, 0) )
    {
        TranslateMessage(&Msg);
        DispatchMessage( &Msg);
    }

    return static_cast<int>(Msg.wParam);
}


void dogname(HWND hWnd, WPARAM wParam, LPARAM lParam);
void credits(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void startscrn(HWND hWnd, WPARAM wParam, LPARAM lParam);
void dogmenu(HWND hWnd, WPARAM wParam, LPARAM lParam);

HWND hName, hNamecont;







LRESULT CALLBACK WindProcedure(HWND hWnd, UINT Msg,
                               WPARAM wParam, LPARAM lParam)
{
    HDC         hDC;
    PAINTSTRUCT Ps;
    HFONT	    font;
    static BITMAPFILEHEADER *pbmfh;
    static BITMAPINFO *pbmi;
    static BYTE *pBits;
    static int cxDib, cyDib;


    switch(Msg)
    {
               
    case WM_CREATE:
         
         
         
         

         
         
         HWND hContinue, hExit, hCredits;
         hContinue = CreateWindow ( "Button", "Continue",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    10, 320, 140, 20,
                                    hWnd, (HMENU) 1,
                                    hInstGlobal, NULL );
         hExit = CreateWindow     ( "Button", "Exit",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    437, 320, 140, 20,
                                    hWnd, (HMENU) 2,
                                    hInstGlobal, NULL);
         hCredits = CreateWindow  ( "Button", "Credits",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    225, 320, 140, 20,
                                    hWnd, (HMENU) 3,
                                    hInstGlobal, NULL);
                                    
         
         return 0;
    case WM_COMMAND:
         if (HIWORD(wParam) == BN_CLICKED)
         {
            if(LOWORD(wParam) == 1)
            {
                DestroyWindow(hCredits);              
            dogname(hWnd, wParam, lParam);
                             
            }
             
            if(LOWORD(wParam) == 2)
            {
               SendMessage (GetParent((HWND)lParam),
               WM_DESTROY, 0, 0);
               }
            if(LOWORD(wParam) == 3)
            {
                              
                              DestroyWindow( hExit );
            credits(hWnd, Msg, wParam, lParam);
            }
            
            if (LOWORD(wParam) == 5)
            {
            startscrn(hWnd, wParam, lParam);
            }
            
            if (LOWORD(wParam) == 4)
            {
            startscrn(hWnd, wParam, lParam);
            }
               }
            return 0;
                            
    case WM_PAINT:
       DWORD dwFileSize, dwHighSize, dwBytesRead;
         HANDLE hFile;
         hFile = CreateFile ("E:\\and.bmp",GENERIC_READ,
                             FILE_SHARE_READ, NULL,
                             OPEN_EXISTING,
                             FILE_FLAG_SEQUENTIAL_SCAN,
                             NULL);
                             
         dwFileSize = GetFileSize (hFile, &dwHighSize);
         pbmfh = (BITMAPFILEHEADER *) malloc (dwFileSize);
         ReadFile (hFile, pbmfh, dwFileSize, &dwBytesRead, NULL);
         pbmi = (BITMAPINFO *) (pbmfh + 1);
         pBits = (BYTE *) pbmfh + pbmfh->bfOffBits;
         cxDib = pbmi->bmiHeader.biWidth;
         cyDib = abs (pbmi->bmiHeader.biHeight);
         HDC hdc;
         hdc = GetDC (hWnd);
         
         SetDIBitsToDevice ( hdc,
                           200,
                           195,
                           cxDib,
                           cyDib,
                           
                           0,
                           0,
                           0,
                           cyDib,
                           pBits,
                           pbmi,
                           DIB_RGB_COLORS);
         ReleaseDC (hWnd, hdc);
         free (pbmfh);  
         
         
	hDC = BeginPaint(hWnd, &Ps);
		
         font = CreateFont(90,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Adolescence");

        SelectObject(hDC, font);
        TextOut(hDC, 22, 0, "Dog Simulator 2", 15);
        DeleteObject(font);
        
        font = CreateFont(18,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Arial");

        SelectObject(hDC, font);
        TextOut(hDC, 13, 115, "Welcome to Dog Simulator 2 the sequel to Dog Simulator 1 from Kazalio Studios.", 78);
        TextOut(hDC, 13, 135, "There are a few differences between dog Simulator 1 and Dog Simulator 2, the ", 77);
        TextOut(hDC, 13, 155, "main one being that Dog Simulator 2 is now in a window and has fonts and ",72);
        TextOut(hDC, 13, 175, "graphics to make it look better. There are also more things to do with your", 75);
        TextOut(hDC, 13, 195, "dog.", 4);
        DeleteObject(font);

	EndPaint(hWnd, &Ps);
	break;
    case WM_DESTROY:
	PostQuitMessage(WM_QUIT);
	break;
    default:
	return DefWindowProc(hWnd, Msg, wParam, lParam);
    }
    return 0;
}

void startscrn (HWND hWnd, WPARAM wParam, LPARAM lParam)
{
     
     
     HDC hDC;
     PAINTSTRUCT Ps;
     HFONT font;
     hDC = GetDC (GetParent((HWND) lParam));
		Rectangle (hDC, 0, 0, 600, 460);
         font = CreateFont(90,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Adolescence");

        SelectObject(hDC, font);
        TextOut(hDC, 22, 0, "Dog Simulator 2", 15);
        DeleteObject(font);
        
        font = CreateFont(18,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Arial");

        SelectObject(hDC, font);
        TextOut(hDC, 13, 115, "Welcome to Dog Simulator 2 the sequel to Dog Simulator 1 from Kazalio Studios.", 78);
        TextOut(hDC, 13, 135, "There are a few differences between dog Simulator 1 and Dog Simulator 2, the ", 77);
        TextOut(hDC, 13, 155, "main one being that Dog Simulator 2 is now in a window and has fonts and ",72);
        TextOut(hDC, 13, 175, "graphics to make it look better. There are also more things to do with your", 75);
        TextOut(hDC, 13, 195, "dog.", 4);
        DeleteObject(font);
        
        char *dogname;
        dogname = 0;
        
        HWND hContinue, hExit, hCredits, hBack;
         hContinue = CreateWindow ( "Button", "Continue",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    10, 320, 140, 20,
                                    hWnd, (HMENU) 1,
                                    hInstGlobal, NULL );
         hExit = CreateWindow     ( "Button", "Exit",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    437, 320, 140, 20,
                                    hWnd, (HMENU) 2,
                                    hInstGlobal, NULL);
         hCredits = CreateWindow  ( "Button", "Credits",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    225, 320, 140, 20,
                                    hWnd, (HMENU) 3,
                                    hInstGlobal, NULL);

	EndPaint(hWnd, &Ps);
}

void credits(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    
    
     HDC hDC;
     PAINTSTRUCT Ps;
     HFONT font;
     hDC = GetDC (GetParent((HWND) lParam));
     Rectangle (hDC, 0, 0, 600, 460);
		
         font = CreateFont(90,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Adolescence");

        SelectObject(hDC, font);
        TextOut(hDC, 22, 0, "Dog Simulator 2", 15);
        
     
     font = CreateFont(18, 0, 0, 0,
                       FW_NORMAL, FALSE, FALSE, FALSE,
                       ANSI_CHARSET, OUT_DEFAULT_PRECIS,
                       CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                       DEFAULT_PITCH | FF_ROMAN,
                       "Arial");
     
     SelectObject(hDC, font);
     TextOut(hDC, 13, 115, "Dog Simulator 1 and 2 was created by Kazalio Studios. The creators were:", 72);
     TextOut(hDC, 13, 135, "Programming: Alex Pajak", 23);
     TextOut(hDC, 13, 155, "Ideas/Design: Kasper Wilkosz", 28);
     
     
     
     
     HWND hScrnmain;
     hScrnmain = CreateWindow ( "Button", "Back",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    13, 200, 140, 20,
                                    hWnd, (HMENU) 4,
                                    hInstGlobal, NULL );
     DeleteObject(font);
     DeleteObject(hWnd);
     EndPaint(hWnd, &Ps);
     ReleaseDC (GetParent((HWND) lParam), hDC);
}

void dogname(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
     
     static BITMAPFILEHEADER *pbmfh;
    static BITMAPINFO *pbmi;
    static BYTE *pBits;
    static int cxDib, cyDib;
     DWORD dwFileSize, dwHighSize, dwBytesRead;
         HANDLE hFile;
         hFile = CreateFile ("E:\\blank.bmp",GENERIC_READ,
                             FILE_SHARE_READ, NULL,
                             OPEN_EXISTING,
                             FILE_FLAG_SEQUENTIAL_SCAN,
                             NULL);
                             
         dwFileSize = GetFileSize (hFile, &dwHighSize);
         pbmfh = (BITMAPFILEHEADER *) malloc (dwFileSize);
         ReadFile (hFile, pbmfh, dwFileSize, &dwBytesRead, NULL);
         pbmi = (BITMAPINFO *) (pbmfh + 1);
         pBits = (BYTE *) pbmfh + pbmfh->bfOffBits;
         cxDib = pbmi->bmiHeader.biWidth;
         cyDib = abs (pbmi->bmiHeader.biHeight);
         HDC hdc;
         hdc = GetDC (GetParent((HWND) lParam));;
         
         SetDIBitsToDevice ( hdc,
                           200,
                           195,
                           cxDib,
                           cyDib,
                           
                           0,
                           0,
                           0,
                           cyDib,
                           pBits,
                           pbmi,
                           DIB_RGB_COLORS);
         ReleaseDC (GetParent((HWND) lParam), hdc);
         free (pbmfh);  
     HDC         hDC;
    PAINTSTRUCT Ps;
    HFONT	    font;
     hDC = GetDC (GetParent((HWND) lParam));
     Rectangle (hDC, 0, 0, 600, 460);
     
     
     font = CreateFont(90,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Adolescence");

        SelectObject(hDC, font);
        TextOut(hDC, 22, 0, "Dog Simulator 2", 15);
        DeleteObject(font);
		
         font = CreateFont(18,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Arial");

        SelectObject(hDC, font);
        TextOut(hDC, 13, 115, "First you must choose a name for your dog.", 42);
        TextOut(hDC, 13, 135, "Name:", 5);
        
        HWND hName, hNamecont;
        
        hName = CreateWindow ( "EDIT", "",
                                    WS_CHILD | WS_VISIBLE |
                                    WS_BORDER | ES_AUTOHSCROLL,
                                    80, 135, 140, 20,
                                    hWnd, (HMENU) 1,
                                    hInstGlobal, NULL );
                                    
        hNamecont = CreateWindow ( "Button", "Continue",
                                    WS_CHILD | WS_VISIBLE |
                                    BS_PUSHBUTTON,
                                    13, 160, 140, 20,
                                    hWnd, (HMENU) 5,
                                    hInstGlobal, NULL );
                                    
        
        DeleteObject(font);

	EndPaint(hWnd, &Ps);
}

void dogmenu(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
      HDC         hDC;
    PAINTSTRUCT Ps;
    HFONT	    font;
     hDC = GetDC (GetParent((HWND) lParam));
     Rectangle (hDC, 0, 0, 600, 460);
     
     
     font = CreateFont(90,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Adolescence");

        SelectObject(hDC, font);
        TextOut(hDC, 22, 0, "Dog Simulator 2", 15);
        DeleteObject(font);
		
         font = CreateFont(18,0,0, 0,
                           FW_NORMAL, FALSE, FALSE, FALSE,
                           ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		         CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
		         DEFAULT_PITCH | FF_ROMAN,
			"Arial");

        SelectObject(hDC, font);
        TextOut(hDC, 13, 115,"Hello", 5);
        TextOut(hDC, 13, 135, "Name:", 5);
        
         DeleteObject(font);

	EndPaint(hWnd, &Ps);
}
The main menu is the starting screen and what i have being trying to accomplish is that the buttons can't be clicked once the user clicks on continue or credits, because i just painted a rectangle over the top of them but they can still click them if they know where they are, and i can't put buttons over the top.