Hello, I developed a little app which displays a mouse pointer. But I have an issue where it leaves some artefacts on the screen. This happens if the screen content under the mouse is changed.
Here is the part of the worker thread which is doing the job.
...
pt = ptAbs;
if( pt.x < 0 ) pt.x = 0;
if( pt.x >= ScreenSizeX ) pt.x = ScreenSizeX - 1;
if( pt.y < 0 ) pt.y = 0;
if( pt.y >= ScreenSizeY ) pt.y = ScreenSizeY - 1;
if( (pt.x != ptOld.x) || (pt.y != ptOld.y) ) {
SelectObject( hDC_Mouse, hBitmapCursor );
if( ptOld.x != -1 ) {
BitBlt( hDC_Main, ptOld.x, ptOld.y, 15, 25, hDC_Mouse, 0, 0, SRCINVERT );
}
BitBlt( hDC_Main, pt.x, pt.y, 15, 25, hDC_Mouse, 0, 0, SRCINVERT );
ptOld = pt;
...
This code is run if the mouse is moved. But if the screen changed since the last move, the first BitBlt leaves (or better produces) the artefacts. I know why the artefacts are left, but have no idea to gid rid of. I also can't use the normal window messages because this is not an application window, it is the normal desktop (today screen for example).
Are there any functions (BitBlt, PatBlt, MaskBlt...) to look if there is the older cursor displayed or allready overwritten by some other applications?
Here is the part of the worker thread which is doing the job.
...
pt = ptAbs;
if( pt.x < 0 ) pt.x = 0;
if( pt.x >= ScreenSizeX ) pt.x = ScreenSizeX - 1;
if( pt.y < 0 ) pt.y = 0;
if( pt.y >= ScreenSizeY ) pt.y = ScreenSizeY - 1;
if( (pt.x != ptOld.x) || (pt.y != ptOld.y) ) {
SelectObject( hDC_Mouse, hBitmapCursor );
if( ptOld.x != -1 ) {
BitBlt( hDC_Main, ptOld.x, ptOld.y, 15, 25, hDC_Mouse, 0, 0, SRCINVERT );
}
BitBlt( hDC_Main, pt.x, pt.y, 15, 25, hDC_Mouse, 0, 0, SRCINVERT );
ptOld = pt;
...
This code is run if the mouse is moved. But if the screen changed since the last move, the first BitBlt leaves (or better produces) the artefacts. I know why the artefacts are left, but have no idea to gid rid of. I also can't use the normal window messages because this is not an application window, it is the normal desktop (today screen for example).
Are there any functions (BitBlt, PatBlt, MaskBlt...) to look if there is the older cursor displayed or allready overwritten by some other applications?