Hi Charles,
I had to interrupt yesterday, but this morning I tried to create a splash screen before starting an app. This is nothing sophisticated, no timer etc. And I do not know how this could be done with OpenGl. But maybe it can be of some help nevertheless. I also think using DestroyWindow and UnregisterClass will be the best solution.
Roland
Edit: small modification, as I forgot UnregisterClass after DestroyWindow myself
$ filename "splash_window.exe"
'uses rtl32
'uses rtl64
uses WinUtil
% DT_CENTER=1
% DT_VCENTER=4
% DT_SINGLELINE=32
% GCLP_HBRBACKGROUND= -10
hInstance=inst
'Window class
string CUSTOM_WC= "CustomControl"
sys hSplash
MainWindow 600,400,WS_OVERLAPPEDWINDOW
declare sub showSplash()
function WndProc(sys hwnd, uMsg, wParam, lParam) as sys callback
select uMsg
case WM_CREATE
showSplash()
Sleep (2000)
DestroyWindow(hSplash)
UnregisterClass(CUSTOM_WC,hInstance)
case WM_CLOSE
DestroyWindow(hwnd)
case WM_DESTROY
PostQuitMessage(0)
case else
return DefWindowProc(hwnd, uMsg, wParam, lParam)
end select
return 0
end function
sub showSplash()
WNDCLASS wc
wc.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW
wc.lpfnWndProc = @CustomProc
wc.hCursor = LoadCursor(null, IDC_ARROW)
wc.lpszClassName = strptr CUSTOM_WC
if not RegisterClass(&wc) then
mbox "Cannot register Custom Control"
end if
hSplash = CreateWindowEx(WS_EX_TOPMOST, CUSTOM_WC, "", WS_CHILD or WS_POPUP,
200, 200, 300, 200,
0, null, hInstance, null)
end sub
function CustomProc(sys hwnd, uint uMsg, sys wParam, lParam) as sys callback
sys hdc
PAINTSTRUCT ps
RECT rc
select uMsg
case WM_CREATE
'Display the Splash Window.
ShowWindow hwnd, SW_SHOW
sys hbr=CreateSolidBrush(14000)
DeleteObject(SetClassLongPtr(hwnd,GCLP_HBRBACKGROUND, hbr))
InvalidateRect (hwnd,null,TRUE)
GetClientRect(hwnd, &rc)
hdc = BeginPaint(hwnd, &ps)
SetTextColor(hdc, 32000)
DrawText(hdc, "Hello World!", -1, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER)
EndPaint(hwnd, &ps)
return 0
end select
return DefWindowProc(hwnd, uMsg, wParam, lParam)
end function