I’ve implemented this solution to handle the Window messages: https://forum.xojo.com/25942-wm-queryendsession-will-crash-your-windows-xojo-application

I can see that it is working and I am able to catch the WM_ERASEBKGND messages from the window. I want to Return LRESULT(1) from WM_ERASEBKGND to tell the window not to erase. I’m not sure if I am implementing the return message properly because it doesn’t seem to have any effect on the window at all. Any advice would be appreciated…:confused:

[code]#If TargetWin32

#pragma X86CallingConvention StdCall

Declare Function CallWindowProcW Lib “User32” ( oldProc As Ptr, handle As Integer, msg As Integer, wParam As Integer, lParam As Integer ) As Integer

Const WM_ERASEBKGND = &H0014
Const WM_PAINT = &H000F

Select Case msg

'Window1.txtStatus.AppendText(“ERASE!” + EndOfLine)

//I tried this:
msg = 1
wParam = hWnd   

//I also tried this:
Return 1

'Window1.txtStatus.AppendText(“PAINT!” + EndOfLine)
End Select
Return CallWindowProcW( theOldWndProc, hWnd, msg, wParam, lParam )

Have you looked at WFS (Windows Functionality Suite) ?
There used to be examples of handling wnd_proc calls in there
It may be instructive

Thanks Norman, I’ve looked at it A LOT actually. I’ve found a lot of useful things in there but nothing handling WM_ERASEBKGND specifically.

Here you go, let me know if you have any questions:


[quote=332557:@JulianS]Here you go, let me know if you have any questions:

Thanks Julian I looked at your example project and this is exactly how I have been doing it. I’ll have to look for a different solution for my problem I guess. Thanks a lot at least I know I am doing this correctly.