Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, INT iCmdShow)
- {
- HWND hWnd;
- MSG msg;
- WNDCLASS wndClass;
- wndClass.style = CS_HREDRAW | CS_VREDRAW;
- wndClass.lpfnWndProc = WndProc;
- wndClass.cbClsExtra = 0;
- wndClass.cbWndExtra = 0;
- wndClass.hInstance = hInstance;
- wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndClass.hbrBackground = (HBRUSH)(COLOR_BACKGROUND);//(HBRUSH)GetStockObject(NULL_BRUSH);
- wndClass.lpszMenuName = NULL;
- wndClass.lpszClassName = TEXT("Teste");
- RegisterClass(&wndClass);
- hWnd = CreateWindow(
- TEXT("Teste"), // window class name
- TEXT(""), // window caption
- WS_POPUP, // window style
- 300, // initial x position
- 300, // initial y position
- 250, // initial x size
- 50, // initial y size
- NULL, // parent window handle
- NULL, // window menu handle
- hInstance, // program instance handle
- NULL); // creation parameters
- ShowWindow(hWnd, iCmdShow);
- UpdateWindow(hWnd);
- SetTimer(hWnd, 1, 5000, NULL);
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- } // WinMain
- LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
- WPARAM wParam, LPARAM lParam)
- {
- HDC hdc;
- PAINTSTRUCT ps;
- switch (message)
- {
- case WM_PAINT:
- hdc = BeginPaint(hWnd, &ps);
- RECT pos;
- pos.left = 0;
- pos.right = 249;
- pos.top = 0;
- pos.bottom = 49;
- DrawText(hdc, "Texto da janela", -1, &pos, DT_CENTER or DT_VCENTER);
- EndPaint(hWnd, &ps);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- case WM_TIMER:
- PostQuitMessage(0);
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- } // WndProc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement