- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is my question of the day:
I want to create a splash screen that disappears after (say) 20 seconds (without any user intervention) when my Quickwin app starts. What's the easiest way of doing this?
I created a dialog and used dlgmodeless to bring it up, but I need a loop like the one below:
do while( GetMessage (mesg, NULL, 0, 0) )
if ( DlgIsDlgMessage(mesg, dlg) .EQV. .FALSE. ) then
if ( TranslateAccelerator (mesg%hwnd, haccel, mesg) == 0) then
lret = TranslateMessage( mesg )
ret = DispatchMessage( mesg )
end if
end if
end do
If I don't add this loop, the contents of my dialog will not display. How do I get out of this loop after a given time? There must be an easy way of doing this but it escapes me.
Thanks,
Gabriel
I want to create a splash screen that disappears after (say) 20 seconds (without any user intervention) when my Quickwin app starts. What's the easiest way of doing this?
I created a dialog and used dlgmodeless to bring it up, but I need a loop like the one below:
do while( GetMessage (mesg, NULL, 0, 0) )
if ( DlgIsDlgMessage(mesg, dlg) .EQV. .FALSE. ) then
if ( TranslateAccelerator (mesg%hwnd, haccel, mesg) == 0) then
lret = TranslateMessage( mesg )
ret = DispatchMessage( mesg )
end if
end if
end do
If I don't add this loop, the contents of my dialog will not display. How do I get out of this loop after a given time? There must be an easy way of doing this but it escapes me.
Thanks,
Gabriel
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry about the code snippet in my original message. What I meant was:
do while( GetMessage (mesg, NULL, 0, 0) ) if ( DlgIsDlgMessage(mesg, dlg) .EQV. .FALSE. ) then if ( TranslateAccelerator (mesg%hwnd, haccel, mesg) == 0) then lret = TranslateMessage( mesg ) ret = DispatchMessage( mesg ) end if end if end do
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many users, including myself, deem splash screens an annoynance unless your application really does initialize for a long time. It's considered a nice practice that when your application can be ready, it should be ready.
Yes, without the message loop your modeless dialog would be stuck except if it's created from QuickWin primary thread. (IIRC I've described few times QW threaded structure here). However, by adding message loop to the program you've added GUI capability to secondary thread.
The simplest fix would be to use a timer. See here for a sample of using timer in a dialog. In your case, timer would have a smaller frequency and the timer procedure should close the dialog the first time it's entered. For that to work, either Dlg has to be global between PROGRAM and TimerProc, or you could use an application-defined message to exit message loop:
INTEGER, PARAMETER:: WM_EXITDLG = WM_APP + 1 ... do while( GetMessage (mesg, NULL, 0, 0) ) IF (mesg%message .EQ. WM_EXITDLG) EXIT ... !In TimerProc: j = PostMessage(hWnd, WM_EXITDLG, 0, 0)
HTH
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Jugoslav. It worked! Also, the splash screen disappears relatively soon, as per your preaching.
Gabriel
Gabriel

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page