BruNews
Messages postés
21040
Date d'inscription
jeudi 23 janvier 2003
Statut
Modérateur
Dernière intervention
21 août 2019
18 avril 2004 à 20:52
Bon voila un exemple complet.
Compile (release) et teste.
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE x, PSTR y, int z)
{
HDC hdc, hMem;
RECT rect;
HBRUSH hbr;
HBITMAP hbmp;
BITMAP bitmap;
char szOut[60];
SIZE size; int cxFull GetSystemMetrics(SM_CXSCREEN), cyFull GetSystemMetrics(SM_CYSCREEN); rect.left rect.top 0; rect.bottom = cyFull; rect.right = cxFull / 3;
hdc = CreateDC("DISPLAY", NULL, NULL, NULL);
hbr = CreateSolidBrush(RGB(0, 0, 255));
SetBkMode(hdc, TRANSPARENT);
FillRect(hdc, &rect, hbr); DeleteObject(hbr);
rect.left = rect.right; rect.right *= 2;
hbr = CreateSolidBrush(RGB(255, 255, 255));
FillRect(hdc, &rect, hbr); DeleteObject(hbr); rect.left rect.right; rect.right cxFull; rect.top = 0; rect.bottom = cyFull;
hbr = CreateSolidBrush(RGB(255, 0, 0));
FillRect(hdc, &rect, hbr); DeleteObject(hbr); rect.left 0; rect.right cxFull;
strcpy(szOut, "De toutes les libertés humaines,");
GetTextExtentPoint32(hdc, szOut, strlen(szOut), &size); rect.top (cyFull / 2) - 100; rect.bottom rect.top + size.cy * 1.5;
DrawText(hdc, szOut, -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
strcpy(szOut, "la plus précieuse est l'indépendance de la patrie");
rect.top = rect.bottom; rect.bottom += (size.cy * 1.5);
DrawText(hdc, szOut, -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
strcpy(szOut, "Charles Maurras");
rect.top = rect.bottom; rect.bottom += (size.cy * 4);
DrawText(hdc, szOut, -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
hbmp = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_LYS));
GetObject(hbmp, sizeof(BITMAP), &bitmap);
hMem = CreateCompatibleDC(hdc);
SelectObject(hMem, hbmp);
BitBlt(hdc, cxFull / 2 - bitmap.bmWidth / 2, 20, bitmap.bmWidth, bitmap.bmHeight, hMem, 0, 0, SRCCOPY);
DeleteDC(hMem); DeleteObject(hbmp);
DeleteDC(hdc);
return 0;
}
ciao...
BruNews, Admin CS, MVP Visual C++