I have just written a very basic full screen slide show program. ESC to exit and left/right arrow keys to view images.

The problem I have is that sometimes (well, most of the time; but not all of the time), the first image I display has a white line where the taskbar was. If I view the next image, all is ok. And, if I then go back to the first image, it is ok.

Here is my code:

.if uMsg==WM_CREATE
invoke LoadImage, NULL, ADDR szFirstFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE
mov hBitmap,eax
.elseif uMsg==WM_PAINT
invoke BeginPaint,hWnd,addr ps ; prepare window for painting & fill PAINTSTRUCT structure
mov hdc,eax ; handle to display device context for the window
invoke CreateCompatibleDC,hdc ; create a memory device context
mov hMemDC,eax
invoke SelectObject,hMemDC,hBitmap ; selects an object into the specified device context
; invoke GetClientRect,hWnd,addr rect
; invoke BitBlt,hdc,0,0,rect.right,rect.bottom,hMemDC,0,0,SRCCOPY
invoke BitBlt,hdc,0,0,ScrSizeX,ScrSizeY,hMemDC,0,0,SRCCOPY
invoke DeleteDC,hMemDC
invoke EndPaint,hWnd,addr ps
invoke DeleteObject,hBitmap ; delete logical bitmap, handle no longer valid
.elseif uMsg==WM_KEYDOWN
.if wParam == 1Bh ; ESC key pressed
invoke PostQuitMessage,NULL ; request to terminate thread
.elseif wParam == 027h ; Right arrow key pressed
mov eax, LastBmp
.if CurrentBmp < eax
inc CurrentBmp
invoke wsprintf,ADDR szBmpPart2,ADDR FmtInteger,CurrentBmp ;convert bmp number to string
invoke lstrcpy, ADDR szNewBmpName, ADDR szBmpPart1
invoke lstrcat, ADDR szNewBmpName, ADDR szBmpPart2
invoke lstrcat, ADDR szNewBmpName, ADDR szBmpPart3
invoke LoadImage, NULL, ADDR szNewBmpName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE
mov hBitmap,eax
invoke InvalidateRect,hWnd, 0, FALSE
invoke UpdateWindow, hWnd
invoke DeleteObject, hBitmap

Please help me.
Posted on 2003-02-27 04:29:28 by GreenScreenAlternator
The right way to get full screen graphics is to use DirectDraw into exclusive mode... this is the only sure way... and relatively easy IMHO

The taskbar has special priviledges in Windows OS, you could try and send it a HIDE message
You could also usa GetDC with zero parameter to obtain a DC of the Desktop and draw on it

... but honestly the GDI screen is a shared resource and you can not presume when and where and application will write on it ... i mean YOU are trying to do exactly that ... :)

Mostly the when part of the problem is hard to resolve because of the async nature of the windows messaging system... it might work ok on your system configuration and totally wrong on other systems...
Posted on 2003-02-28 16:52:37 by BogdanOntanu
Hi GreenScreenAlternator,

You mentioned that the second image displayed ok. So, why don't you just display the first image twice?

Maybe that will do the trick!
Posted on 2003-02-28 16:54:32 by GreenScreenAlternator
Thanks BogdanOntanu,

That's very helpful. I will try hiding the taskbar.

Directx is a little beyond me at the moment (not for long though!!).
Posted on 2003-02-28 16:55:41 by GreenScreenAlternator
Just figured it out....

invoke CreateSolidBrush, Black
mov wc.hbrBackground, eax
Posted on 2003-03-01 15:37:06 by GreenScreenAlternator