home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / SOURCE / SPLASH2.PRG < prev    next >
Text File  |  1995-11-22  |  2KB  |  87 lines

  1. //    Splash2.prg - splash (start-up) screen demo - non-OO version
  2. //
  3. //    Written by:    John M. Skelton,  Nov-95.
  4. //
  5. //    Copyright (C) 1995 Skelton Software, Kendal Cottage, Hillam, Leeds LS25 5HP, UK.
  6. //    All Rights Reserved.
  7. //
  8. //    Part of Clip-4-Win.
  9.  
  10. #include "windows.ch"
  11. #define    NO_C4WCLASS
  12. #include "commands.ch"
  13.  
  14.  
  15. function main()
  16. local    oApp, oWnd
  17.  
  18. CREATE APPLICATION oApp  WINDOW oWnd  TITLE "Clip-4-Win Splash Screen Demo" ;
  19.     ON INIT     DoInit(oWnd)                    ;
  20.     ON WM_PAINT OnPaint(oWnd)
  21.  
  22. return 0
  23.  
  24.  
  25. static function DoInit(hWnd)
  26. local    hSplash, t1, aDlg
  27.  
  28. ShowWindow(hWnd, _GetnCmdShow())
  29.  
  30. // create a splash window for the user to see
  31. #ifndef    TIMER
  32. CREATE DIALOG aDlg  RESOURCE "SplashDlg"
  33. SHOW DIALOG aDlg  MODELESS  IN hWnd  RESULT hSplash
  34. #else
  35. // a modeless dialog
  36. hSplash = CreateDialog( , "SplashDlg", hWnd,                ;
  37.                        {|hDlg, nMsg, nw, nl| TimerFunc(hDlg, nMsg, nw, nl)})
  38. #endif
  39.  
  40. // do rest of init (here we just waste some time, as this is only a demo)
  41. t1 = seconds() + 3
  42. do while seconds() <= t1
  43. enddo
  44.  
  45. #ifndef    TIMER
  46. // remove the splash window, if it's not self-removing (e.g. own timer)
  47. if IsWindow(hSplash)
  48.     DestroyWindow(hSplash)
  49. endif
  50. #endif
  51.  
  52. return nil
  53.  
  54.  
  55. static function OnPaint(oWnd)
  56. cls
  57. ?
  58. ? " You can compile with:"
  59. ? "    (default)  Splash screen is removed after init done"
  60. ? "     /dTIMER   Splash screen with its own timer"
  61. ?
  62. #ifndef    TIMER
  63. ? "This EXE built without /dTIMER"
  64. #else
  65. ? "This EXE built with /dTIMER"
  66. #endif
  67. return nil
  68.  
  69.  
  70. #ifdef    TIMER
  71.  
  72. static function TimerFunc(hDlg, nMsg, nw, nl)
  73. do case
  74. case nMsg == WM_INITDIALOG
  75.     // Here we limit how long the dialog is visible, using a timer.
  76.     SetTimer(hDlg, 1, 5000)    // # milliseconds
  77.     return 1
  78. case nMsg == WM_TIMER
  79.     KillTimer(hDlg, 1)
  80.     DestroyWindow(hDlg)        // remove the dialog
  81.     return 1
  82. endcase
  83. return 0
  84.  
  85. #endif    // TIMER
  86.  
  87.