Red de conocimiento informático - Computadora portátil - Programación en C++, cómo hacer una hoja de puntuación para estudiantes

Programación en C++, cómo hacer una hoja de puntuación para estudiantes

//?Win32Project1.cpp?:?Define el punto de entrada de la aplicación.

//

#include?"stdafx.h"

#include?"Win32Project1.h"

#define?MAX_LOADSTRING ?100

//?Variables globales:?

HINSTANCE?hInst; //Instancia actual

TCHAR?szTitle[MAX_LOADSTRING] //Title; Texto de columna

TCHAR?szWindowClass[MAX_LOADSTRING] //Nombre de clase de ventana principal

//?Declaración directa de funciones contenidas en este módulo de código:?

ATOM MyRegisterClass(HINSTANCE?hInstance);

BOOL InitInstance(HINSTANCE,?int);

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

INT_PTR?CALLBACK About(HWND,?UINT,?WPARAM,?LPARAM);

int?APIENTRY?_tWinMain(_In_?HINSTANCE?hInstance, _In_opt_?HINSTANCE?hPrevInstance, _In_? LPTSTRlpCmdLine, _In_?intnCmdShow)

{

UNREFERENCED_PARAMETER(hPrevInstance);

UNREFERENCED_PARAMETER(lpCmdLine); //TODO:?Coloque el código aquí.

MSG?msg;

HACCEL?hAccelTable;

//Inicializar cadena global

LoadString(hInstance,?IDS_APP_TITLE,? szTitle,?MAX_LOADSTRING);

LoadString(hInstance,?IDC_WIN32PROJECT1,?szWindowClass,?MAX_LOADSTRING);

MyRegisterClass(hInstance);

// inicialización de la aplicación:?

if?(!InitInstance?(hInstance,?nCmdShow))

{

return?FALSE;

}

hAccelTable?=?LoadAccelerators(hInstance,?MAKEINTRESOURCE(IDC_WIN32PROJECT1));

///?Bucle de mensajes principal:?

while?( GetMessage( &msg,?NULL,?0,?0))

{

if?(!TranslateAccelerator(msg.hwnd,?hAccelTable,?&msg))

{

TranslateMessage(&msg);

DispatchMessage(&msg);

}

}

regresar ?(int)?msg.wParam;

}

//

//?Función:?MyRegisterClass()

/ //p>

//?Propósito:?Registrar clase de ventana.

//

ATOM?MyRegisterClass(HINSTANCE?hInstance)

{

WNDCLASSEX?wcex;

wcex.cbSize?=?sizeof(WNDCLASSEX);

wcex.style =?CS_HREDRAW?|?CS_VREDRAW;

wcex.lpfnWndProc =?WndProc;

wcex.cbClsExtra =?0;

wcex.cbWndExtra =?0;

wcex.hInstance =?hInstance;

wcex.hIcon =?LoadIcon(hInstance ,?MAKEINTRESOURCE(IDI_WIN32PROJECT1));

wcex.hCursor =?LoadCursor(NULL,?IDC_ARROW);

wcex.hbrBackground =?(HBRUSH)(COLOR_WINDOW+1);

wcex.lpszMenuName =?MAKEINTRESOURCE(IDC_WIN32PROJECT1);

wcex.lpszClassName =?szWindowClass;

wcex.hIconSm =?LoadIcon(wcex.hInstance,?MAKEINTRESOURCE (IDI_SMALL));

return?RegisterClassEx(&wcex);

}

//

//Función:?InitInstance( HINSTANCE,?int)

//

//Propósito:?Guardar el identificador de instancia y crear la ventana principal

//

/ /Comentario:?

//

//En esta función, guardamos el identificador de instancia en la variable global y

//Crear y mostrar la ventana principal del programa.

//

BOOL?InitInstance(HINSTANCE?hInstance,?int?nCmdShow)

{

HWND?hWnd; p>

hInst?=?hInstance;?//?Almacenar el identificador de instancia en una variable global

hWnd?=?CreateWindow(szWindowClass,?szTitle,?WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,?0 ,? CW_USEDEFAULT,?0,?NULL,?NULL,?hInstance,?NULL);

if?(!hWnd)

{ return?FALSE;

}

ShowWindow(hWnd,?nCmdShow);

UpdateWindow(hWnd);

return?TRUE;

}

//

//?Función:?WndProc(HWND,?UINT,?WPARAM,?LPARAM)

//

// ?Propósito: Procesar mensajes desde la ventana principal.

//

//?WM_COMMAND -?Manejar el menú de la aplicación

//?WM_PAINT -?Pintar la ventana principal

/ /?WM_DESTROY -?Enviar mensaje de salida y regresar

//

//

LRESULT?CALLBACK?WndProc(HWND?hWnd,?UINT?message , ?WPARAM?wParam,?LPARAM?lParam)

{

int?wmId,?wmEvent;

PAINTSTRUCT?ps;

HDC?hdc;

cambiar?(mensaje)

{

caso?WM_COMMAND:

wmId=?LOWORD(wParam)

wmEvent?=?HIWORD(wParam);

///?Selección del menú de análisis:?

switch?(wmId)

{

caso?IDM_ABOUT:

DialogBox(hInst,?MAKEINTRESOURCE(IDD_ABOUTBOX),?hWnd,?About);

descanso;

case?IDM_EXIT:

DestroyWindow(hWnd);

break;

default:

return?DefWindowProc(hWnd, ? mensaje,?wParam,?lParam);

}

descanso;

caso?WM_PAINT:

hdc?=?BeginPaint ( hWnd,?&ps);

//TODO:?Agrega cualquier código de dibujo aquí...

EndPaint(hWnd,?&ps);

romper;

caso?WM_DESTROY:

PostQuitMessage(0);

romper;

predeterminado:

return?DefWindowProc(hWnd,?message,?wParam,?lParam);

}

return?0;

}

//Manejador de mensajes para el cuadro "Acerca de".

INT_PTR?CALLBACK?About(HWND?hDlg,?UINT?message,?WPARAM?wParam,?LPARAM?lParam)

{

UNREFERENCED_PARAMETER(lParam );

cambiar?(mensaje)

{

caso?WM_INITDIALOG:

retorno?(INT_PTR)TRUE;

case?WM_COMMAND:

if?(LOWORD(wParam)?==?IDOK?||?LOWORD(wParam)?==?IDCANCEL)

{

EndDialog(hDlg,?LOWORD(wParam));

retorno?(INT_PTR)TRUE;

}

descanso;

p>

}

¿devolver?(INT_PTR)FALSE;

}