about.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #include "stdafx.h"
  2. #include "prefs.h"
  3. #include "libs.h"
  4. #include "resource.h"
  5. #include <mmsystem.h>
  6. char _credits[]=
  7. "\r\n"
  8. "Programming and design: Mark Sibly\r\n\r\n"
  9. "Documentation: Mark Sibly, Simon Harrison, Paul Gerfen, Shane Monroe and the Blitz Doc Team\r\n\r\n"
  10. "Testing and support: James Boyd, Simon Armstrong and the Blitz Dev Team\r\n\r\n"
  11. "Image loader courtesy of FreeImage by Floris van den berg\r\n\r\n"
  12. "Please visit www.blitzbasic.com for all your Blitz related needs!";
  13. /*
  14. char _credits[]=
  15. "\r\n"
  16. "Programming and Design: Mark Sibly\r\n\r\n"
  17. "Documentation: Simon Harrison; Simon Armstrong; Mark Sibly\r\n\r\n"
  18. "Many thanks to: Claire Foley; Janet Sibly; Rick, Kay and Robbie Keam; "
  19. "James Boyd; the Blitz Dev Team\r\n\r\n"
  20. "Image loader courtesy of FreeImage by Floris van den Berg\r\n\r\n"
  21. "Please visit www.blitzbasic.com for all your Blitz related needs!";
  22. */
  23. class Dialog : public CDialog{
  24. bool _quit;
  25. public:
  26. Dialog():_quit(false){}
  27. afx_msg void OnOK(){
  28. _quit=true;
  29. }
  30. void wait(){
  31. _quit=false;
  32. MSG msg;
  33. while( !_quit && GetMessage( &msg,0,0,0 ) ){
  34. if( !AfxGetApp()->PreTranslateMessage(&msg) ){
  35. TranslateMessage( &msg );
  36. DispatchMessage( &msg );
  37. }
  38. }
  39. EndDialog(0);
  40. }
  41. void wait( int n ){
  42. int _expire=(int)timeGetTime()+n;
  43. for(;;){
  44. int tm=_expire-(int)timeGetTime();
  45. if( tm<0 ) tm=0;
  46. MsgWaitForMultipleObjects( 0,0,false,tm,QS_ALLEVENTS );
  47. MSG msg;
  48. if( PeekMessage( &msg,0,0,0,PM_REMOVE ) ){
  49. if( !AfxGetApp()->PreTranslateMessage(&msg) ){
  50. TranslateMessage( &msg );
  51. DispatchMessage( &msg );
  52. }
  53. }
  54. if( !tm ) return;
  55. }
  56. }
  57. };
  58. void aboutBlitz( bool delay ){
  59. AfxGetMainWnd()->EnableWindow(0);
  60. Dialog about;
  61. about.Create( IDD_ABOUT );
  62. string credits;
  63. credits+=_credits;
  64. about.GetDlgItem( IDC_CREDITS )->SetWindowText( credits.c_str() );
  65. int ide_ver=VERSION&0xffff;
  66. int lnk_ver=linker_ver&0xffff;
  67. int run_ver=runtime_ver&0xffff;
  68. string ide_v=itoa(ide_ver/1000)+"."+itoa(ide_ver%1000);
  69. string lnk_v=itoa(lnk_ver/1000)+"."+itoa(lnk_ver%1000);
  70. string run_v=itoa(run_ver/1000)+"."+itoa(run_ver%1000);
  71. string t="";
  72. #ifdef PRO
  73. t+="Blitz3D";
  74. #else
  75. t+="Blitz2D";
  76. #endif
  77. #ifdef EDU
  78. t+=" - Educational Version";
  79. #else
  80. #ifdef DEMO
  81. t+=" - Demo Version\n\n";
  82. /*
  83. int n=shareProtCheck();
  84. if( n>1 ) t+=itoa(n)+" runs left";
  85. else if( n ) t+=itoa(n)+" run left";
  86. else t+="expired";
  87. t+=")\n\n";
  88. */
  89. #else
  90. t+=" - Release Version\n\n";
  91. #endif
  92. #endif
  93. about.GetDlgItem( IDC_PRODUCT )->SetWindowText( t.c_str() );
  94. t="IDE V"+ide_v+" Linker V"+lnk_v+" Runtime V"+run_v;
  95. about.GetDlgItem( IDC_VERSION )->SetWindowText( t.c_str() );
  96. #ifdef DEMO
  97. if( delay ){
  98. about.GetDlgItem( IDOK )->ShowWindow( SW_HIDE );
  99. about.GetDlgItem( IDC_PROGRESS1 )->ShowWindow( SW_SHOW );
  100. for( int k=0;k<100;++k ){
  101. ((CProgressCtrl*)about.GetDlgItem( IDC_PROGRESS1 ))->SetPos( k+1 );
  102. about.wait( 50 );
  103. }
  104. about.GetDlgItem( IDOK )->ShowWindow( SW_SHOW );
  105. }
  106. #endif
  107. about.GetDlgItem( IDC_PROGRESS1 )->ShowWindow( SW_HIDE );
  108. about.wait();
  109. about.EndDialog(0);
  110. AfxGetMainWnd()->EnableWindow(1);
  111. }