RECURSOS MENU DISCARDABLE

#include <windows.h>
#include "resource.h"

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hI, HINSTANCE hPI, PSTR szCL, int iCS) {
    TCHAR    szAppName[] = TEXT("RECURSOS");
    HWND     hwnd;
    MSG      msg;
    WNDCLASS wndclass;

    wndclass.style         = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc   = WndProc;
    wndclass.cbClsExtra    = 0;
    wndclass.cbWndExtra    = 0;
    wndclass.hInstance     = hI;
    wndclass.hIcon         = LoadIcon(hI, IDI_APPLICATION);
    wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = GetSysColorBrush(2);
    wndclass.lpszMenuName  = szAppName;
    wndclass.lpszClassName = szAppName;

    if(!RegisterClass(&wndclass)) {
        MessageBox(NULL, TEXT("Error!"), szAppName, MB_ICONERROR);
        return 0;
    }

    hwnd = CreateWindow(
        szAppName, "Recurso", WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 640, 320,
        NULL, NULL, hI, NULL
    );

    ShowWindow(hwnd, iCS);
    UpdateWindow(hwnd);

    while(GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
        FreeConsole();
    }
    return msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
    switch(msg) {
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
    }
    return DefWindowProc(hwnd, msg, wp, lp);
}





/********************** Arquivo: resource.h ***************************/

#define IDM_A1 22





/********************** Arquivo: resource.rc ***************************/

#include "resource.h"
#include "afxres.h"

RECURSOS MENU DISCARDABLE
BEGIN
    MENUITEM "&Trompete",                IDM_A1
    MENUITEM "&Violao",                  23
    MENUITEM "&Piano",                   24
    MENUITEM "&Harpa",                   25
    MENUITEM "&Violino",                 26
    MENUITEM "&Flauta",                  27
    MENUITEM "&Bateria",                  28
END

Comentários