1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
#include <stdlib.h>
#include <string.h>
#include<windows.h>
#include "exdata.h"
using namespace std;
#define WIN32_LEAN_AND_MEAN
LRESULT CALLBACK WndProc(HWND hwndMain, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX windowClass;
windowClass.lpszClassName = "Main Class";
windowClass.cbClsExtra = NULL;
windowClass.cbWndExtra = NULL;
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(247, 247, 247));
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
windowClass.hIconSm = (HICON)LoadImage(NULL, MAKEINTRESOURCE(IDI_APPLICATION), IMAGE_ICON, 16, 16, NULL);
windowClass.hInstance = hInstance;
windowClass.lpfnWndProc = WndProc;
windowClass.lpszMenuName = NULL;
windowClass.style = CS_VREDRAW | CS_HREDRAW;
RegisterClassEx(&windowClass);
HWND Main = CreateWindowEx(NULL, "Main Class", "Basic Window",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 500, 500,
NULL, NULL, hInstance, NULL);
if (!Main)
return(0);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
int aa1 = 0;
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
{
//creation coding
}
break;
TCHAR aa[2];
TCHAR ab[2];
TCHAR ac[2];
/*
TCHAR ad[2];
TCHAR ae[2];
TCHAR af[2];
*/
case WM_PAINT:
{
char buffer[65];
PAINTSTRUCT Ps;
HDC hdc;
hdc = BeginPaint(hwnd, &Ps);
SetBkColor(hdc, RGB(255, 255, 255));
SetTextColor(hdc, RGB(0, 0, 0));
TextOut(hdc, 10, 10, aa, wsprintf(aa, "%d", camp));
TextOut(hdc, 20, 10, ab, wsprintf(ab, "%d", aa1));
TextOut(hdc, 30, 10, ac, wsprintf(ac, "%d", aa1));
//TextOut(hdc, 40, 10, ad, wsprintf(ad, "%d", "3"));
//TextOut(hdc, 50, 10, ae, wsprintf(ae, "%d", "4"));
//TextOut(hdc, 60, 10, af, wsprintf(af, "%d", "5"));
EndPaint(hwnd, &Ps);
}
break;
case WM_CLOSE:
{
PostQuitMessage(WM_QUIT);
}
break;
default:
return(DefWindowProc(hwnd, message, wParam, lParam));
}
return(0);
}
|