1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| PAINTSTRUCT ps;
HDC hdc;
HDC memoryHdc;
RECT rcClient;
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rcClient);
int cxClient = rcClient.right-rcClient.left;
int cyClient = rcClient.bottom-rcClient.top;
HDC s_hDCBackground = CreateCompatibleDC(hdc);
// moulinette pour changer de message et modifier ses coordonnées
bool showMessage = true;
if(m_listeBMP.size()!=0 && showMessage)
{
if(indice<0)
{
currentIt = m_listeBMP.begin();
msgcurrent = (*currentIt);
indice = 0;
}
if(msgcurrent.posX <= msgcurrent.width * -1)
{
msgcurrent.nbLoopDone++;
if(msgcurrent.nbLoopDone==msgcurrent.nbLoop)
{
currentIt++;
if(currentIt == m_listeBMP.end())
{
currentIt = m_listeBMP.begin();
}
msgcurrent = (*currentIt);
}
}else{
if(msgcurrent.posX == -1)
{
msgcurrent.posX = rcClient.right;
}else{
msgcurrent.posX = msgcurrent.posX - 3;
}
// msgcurrent est une struct, .bmp est un HBITMAP
SelectObject(s_hDCBackground, msgcurrent.bmp);
BitBlt(hdc, msgcurrent.posX, 10, cxClient, cyClient, s_hDCBackground, 0, 0, SRCCOPY);
DeleteDC(s_hDCBackground);
}
}
EndPaint(hWnd, &ps); |
Partager