main.html
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include "resource.h"
char txt[] = {"Arquivos de Recursos"};
TCHAR szAppName[] = TEXT("RECURSOS");
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP) {
switch(msg) {
case WM_COMMAND:
if(LOWORD(wP)==IDM_A1) {
int cxScreen, cyScreen;
cxScreen = GetSystemMetrics(0);
cyScreen = GetSystemMetrics(1);
char tela[20];
wsprintf(
tela,
"Vertical: %d Horiontal: %d",
cxScreen,
cyScreen
);
MessageBox(
NULL,
tela,
"Medidas do Monitor!",
MB_OK
);
}
if(LOWORD(wP)==IDM_A2) {
MessageBox(
NULL,
"O aplicativo será fechado!",
"Aviso!",
MB_OK
);
exit(0);
}
if(LOWORD(wP)==IDM_A3) {
MessageBox(
NULL,
__TIME__,
"Hora:",
MB_OK
);
}
return 0;
case WM_DESTROY: {
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hwnd, msg, wP, lP);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hI, HINSTANCE hPI, LPSTR szCL, int iCS) {
WNDCLASS wc;
HWND hwnd;
MSG msg;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hI;
wc.hIcon = LoadIcon(hI, ICONE);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = GetSysColorBrush(COLOR_GRAYTEXT);
wc.lpszMenuName = szAppName;
wc.lpszClassName = szAppName;
if(!RegisterClass(&wc)) {
MessageBox(
NULL,
"Window Registration Failed!",
"Error!",
MB_ICONEXCLAMATION | MB_OK
);
return 0;
}
hwnd = CreateWindow(
szAppName, txt, WS_VISIBLE | WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 500, 300,
NULL, NULL, hI, NULL
);
ShowWindow(hwnd, iCS);
UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg); }
return msg.wParam;
}
resource.html
#define ICONE 17
#define IDM_A1 18
#define IDM_A2 19
#define IDM_A3 20
#define IDM_A4 21
#define IDM_A5 22
#define IDM_A6 23
#define IDM_A7 24
resourcerc.html
#include "resource.h"
#include "afxres.h"
ICONE ICON "project1.ico"
RECURSOS MENU DISCARDABLE
BEGIN
POPUP "&Detalhe"
BEGIN
MENUITEM "&Monitor", IDM_A1
MENUITEM "&Fechar", IDM_A2
END
MENUITEM "&Horário", IDM_A3
MENUITEM "&Conexão", IDM_A4
MENUITEM "&Sistema", IDM_A5
MENUITEM "&Localização", IDM_A6
MENUITEM "&Memória", IDM_A7
END
Comentários
Postar um comentário