#include <windows.
h>
// Identificadores
#define ID_BUTTON_MEMBERS 1
#define ID_MENU_ADD 101
#define ID_MENU_EDIT 102
#define ID_MENU_LIST 103
#define ID_MENU_DELETE 104
// Prototipos de funciones
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
nCmdShow) {
MSG msg;
WNDCLASS wc = {0};
[Link] = WndProc;
[Link] = hInstance;
[Link] = TEXT("MainApp");
RegisterClass(&wc);
HWND hwnd = CreateWindow(
[Link], TEXT("Gestión de Gimnasio"),
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
NULL, NULL, hInstance, NULL
);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
return (int) [Link];
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
static HWND hButton;
static HMENU hMenu, hSubMenu;
switch (msg) {
case WM_CREATE:
hButton = CreateWindow(TEXT("button"), TEXT("Gestión de Miembros"),
WS_VISIBLE | WS_CHILD, 50, 50, 150, 30,
hwnd, (HMENU) ID_BUTTON_MEMBERS, NULL, NULL);
hMenu = CreateMenu();
hSubMenu = CreatePopupMenu();
AppendMenu(hSubMenu, MF_STRING, ID_MENU_ADD, TEXT("Agregar"));
AppendMenu(hSubMenu, MF_STRING, ID_MENU_EDIT, TEXT("Editar"));
AppendMenu(hSubMenu, MF_STRING, ID_MENU_LIST, TEXT("Listar"));
AppendMenu(hSubMenu, MF_STRING, ID_MENU_DELETE, TEXT("Eliminar"));
AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hSubMenu, TEXT("Gestión de Miembros"));
SetMenu(hwnd, hMenu);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case ID_BUTTON_MEMBERS:
TrackPopupMenu(hSubMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, 50, 80, 0, hwnd,
NULL);
break;
case ID_MENU_ADD:
MessageBox(hwnd, TEXT("Agregar Miembro"), TEXT("Opción Seleccionada"), MB_OK);
break;
case ID_MENU_EDIT:
MessageBox(hwnd, TEXT("Editar Miembro"), TEXT("Opción Seleccionada"), MB_OK);
break;
case ID_MENU_LIST:
MessageBox(hwnd, TEXT("Listar Miembros"), TEXT("Opción Seleccionada"), MB_OK);
break;
case ID_MENU_DELETE:
MessageBox(hwnd, TEXT("Eliminar Miembro"), TEXT("Opción Seleccionada"), MB_OK);
break;
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
return 0;