Another update: I've edited the code above to because I've learned that
Function WinProc:Int(hWnd:Int,Msg:Int,wParam:Int,lParam:Int) "win32"
needs the "win32" statement too.
Function WinProc:Int(hWnd:Int,Msg:Int,wParam:Int,lParam:Int) "win32"
needs the "win32" statement too.