WinAPI help- InvalidateRect crash- translucent

BlitzPlus Forums/BlitzPlus Programming/WinAPI help- InvalidateRect crash- translucent

David Boudreau(Posted 2008) [#1]
I have a question about using some WinAPI calls inside a BlitzPlus program. I have a window with a canvas. Here are the relevant lines of code:
hwnd = QueryObject (window_handle, 1)
SetWindowLong(hwnd, -20,  $80000)
SetLayeredWindowAttributes(hwnd, colorkey, alpha, colororalpha)
InvalidateRect(GetDesktopWindow(), Null, True)

In the first three lines, I make the window translucent. These three lines, without the fourth line (InvalidateRect), it works ok but leaves junk all under the window (black boxes the same size and location as the canvas has been, left on the desktop/other windows, even when my program exits, until I bring another window into full-screen focus manually) i.e. it does not refresh the desktop. Also the canvas isn't transparent, either, but I could live with that.

The fourth line, InvalidateRect, does EXACTLY what I want, even making the canvas translucent, and it looks beautiful-- except for the fact that the program suddenly crashes on this very line, and I can't make much sense of the dump file (esp as I don't know if Blitz offers any symbol files). This is the crash dialog:

"blitzcc.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created.[Cancel]->...[OK]"

Please help!