Logo ROOT   6.12/07
Reference Guide
Win32Splash.cxx
Go to the documentation of this file.
1 // @(#)root/winnt:$Id$
2 // Author: Bertrand Bellenot 30/07/02
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifdef WIN32
13 #include "Windows4Root.h"
14 #include "RVersion.h"
15 #include "strlcpy.h"
16 #include <stdlib.h>
17 #include <stdio.h>
18 #include <ocidl.h>
19 #include <olectl.h>
20 
21 #define ID_SPLASHSCREEN 25
22 
23 static const char *gConception[] = {
24  "Rene Brun",
25  "Fons Rademakers",
26  0
27 };
28 
29 static const char *gLeadDevelopers[] = {
30  "Rene Brun",
31  "Philippe Canal",
32  "Fons Rademakers",
33  0
34 };
35 
36 static const char *gRootDevelopers[] = {
37  "Ilka Antcheva",
38  "Maarten Ballintijn",
39  "Bertrand Bellenot",
40  "Olivier Couet",
41  "Valery Fine",
42  "Gerardo Ganis",
43  "Eddy Offermann",
44  "Valeriy Onuchin",
45  0
46 };
47 
48 //static const char *gCintDevelopers[] = {
49 // "Masaharu Goto",
50 // 0
51 //};
52 
53 static const char *gRootDocumentation[] = {
54  "Ilka Antcheva",
55  "Suzanne Panacek",
56  0
57 };
58 
59 static char **gContributors = 0;
60 
61 typedef struct tagImgInfo {
62  IPicture *Ipic;
63  SIZE sizeInHiMetric;
64  SIZE sizeInPix;
65  char *Path;
66 } IMG_INFO;
67 
68 static IMG_INFO gImageInfo;
69 
70 ///////////////////////////////////////////////////////////////////////////////
71 // Global Variables:
72 static HINSTANCE gInst; // Current instance
73 static HWND gSplashWnd = 0; // Splash screen
74 static BOOL gShow = FALSE;
75 static DWORD gDelayVal = 0;
76 static HDC gDCScreen = 0, gDCCredits = 0;
77 static HBITMAP gBmpScreen = 0, gBmpOldScreen = 0;
78 static HBITMAP gBmpCredits = 0, gBmpOldCredits = 0;
79 static HRGN gRgnScreen = 0;
80 static int gCreditsBmpWidth;
81 static int gCreditsBmpHeight;
82 
83 static bool gStayUp = true;
84 static bool gAbout = false;
85 static RECT gCreditsRect = { 15, 155, 305, 285 }; // clip rect in logo
86 static unsigned int gCreditsWidth = gCreditsRect.right - gCreditsRect.left; // credits pixmap size
87 static unsigned int gCreditsHeight = gCreditsRect.bottom - gCreditsRect.top; // credits rect height
88 
89 static void ReadContributors()
90 {
91  // Read the file $ROOTSYS/README/CREDITS for the names of the
92  // contributors.
93 
94  char buf[2048];
95 #ifdef ROOTDOCDIR
96  sprintf(buf, "%s/CREDITS", ROOTDOCDIR);
97 #else
98  sprintf(buf, "%s/README/CREDITS", getenv("ROOTSYS"));
99 #endif
100 
101  gContributors = 0;
102 
103  FILE *f = fopen(buf, "r");
104  if (!f) return;
105 
106  int cnt = 0;
107  while (fgets(buf, sizeof(buf), f)) {
108  if (!strncmp(buf, "N: ", 3)) {
109  cnt++;
110  }
111  }
112  gContributors = new char*[cnt+1];
113 
114  cnt = 0;
115  rewind(f);
116  while (fgets(buf, sizeof(buf), f)) {
117  if (!strncmp(buf, "N: ", 3)) {
118  int len = strlen(buf);
119  buf[len-1] = 0; // remove \n
120  len -= 3; // remove "N: "
121  gContributors[cnt] = new char[len];
122  strlcpy(gContributors[cnt], buf+3, len);
123  cnt++;
124  }
125  }
126  gContributors[cnt] = 0;
127 
128  fclose(f);
129 }
130 
131 static void DrawVersion(HDC hDC)
132 {
133  // Draw version string.
134  RECT drawRect;
135  SIZE lpSize;
136  char version[80];
137  int Height;
138  sprintf(version, "Version %s", ROOT_RELEASE);
139 
140  Height = gImageInfo.sizeInPix.cy;
141 
142  GetTextExtentPoint32(hDC, version, strlen(version), &lpSize);
143 
144  drawRect.left = 15;
145  drawRect.top = Height - 25;
146  drawRect.right = 15 + lpSize.cx;
147  drawRect.bottom = drawRect.top + lpSize.cy;
148  DrawTextEx(hDC, version, strlen(version), &drawRect, DT_LEFT, 0);
149 }
150 
151 static int DrawCreditItem(HDC hDC, const char *creditItem, const char **members,
152  int y, bool draw)
153 {
154  // Draw credit item.
155 
156  char credit[1024];
157  SIZE lpSize1, lpSize2;
158  RECT drawRect;
159  TEXTMETRIC lptm;
160  int i;
161  int lineSpacing;
162 
163  GetTextMetrics(hDC, &lptm);
164 
165  lineSpacing = lptm.tmAscent + lptm.tmDescent;
166 
167  strcpy(credit, creditItem);
168  for (i = 0; members && members[i]; i++) {
169  if (i) strcat(credit, ", ");
170  GetTextExtentPoint32(hDC, credit, strlen(credit), &lpSize1);
171  GetTextExtentPoint32(hDC, members[i], strlen(members[i]), &lpSize2);
172  if((lpSize1.cx + lpSize2.cx) > (int) gCreditsWidth) {
173  drawRect.left = 0;
174  drawRect.top = y;
175  drawRect.right = gCreditsRect.right;
176  drawRect.bottom = y + lineSpacing;
177  if (draw)
178  DrawTextEx(hDC, credit, strlen(credit), &drawRect, DT_LEFT, 0);
179  y += lineSpacing;
180  strcpy(credit, " ");
181  }
182  strcat(credit, members[i]);
183  }
184  drawRect.left = 0;
185  drawRect.top = y;
186  drawRect.right = gCreditsRect.right;
187  drawRect.bottom = y + lineSpacing;
188  if (draw)
189  DrawTextEx(hDC, credit, strlen(credit), &drawRect, DT_LEFT, 0);
190 
191  return y;
192 }
193 
194 static int DrawCredits(HDC hDC, bool draw, bool extended)
195 {
196  // Draw credits. If draw is true draw credits,
197  // otherwise just return size of all credit text.
198  // If extended is true draw or returns size for extended full
199  // credits list.
200 
201  char user_name[256];
202  TEXTMETRIC lptm;
203  DWORD length = sizeof (user_name);
204  int lineSpacing, y;
205 
206  GetTextMetrics(hDC, &lptm);
207 
208  lineSpacing = lptm.tmAscent + lptm.tmDescent;
209  y = 0; // 140
210  y = DrawCreditItem(hDC, "Conception: ", gConception, y, draw);
211  y += 2 * lineSpacing - 3;
212  y = DrawCreditItem(hDC, "Lead Developers: ", gLeadDevelopers, y, draw);
213  y += 2 * lineSpacing - 3; // special layout tweak
214  y = DrawCreditItem(hDC, "Core Engineering: ", gRootDevelopers, y, draw);
215  //y += 2 * lineSpacing - 3; // to just not cut the bottom of the "p"
216  //y = DrawCreditItem(hDC, "CINT C/C++ Intepreter: ", gCintDevelopers, y, draw);
217  y += 2 * lineSpacing - 3;
218  y = DrawCreditItem(hDC, "Documentation: ", gRootDocumentation, y, draw);
219 
220  if (extended && gContributors) {
221  y += 2 * lineSpacing;
222  y = DrawCreditItem(hDC, "Contributors: ", (const char **)gContributors, y, draw);
223 
224  y += 2 * lineSpacing;
225  y = DrawCreditItem(hDC, "Our sincere thanks and apologies to anyone who deserves", 0, y, draw);
226  y += lineSpacing;
227  y = DrawCreditItem(hDC, "credit but fails to appear in this list.", 0, y, draw);
228 
229  if (GetUserName (user_name, &length)) {
230  char *name = new char [strlen(user_name)+1];
231  strcpy(name, user_name);
232  char *s = strchr(name, ',');
233  if (s) *s = 0;
234  char line[1024];
235  sprintf(line, "Extra special thanks go to %s,", name);
236  delete [] name;
237  y += 2 * lineSpacing;
238  y = DrawCreditItem(hDC, line, 0, y, draw);
239  y += lineSpacing;
240  y = DrawCreditItem(hDC, "one of our favorite users.", 0, y, draw);
241  }
242  }
243  return y;
244 }
245 
246 void CreateCredits(HDC hDC, bool extended)
247 {
248  HFONT hFont, hOldFont;
249  HBRUSH hBr;
250  LOGFONT lf;
251  RECT fillRect;
252 
253  gRgnScreen = CreateRectRgnIndirect(&gCreditsRect);
254  SelectClipRgn(hDC, gRgnScreen);
255 
256  gDCScreen = CreateCompatibleDC(hDC);
257  gBmpScreen = CreateCompatibleBitmap(hDC, (gCreditsRect.right - gCreditsRect.left),
258  (gCreditsRect.bottom - gCreditsRect.top) );
259  gBmpOldScreen = (HBITMAP)SelectObject(gDCScreen, gBmpScreen);
260 
261  gDCCredits = CreateCompatibleDC(hDC);
262 
263  gCreditsBmpWidth = (gCreditsRect.right - gCreditsRect.left);
264  gCreditsBmpHeight = DrawCredits(gDCCredits, false, extended);
265 
266  gBmpCredits = CreateCompatibleBitmap(gDCCredits, gCreditsBmpWidth, gCreditsBmpHeight);
267  gBmpOldCredits = (HBITMAP)SelectObject(gDCCredits, gBmpCredits);
268 
269  hBr = CreateSolidBrush(RGB(255,255,255));
270  fillRect.top = fillRect.left = 0;
271  fillRect.bottom = gCreditsBmpHeight;
272  fillRect.right = gCreditsBmpWidth;
273  FillRect(gDCCredits, &fillRect, hBr);
274 
275  memset((void*)&lf, 0, sizeof(lf));
276  lf.lfHeight = 14;
277  lf.lfWeight = 400;
278  lf.lfQuality = NONANTIALIASED_QUALITY;
279  strcpy(lf.lfFaceName, "Arial");
280  hFont = CreateFontIndirect(&lf);
281 
282  if(hFont)
283  hOldFont = (HFONT)SelectObject(gDCCredits, hFont);
284 
285  SetBkMode(gDCCredits, TRANSPARENT);
286  SetTextColor(gDCCredits, 0x00000000);
287 
288  DrawCredits(gDCCredits, true, extended);
289 
290  SetBkColor(gDCCredits, 0x00FFFFFF);
291  SelectObject(gDCCredits, hOldFont);
292 }
293 
294 void ScrollCredits(BOOL extended)
295 {
296  // Track scroll position
297 
298  static int nScrollY = 0;
299 
300  if (!gShow)
301  return;
302  if (!IsWindow(gSplashWnd))
303  return;
304  HDC hDC = GetDC(gSplashWnd);
305 
306  if(gDCCredits == 0) {
307  CreateCredits(hDC, extended);
308  nScrollY = 0;
309  }
310 
311  BitBlt(gDCScreen, 0, 0, gCreditsBmpWidth, gCreditsBmpHeight, gDCCredits,
312  0, nScrollY, SRCCOPY);
313  BitBlt(hDC, gCreditsRect.left, gCreditsRect.top,
314  (gCreditsRect.right - gCreditsRect.left),
315  (gCreditsRect.bottom - gCreditsRect.top),
316  gDCScreen, 0, 0, SRCCOPY);
317 
318  GdiFlush();
319 
320  if (extended) {
321  // delay scrolling by the specified time
322  Sleep(100);
323 
324  if (nScrollY == 0)
325  Sleep(2000);
326 
327  // continue scrolling
328  nScrollY += 1;
329  if (nScrollY > (int) (gCreditsBmpHeight - 2*gCreditsHeight))
330  nScrollY = -int(gCreditsHeight);
331  }
332 }
333 
334 ///////////////////////////////////////////////////////////////////////////////
335 // Foward declarations of functions included in this code module:
336 ATOM MyRegisterClass(HINSTANCE hInstance);
337 LRESULT CALLBACK SplashWndProc(HWND, UINT, WPARAM, LPARAM);
338 
339 
340 void *OpenGraphic(char *name)
341 {
342  IPicture *Ipic = 0;
343  SIZE sizeInHiMetric,sizeInPix;
344  const int HIMETRIC_PER_INCH = 2540;
345  HDC hDCScreen = GetDC(0);
346  HRESULT hr;
347  int nPixelsPerInchX = GetDeviceCaps(hDCScreen, LOGPIXELSX);
348  int nPixelsPerInchY = GetDeviceCaps(hDCScreen, LOGPIXELSY);
349  wchar_t OlePathName[512];
350 
351  ReleaseDC(0, hDCScreen);
352  mbstowcs(OlePathName,name,strlen(name)+1);
353  hr = OleLoadPicturePath(OlePathName, 0, 0, 0, IID_IPicture,
354  (void **)(&Ipic));
355  if (hr)
356  return 0;
357  if (Ipic) {
358  // get width and height of picture
359  hr = Ipic->get_Width(&sizeInHiMetric.cx);
360  if (!SUCCEEDED(hr))
361  return 0;
362  Ipic->get_Height(&sizeInHiMetric.cy);
363  if (!SUCCEEDED(hr))
364  return 0;
365 
366  // convert himetric to pixels
367  sizeInPix.cx = (nPixelsPerInchX * sizeInHiMetric.cx +
368  HIMETRIC_PER_INCH / 2) / HIMETRIC_PER_INCH;
369  sizeInPix.cy = (nPixelsPerInchY * sizeInHiMetric.cy +
370  HIMETRIC_PER_INCH / 2) / HIMETRIC_PER_INCH;
371  gImageInfo.sizeInPix = sizeInPix;
372  gImageInfo.sizeInHiMetric = sizeInHiMetric;
373  gImageInfo.Ipic = Ipic;
374  gImageInfo.Path = name;
375  return Ipic;
376  }
377  return 0;
378 }
379 
380 void DisplayGraphic(HWND hwnd,HDC pDC)
381 {
382  IPicture *Ipic = gImageInfo.Ipic;
383  DWORD dwAttr = 0;
384  HBITMAP Bmp,BmpOld;
385  RECT rc;
386  HRESULT hr;
387  HPALETTE pPalMemOld;
388 
389  if (Ipic != 0) {
390  // get palette
391  OLE_HANDLE hPal = 0;
392  HPALETTE hPalOld=0, hPalMemOld=0;
393  hr = Ipic->get_hPal(&hPal);
394 
395  if (!SUCCEEDED(hr))
396  return;
397  if (hPal != 0) {
398  hPalOld = SelectPalette(pDC,(HPALETTE)hPal,FALSE);
399  RealizePalette(pDC);
400  }
401 
402  // Fit the image to the size of the client area. Change this
403  // For more sophisticated scaling
404  GetClientRect(hwnd,&rc);
405  // transparent?
406  if (SUCCEEDED(Ipic->get_Attributes(&dwAttr)) ||
407  (dwAttr & PICTURE_TRANSPARENT)) {
408  // use an off-screen DC to prevent flickering
409  HDC MemDC = CreateCompatibleDC(pDC);
410  Bmp = CreateCompatibleBitmap(pDC,gImageInfo.sizeInPix.cx,gImageInfo.sizeInPix.cy);
411 
412  BmpOld = (HBITMAP)SelectObject(MemDC,Bmp);
413  pPalMemOld = 0;
414  if (hPal != 0) {
415  hPalMemOld = SelectPalette(MemDC,(HPALETTE)hPal, FALSE);
416  RealizePalette(MemDC);
417  }
418 
419  // display picture using IPicture::Render
420  hr = Ipic->Render(MemDC, 0, 0, rc.right, rc.bottom, 0,
421  gImageInfo.sizeInHiMetric.cy,
422  gImageInfo.sizeInHiMetric.cx,
423  -gImageInfo.sizeInHiMetric.cy, &rc);
424 
425  BitBlt(pDC,0, 0, gImageInfo.sizeInPix.cx, gImageInfo.sizeInPix.cy,
426  MemDC, 0, 0, SRCCOPY);
427 
428  SelectObject(MemDC,BmpOld);
429 
430  if (pPalMemOld)
431  SelectPalette(MemDC,pPalMemOld, FALSE);
432  DeleteObject(Bmp);
433  DeleteDC(MemDC);
434 
435  }
436  else {
437  // display picture using IPicture::Render
438  Ipic->Render(pDC, 0, 0, rc.right, rc.bottom, 0,
439  gImageInfo.sizeInHiMetric.cy,
440  gImageInfo.sizeInHiMetric.cx,
441  -gImageInfo.sizeInHiMetric.cy, &rc);
442  }
443 
444  if (hPalOld != 0)
445  SelectPalette(pDC,hPalOld, FALSE);
446  if (hPal)
447  DeleteObject((HPALETTE)hPal);
448  }
449 }
450 
451 void CloseImage(void *Ipict)
452 {
453  IPicture *ip = (IPicture *)Ipict;
454 
455  if (ip == 0)
456  ip = gImageInfo.Ipic;
457  if (ip == 0)
458  return;
459  ip->Release();
460  memset(&gImageInfo,0,sizeof(gImageInfo));
461 }
462 
463 ////////////////////////////////////////////////////////////////////////////////
464 // Splashscreen functions
465 ////////////////////////////////////////////////////////////////////////////////
466 //
467 //
468 void DestroySplashScreen()
469 {
470  // Destroy the window
471  if (IsWindow(gSplashWnd)) {
472  DestroyWindow(gSplashWnd);
473  gSplashWnd = 0;
474  UnregisterClass("RootSplashScreen", gInst);
475  }
476  if(gDCScreen != 0 && gBmpOldScreen != 0) {
477  SelectObject(gDCScreen, gBmpOldScreen);
478  DeleteObject(gBmpScreen);
479  }
480  if(gDCCredits != 0 && gBmpOldCredits != 0) {
481  SelectObject(gDCCredits, gBmpOldCredits);
482  DeleteObject(gBmpCredits);
483  }
484  DeleteDC(gDCCredits);
485  gDCCredits = 0;
486  DeleteDC(gDCScreen);
487  gDCScreen = 0;
488  CloseImage(gImageInfo.Ipic);
489 }
490 
491 ////////////////////////////////////////////////////////////////////////////////
492 //
493 //
494 BOOL CreateSplashScreen(HWND hParent)
495 {
496  int xScreen;
497  int yScreen;
498  // Crenter the splashscreen
499  xScreen = GetSystemMetrics(SM_CXFULLSCREEN);
500  yScreen = GetSystemMetrics(SM_CYFULLSCREEN);
501 
502  gStayUp = true;
503 
504  gSplashWnd = CreateWindowEx(
505  WS_EX_TOOLWINDOW,
506  "RootSplashScreen",
507  0,
508  WS_POPUP | WS_VISIBLE,
509  (xScreen - 360)/2,
510  (yScreen - 240)/2,
511  360, 240,
512  hParent,
513  0,
514  gInst,
515  0);
516 
517  return (gSplashWnd != 0);
518 }
519 
520 
521 ////////////////////////////////////////////////////////////////////////////////
522 //
523 //
524 BOOL PreTranslateMessage(MSG* pMsg)
525 {
526  if (!IsWindow(gSplashWnd))
527  return FALSE;
528 
529  // If we get a keyboard or mouse message, hide the splash screen.
530  if (pMsg->message == WM_KEYDOWN ||
531  pMsg->message == WM_SYSKEYDOWN ||
532  pMsg->message == WM_LBUTTONDOWN ||
533  pMsg->message == WM_RBUTTONDOWN ||
534  pMsg->message == WM_MBUTTONDOWN ||
535  pMsg->message == WM_NCLBUTTONDOWN ||
536  pMsg->message == WM_NCRBUTTONDOWN ||
537  pMsg->message == WM_NCMBUTTONDOWN) {
539  return TRUE; // message handled here
540  }
541  return FALSE; // message not handled
542 }
543 
544 void CreateSplash(DWORD time, BOOL extended)
545 {
546  MSG msg;
547  MyRegisterClass(gInst);
548  gShow = FALSE;
549  if(extended)
550  gAbout = true;
551  if(time > 0) {
552  gDelayVal = time * 1000;
553  }
554  else return;
555 
556  if (extended)
557  ReadContributors();
558 
559  // Create the splash screen
560  CreateSplashScreen(0);
561 
562  // Main message loop:
563  while (gStayUp) {
564  if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
565  PreTranslateMessage(&msg);
566  TranslateMessage(&msg);
567  DispatchMessage(&msg);
568  }
569  if(gShow) {
570  if(extended) {
571  ScrollCredits(extended);
572  }
573  else {
574  ScrollCredits(extended);
575  gShow = false;
576  }
577  }
578  }
579 
581 }
582 
583 ///////////////////////////////////////////////////////////////////////////////
584 //
585 // FUNCTION: MyRegisterClass()
586 //
587 // PURPOSE: Registers the window class.
588 //
589 // COMMENTS:
590 //
591 // This function and its usage is only necessary if you want this code
592 // to be compatible with Win32 systems prior to the 'RegisterClassEx'
593 // function that was added to Windows 95. It is important to call this function
594 // so that the application will get 'well formed' small icons associated
595 // with it.
596 //
597 ATOM MyRegisterClass(HINSTANCE hInstance)
598 {
599  WNDCLASSEX wcex;
600 
601  wcex.cbSize = sizeof(WNDCLASSEX);
602 
603  wcex.style = CS_HREDRAW | CS_VREDRAW;
604  wcex.lpfnWndProc = (WNDPROC)SplashWndProc;
605  wcex.cbClsExtra = 0;
606  wcex.cbWndExtra = 0;
607  wcex.hInstance = hInstance;
608  wcex.hIcon = 0;
609  wcex.hCursor = LoadCursor(0, IDC_ARROW);
610  wcex.hbrBackground = 0;
611  wcex.lpszMenuName = 0;
612  wcex.lpszClassName = "RootSplashScreen";
613  wcex.hIconSm = 0;
614  return RegisterClassEx(&wcex);
615 }
616 
617 
618 
619 ////////////////////////////////////////////////////////////////////////////
620 // Message handler for splash screen.
621 //
622 LRESULT CALLBACK SplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
623 {
624  PAINTSTRUCT ps;
625  HDC hDC;
626  LOGFONT lf;
627  static HFONT hFont;
628  const char bmpDir[] = "\\icons\\Splash.gif";
629  HWND hwndFound; // this is what is returned to the caller
630  char pszNewWindowTitle[1024]; // contains fabricated WindowTitle
631  char pszOldWindowTitle[1024]; // contains original WindowTitle
632  char FullBmpDir[256];
633  char *RootSysDir;
634  int xScreen;
635  int yScreen;
636 
637  switch (message) {
638  case WM_CREATE:
639  if(!gAbout)
640  SetTimer(hWnd, ID_SPLASHSCREEN, gDelayVal, 0);
641  RootSysDir = getenv("ROOTSYS");
642  sprintf(FullBmpDir,"%s%s",RootSysDir,bmpDir);
643  // Retrieve a handle identifying the file.
644  OpenGraphic(FullBmpDir);
645  hDC = GetDC(hWnd);
646  DisplayGraphic(hWnd, hDC);
647  SetBkMode(hDC, TRANSPARENT);
648  memset((void*)&lf, 0, sizeof(lf));
649  lf.lfHeight = 14;
650  lf.lfWeight = 400;
651  lf.lfQuality = NONANTIALIASED_QUALITY;
652  strcpy(lf.lfFaceName, "Arial");
653  hFont = CreateFontIndirect(&lf);
654  xScreen = GetSystemMetrics(SM_CXFULLSCREEN);
655  yScreen = GetSystemMetrics(SM_CYFULLSCREEN);
656  SetWindowPos(hWnd, HWND_TOPMOST, (xScreen - gImageInfo.sizeInPix.cx)/2,
657  (yScreen - gImageInfo.sizeInPix.cy)/2, gImageInfo.sizeInPix.cx,
658  gImageInfo.sizeInPix.cy, 0 );
659  break;
660 
661  case WM_TIMER:
662  if (wParam == ID_SPLASHSCREEN) {
663  KillTimer (hWnd, ID_SPLASHSCREEN);
665  }
666  break;
667 
668  case WM_DESTROY:
669  gStayUp = false;
670  PostQuitMessage(0);
671 
672  case WM_PAINT:
673  hDC = BeginPaint(hWnd, &ps);
674  RECT rt;
675  GetClientRect(hWnd, &rt);
676  RootSysDir = getenv("ROOTSYS");
677  sprintf(FullBmpDir,"%s%s",RootSysDir,bmpDir);
678  OpenGraphic(FullBmpDir);
679  hDC = GetDC(hWnd);
680  DisplayGraphic(hWnd, hDC);
681  SetBkMode(hDC, TRANSPARENT);
682  if(hFont)
683  SelectObject(hDC, hFont);
684  DrawVersion(hDC);
685  EndPaint(hWnd, &ps);
686  gShow = TRUE;
687  // fetch current window title
688  GetConsoleTitle(pszOldWindowTitle, 1024);
689  // format a "unique" NewWindowTitle
690  wsprintf(pszNewWindowTitle,"%d/%d", GetTickCount(), GetCurrentProcessId());
691  // change current window title
692  SetConsoleTitle(pszNewWindowTitle);
693  // ensure window title has been updated
694  Sleep(40);
695  // look for NewWindowTitle
696  hwndFound=FindWindow(NULL, pszNewWindowTitle);
697  // restore original window title
698  ShowWindow(hwndFound, SW_RESTORE);
699  SetForegroundWindow(hwndFound);
700  SetConsoleTitle("ROOT session");
701  break;
702 
703  default:
704  return DefWindowProc(hWnd, message, wParam, lParam);
705  }
706  return 0;
707 }
708 #endif
TLine * line
void CreateSplash(DWORD time, BOOL extended)
pt SetTextColor(4)
static constexpr double ps
void DestroySplashScreen()
#define CALLBACK
Definition: TGLFaceSet.cxx:30
#define TRUE
Double_t y[n]
Definition: legend1.C:17
static constexpr double s
#define FALSE
#define ROOT_RELEASE
Definition: RVersion.h:17
char name[80]
Definition: TGX11.cxx:109
const char * cnt
Definition: TXMLSetup.cxx:74