Linguagem C - static HWND n1, n2, n3;

Linguagem C - static HWND n1, n2, n3;
#include <windows.h> #include <stdio.h> #define WSCE 512 static char texto[100] = "Apocalipse 19v19 e 20"; static char font[50] = "Arial Black"; static HFONT tamanho; static HWND n1, n2, n3; LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC ctx; switch(Message) { case WM_CREATE: n1 = CreateWindow( "edit", " ",WS_VISIBLE|WS_BORDER|WS_CHILD, 10, 10, 280, 20, hwnd,NULL,NULL,NULL ); n2 = CreateWindow( "edit", " ",WS_VISIBLE|WS_BORDER|WS_CHILD, 10, 40, 280, 20, hwnd,NULL,NULL,NULL ); n3 = CreateWindow( "edit", " ", WS_VISIBLE | WS_BORDER | WS_CHILD, 10, 70, 280, 20, hwnd,NULL,NULL,NULL ); CreateWindow( "button","static HWND n1, n2, n3;", WS_VISIBLE | WS_BORDER | WS_CHILD, 10, 100, 280, 20, hwnd, (HMENU) 1,NULL,NULL ); return 0; case WM_COMMAND: tamanho = CreateFont( 35, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, font ); if(LOWORD(wParam)==1) { MessageBoxA(NULL, "CreateFont", "Preencher Lacunas", MB_OK); SetWindowText(n1, "CreateFont"); SetWindowText(n2, "CreateFont"); SetWindowText(n3, "CreateFont"); } return 0; case WM_PAINT: ctx = BeginPaint(hwnd, &ps); SelectObject(ctx, tamanho); SetTextColor(ctx, RGB(255, 255, 255)); SetBkColor(ctx, RGB(0, 0, 0)); TextOut(ctx, 10, 180, texto, strlen(texto)); EndPaint(hwnd, &ps); return 0; case WM_DESTROY: { PostQuitMessage(0); break; } default: return DefWindowProc(hwnd, Message, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCS) { WNDCLASSEX wc; /* A properties struct of our window */ HWND hwnd; MSG msg; memset(&wc,0,sizeof(wc)); wc.cbSize = sizeof(WNDCLASSEX); wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_3DLIGHT+1); wc.lpszClassName = "WindowClass"; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&wc)) { MessageBox(NULL, "Window Registration Failed!","Error!",MB_ICONEXCLAMATION|MB_OK); return 0; } hwnd = CreateWindowEx( WSCE,"WindowClass","A função CreateFont",WS_VISIBLE|WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 400, NULL,NULL,hInstance,NULL ); if(hwnd == NULL) { MessageBox(NULL, "Window Creation Failed!","Error!",MB_ICONEXCLAMATION|MB_OK); return 0; } while(GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); /* Translate key codes to chars if present */ DispatchMessage(&msg); /* Send it to WndProc */ } return msg.wParam; }

Comentários