Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <windows.h>
- // Copyright rhouland@epastas.lt & evgeniistorozhev@mail.ru
- HFONT hFont = CreateFont (43, 0, 0, 0, 700, FALSE, FALSE, FALSE, BALTIC_CHARSET,
- OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
- DEFAULT_PITCH | FF_DONTCARE, TEXT("Comic Sans MS"));
- // HFONT CreateFont(
- //_In_ int nHeight, AUKÐTIS
- //_In_ int nWidth, PLOTIS
- //_In_ int nEscapement, PASVIRIMAS
- //_In_ int nOrientation,
- //_In_ int fnWeight, STORIS FW_BOLD, = 700 NUO 1 IKI 900
- //_In_ DWORD fdwItalic,
- //_In_ DWORD fdwUnderline,
- //_In_ DWORD fdwStrikeOut,
- //_In_ DWORD fdwCharSet,
- //_In_ DWORD fdwOutputPrecision,
- //_In_ DWORD fdwClipPrecision,
- //_In_ DWORD fdwQuality,
- //_In_ DWORD fdwPitchAndFamily,
- //_In_ LPCTSTR lpszFace
- LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
- static HBITMAP hImageBitmap;
- static HBITMAP hImageOldBitmap;
- static HDC hImageDC;
- static BITMAP bm;
- static HWND HWNDStatic;
- switch(Message) {
- case WM_DESTROY: {
- if (hImageBitmap)
- {
- DeleteObject (SelectObject (hImageDC, hImageOldBitmap));
- DeleteDC (hImageDC);
- }
- PostQuitMessage(0);
- break;
- }
- case WM_CREATE: {
- HWNDStatic = CreateWindow(TEXT("STATIC"),TEXT(" ÐEÐKAS Á JÛRÀ ÞIÛRËJO "),
- WS_VISIBLE | WS_CHILD | SS_CENTER | SS_CENTERIMAGE,
- 50,70,460,75,hwnd,(HMENU)1,NULL,NULL);
- SendMessage (HWNDStatic, WM_SETFONT, WPARAM (hFont), TRUE);
- hImageBitmap = (HBITMAP) LoadImage (NULL, "1.bmp", 0, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
- if (hImageBitmap)
- {
- GetObject (hImageBitmap, sizeof (BITMAP), &bm);
- HDC hDC = GetDC (hwnd);
- hImageDC = CreateCompatibleDC (hDC);
- hImageOldBitmap = (HBITMAP) SelectObject (hImageDC, hImageBitmap);
- ReleaseDC (hwnd, hDC);
- }
- break;
- }
- case WM_CTLCOLORSTATIC:
- {
- if((HWND)lParam == HWNDStatic)
- {
- //SetBkColor((HDC)wParam, RGB(255,0,255));
- SetTextColor((HDC)wParam, RGB(0, 255, 0));
- SetBkMode((HDC)wParam, TRANSPARENT);
- return (INT_PTR)GetStockObject(NULL_BRUSH);
- }
- break;
- }
- case WM_PAINT: {
- PAINTSTRUCT ps;
- HDC hDC = BeginPaint (hwnd, &ps);
- if (hImageBitmap)
- BitBlt (hDC, 0, 0, bm.bmWidth, bm.bmHeight, hImageDC, 0, 0, SRCCOPY);
- EndPaint (hwnd, &ps);
- break;
- }
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
- }
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
- WNDCLASSEX wc;
- HWND hwnd;
- MSG msg;
- setlocale(LC_ALL, "Lithuanian");
- 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_WINDOW+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(WS_EX_CLIENTEDGE,"WindowClass",
- "Tekstas, permatomas, spalva. ðriftas",
- WS_VISIBLE | WS_SYSMENU,
- GetSystemMetrics(SM_CXSCREEN)/2-335,
- GetSystemMetrics(SM_CYSCREEN)/2-233,
- 669,466,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);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement