Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#include <fstream>
- #include <iostream>
- #include <sstream>
- #include <windows.h>
- //#include <cstdio>
- //#include <string>
- //#include <cstring>
- //#include <tchar.h>
- //#include <stdlib.h>
- #include <conio.h>
- #include <stdio.h>
- HFONT hFont = CreateFont (33, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
- OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
- DEFAULT_PITCH | FF_DONTCARE, TEXT("Tahoma"));
- 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(" NEED a BIG TEXT! "),
- WS_VISIBLE | WS_CHILD | SS_CENTER | SS_CENTERIMAGE,
- 20,30,260,35,hwnd,(HMENU)1,NULL,NULL);
- 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