AnimateWindow(), problem
-
When i use the AnimateWindow my window is animated, but i don't see any control, my OnPaint() is not called, why?
If you look at the remarks in the documentation for AnimateWindow, it looks like it is calling WM_PRINT instead. WM_PRINT is basically like a WM_PAINT except that it gives a DC that should be drawn to. So, if you are using the plain windows API, you could do something like this in your windowproc:
...
case WM_PRINT:
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
//Test if the wPAram already contains the HDC
if (NULL != wParam)
{
// This is the DC that you should use to paint with.
hdc = (HDC)wParam;
}
else
{
// OTherwise call begin paint like normal.
hdc = ::BeginPaint(hWnd, &ps);
}// Your paint code goes here. if (NULL == wParam) { // If you called beginpaint, hten you will need to call endpaint. ::EndPaint(hWnd, &ps); }
}
break;
...If you are using MFC, you will simply need to call OnDraw from your OnPrint handler and be sure to pass in the DC that you received from the OnPrint handler. Good Luck
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
If you look at the remarks in the documentation for AnimateWindow, it looks like it is calling WM_PRINT instead. WM_PRINT is basically like a WM_PAINT except that it gives a DC that should be drawn to. So, if you are using the plain windows API, you could do something like this in your windowproc:
...
case WM_PRINT:
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
//Test if the wPAram already contains the HDC
if (NULL != wParam)
{
// This is the DC that you should use to paint with.
hdc = (HDC)wParam;
}
else
{
// OTherwise call begin paint like normal.
hdc = ::BeginPaint(hWnd, &ps);
}// Your paint code goes here. if (NULL == wParam) { // If you called beginpaint, hten you will need to call endpaint. ::EndPaint(hWnd, &ps); }
}
break;
...If you are using MFC, you will simply need to call OnDraw from your OnPrint handler and be sure to pass in the DC that you received from the OnPrint handler. Good Luck
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!