Jump to content
Sign in to follow this  

WM_Paint with Bitblt bug

Recommended Posts

Okay, I'm now using bitblt in my response to WM_Paint and it's working much better than what I had before. However, there is still a weird little issue that I can't figure out. When I cover up my window (let's call it win1) with another window (let's call it win2) and I minimize win2, about half the time win1 doesn't refresh properly. The strange part is, apparently bitblt is being called with all of the same parameters, so I have no idea why this is happening. Here is my sample code.



#include <GUIConstants.au3>

GUIRegisterMsg(0x000F, "TGF_Private_Refresh")
Opt("GUIOnEventMode", 1)
$mainWindow = GUICreate("Test", 1000, 600)

Local $hdc = DllCall("user32.dll", "int", "GetDC", "hwnd", $mainWindow)
Local $hdcmem = DllCall("gdi32.dll", "int", "CreateCompatibleDC", "int", $hdc[0])
Local $bmp = DllCall("gdi32.dll", "int", "CreateCompatibleBitmap", "int", $hdc[0], "int", 1000, "int", 600)
Local $oldhdc = DllCall("gdi32.dll", "int", "SelectObject", "int", $hdcmem[0], "int", $bmp[0])

  Local $brush = DllCall("gdi32.dll", "int", "CreateSolidBrush", "int", 0x00000000)
  Local $oldBrush = DllCall("gdi32.dll", "int", "SelectObject", "int", $hdcmem[0], "int", $brush[0])
  DllCall("gdi32.dll", "int", "Rectangle", "int", $hdcmem[0], "int", 0, "int", 0, "int", 1000, "int", 600)    


Func TGF_Private_Refresh($hWndGUI, $MsgID, $wParam, $lParam)
        $work = DllCall("gdi32.dll", "int", "BitBlt", "int", $hdc[0], "int", 0, "int", 0, "int", _ 
        1000, "int", 600, "int", $hdcmem[0], "int", 0, "int", _
        0, "int", 0xcc0020)

While 1

Share this post

Link to post
Share on other sites

Your example works fine for me, I guess.. It's all black, but it always stays that way.. Even if I cover it up, and minimize it with another window..

Share this post

Link to post
Share on other sites

That's odd... I just tried it again with both the beta and normal versions and both versions had the problem. However, when I first posted, I said it happens about half the time, and I think it happens less than that. To produce the bug, I got the black window up, covered it with another window and minimized/maximized the second window about ten to twenty times. I think when I was testing it yesterday, I must have done something that was making the bug appear more often.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...