FullScreenTitleBar.cpp
上传用户:cjw5120
上传日期:2022-05-11
资源大小:5032k
文件大小:17k
源码类别:

网络截获/分析

开发平台:

Visual C++

  1. //===========================================================================
  2. // FullScreen Titlebar
  3. // 2004 - All rights reservered
  4. //===========================================================================
  5. //
  6. // Project/Product : FullScreenTitlebar
  7. //  FileName : FullScreenTitleBar.cpp
  8. // Author(s) : Lars Werner
  9. //  Homepage : http://lars.werner.no
  10. //
  11. // Description : Creates a titlebar window used on fullscreen apps.
  12. //                  
  13. // Classes : CTitleBar
  14. //
  15. // Information :
  16. //   Compiler(s) : Visual C++ 6.0 Ent.
  17. //   Target(s) : Win32 / MFC
  18. //   Editor   : Microsoft Visual Studio 6.0 editor
  19. //
  20. // History
  21. // Vers.  Date      Aut.  Type     Description
  22. //  -----  --------  ----  -------  -----------------------------------------
  23. // 1.00   20 01 04  LW    Create   Original
  24. // 1.01   03 02 80  LW    Updated  Added contextmenus and restore feature
  25. //===========================================================================
  26. #include "stdafx.h"
  27. #include "resource.h"
  28. #include "FullScreenTitleBar.h"
  29. //***************************************************************************************
  30. CTitleBar *TitleBarThis=NULL;
  31. //***************************************************************************************
  32. CTitleBar::CTitleBar()
  33. {
  34. hInstance=NULL;
  35. Parent=NULL;
  36. this->Init();
  37. }
  38. CTitleBar::CTitleBar(HINSTANCE hInst, HWND ParentWindow)
  39. {
  40. hInstance=hInst;
  41. Parent=ParentWindow;
  42. this->Init();
  43. }
  44. //***************************************************************************************
  45. CTitleBar::~CTitleBar()
  46. {
  47. DeleteObject(Font);
  48. DestroyWindow(m_hWnd);
  49. }
  50. //***************************************************************************************
  51. void CTitleBar::Init()
  52. {
  53. SlideDown=TRUE; //Slide down at startup
  54. AutoHide=FALSE;
  55. IntAutoHideCounter=0;
  56. HideAfterSlide=FALSE;
  57. //Create font
  58.     HDC hdc;
  59.     long lfHeight;
  60.     
  61.     hdc = GetDC(NULL);
  62.     lfHeight = -MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72);
  63.     ReleaseDC(NULL, hdc);
  64. Font=CreateFont(lfHeight, 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, "Arial");
  65. Text=""; //No text at startup...
  66. m_hWnd=NULL;
  67. if(Parent!=NULL&&hInstance!=NULL)
  68. {
  69. TitleBarThis=this;
  70. this->CreateDisplay();
  71. }
  72. }
  73. //***************************************************************************************
  74. void CTitleBar::Create(HINSTANCE hInst, HWND ParentWindow)
  75. {
  76. hInstance=hInst;
  77. Parent=ParentWindow;
  78. this->Init();
  79. }
  80. //***************************************************************************************
  81. void CTitleBar::CreateDisplay()
  82. {
  83. //Consts are used to select margins
  84. //GetParent size and size after that!
  85. RECT lpRect;
  86. ::GetWindowRect(::GetDesktopWindow(), &lpRect);
  87. // Create the window
  88. WNDCLASS wndclass;
  89. wndclass.style = CS_DBLCLKS;
  90. wndclass.lpfnWndProc = CTitleBar::WndProc;
  91. wndclass.cbClsExtra = 0;
  92. wndclass.cbWndExtra = 0;
  93. wndclass.hInstance = hInstance;
  94. wndclass.hIcon=NULL;
  95. wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
  96. wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
  97.     wndclass.lpszMenuName = (const TCHAR *) NULL;
  98. wndclass.lpszClassName = _T("FSTITLEBAR");
  99. RegisterClass(&wndclass);
  100. //Create window without any titlbar
  101. DWORD winstyle = WS_POPUP | WS_SYSMENU ;
  102. int CenterX=(lpRect.right-lpRect.left)/2-tbWidth/2;
  103. int HeightPlacement=-tbHeigth+1;
  104. if(tbScrollWindow==FALSE)
  105. HeightPlacement=0;
  106. m_hWnd = CreateWindow(_T("FSTITLEBAR"),
  107.       /*_T("Titlebar")*/NULL,
  108.       winstyle,
  109.       CenterX,
  110.       HeightPlacement,
  111.       tbWidth,       // x-size
  112.       tbHeigth,       // y-size
  113.       Parent,                // Parent handle
  114.       NULL,                // Menu handle
  115.       hInstance,
  116.       NULL);
  117. //Set region to window so it is non rectangular
  118. HRGN Range;
  119. POINT Points[4];
  120. Points[0].x=0;
  121. Points[0].y=0;
  122. Points[1].x=tbTriangularPoint;
  123. Points[1].y=tbHeigth;
  124. Points[2].x=tbWidth-tbTriangularPoint;
  125. Points[2].y=tbHeigth;
  126. Points[3].x=tbWidth;
  127. Points[3].y=0;
  128. Range=::CreatePolygonRgn(Points, 4, ALTERNATE );
  129. ::SetWindowRgn(m_hWnd, Range, TRUE);
  130. //Close button
  131. HWND Close=CreateWindow("STATIC",
  132. "Close",
  133. WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_OWNERDRAW,
  134.                 tbWidth-tbRightSpace-tbcxPicture, tbTopSpace, tbcxPicture, tbcyPicture, m_hWnd,
  135. (HMENU)tbIDC_CLOSE,
  136.                 hInstance,
  137. NULL);
  138. //Maximize button
  139. HWND Maximize=CreateWindow("STATIC",
  140. "Maximize",
  141. WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_OWNERDRAW,
  142.                 tbWidth-tbRightSpace-(tbcxPicture*2)-(tbButtonSpace*1), tbTopSpace, tbcxPicture, tbcyPicture, m_hWnd,
  143. (HMENU)tbIDC_MAXIMIZE,
  144.                 hInstance,
  145. NULL);
  146. //Minimize button
  147. HWND Minimize=CreateWindow("STATIC",
  148. "Minimize",
  149. WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_OWNERDRAW,
  150.                 tbWidth-tbRightSpace-(tbcxPicture*3)-(tbButtonSpace*2), tbTopSpace, tbcxPicture, tbcyPicture, m_hWnd,
  151. (HMENU)tbIDC_MINIMIZE,
  152.                 hInstance,
  153. NULL);
  154. //Pin button
  155. Pin=CreateWindow("STATIC",
  156. "Pin",
  157. WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_OWNERDRAW,
  158.                 tbLeftSpace, tbTopSpace, tbcxPicture, tbcyPicture, m_hWnd,
  159. (HMENU)tbIDC_PIN,
  160.                 hInstance,
  161. NULL);
  162. //Set the creation of the window
  163. SetWindowLong(m_hWnd, GWL_USERDATA, (LONG) this);
  164. //Load pictures
  165. this->LoadPictures();
  166. //Show window and start animation
  167. if(tbHideAtStartup==FALSE)
  168. ShowWindow(m_hWnd, SW_SHOW);
  169. if(tbScrollWindow==TRUE)
  170. SetTimer(m_hWnd, tbScrollTimerID, tbScrollDelay, NULL);
  171. if(AutoHide==TRUE)
  172. SetTimer(m_hWnd, tbAutoScrollTimer, tbAutoScrollDelay, NULL);
  173. }
  174. //***************************************************************************************
  175. LRESULT CALLBACK CTitleBar::WndProc(HWND hwnd, UINT iMsg, 
  176.    WPARAM wParam, LPARAM lParam)
  177. {
  178. switch (iMsg)
  179. {
  180. case WM_CREATE:
  181. return 0;
  182. case WM_PAINT:
  183. TitleBarThis->Draw();
  184. return 0;
  185. case WM_CLOSE:
  186. {
  187. HWND Window=TitleBarThis->GetSafeHwnd();
  188. TitleBarThis->FreePictures();
  189. DestroyWindow(Window);
  190. PostQuitMessage(0);
  191. return 0;
  192. }
  193. case WM_DESTROY:
  194. TitleBarThis->FreePictures();
  195. PostQuitMessage(0);
  196. return 0;
  197. case WM_DRAWITEM:
  198. {
  199. HDC hdcMem; 
  200. LPDRAWITEMSTRUCT lpdis; 
  201.             lpdis = (LPDRAWITEMSTRUCT) lParam; 
  202.             hdcMem = CreateCompatibleDC(lpdis->hDC); 
  203.  
  204. if(lpdis->CtlID==tbIDC_CLOSE)
  205. SelectObject(hdcMem, TitleBarThis->hClose); 
  206. if(lpdis->CtlID==tbIDC_MAXIMIZE)
  207. SelectObject(hdcMem, TitleBarThis->hMaximize); 
  208. if(lpdis->CtlID==tbIDC_MINIMIZE)
  209. SelectObject(hdcMem, TitleBarThis->hMinimize); 
  210. if(lpdis->CtlID==tbIDC_PIN)
  211. {
  212. if(TitleBarThis->AutoHide==TRUE)
  213. SelectObject(hdcMem, TitleBarThis->hPinUp); 
  214. else
  215. SelectObject(hdcMem, TitleBarThis->hPinDown); 
  216. }
  217. BitBlt(lpdis->hDC,
  218. lpdis->rcItem.left,
  219. lpdis->rcItem.top,
  220.                 lpdis->rcItem.right - lpdis->rcItem.left, 
  221. lpdis->rcItem.bottom - lpdis->rcItem.top, 
  222.                 hdcMem,
  223. 0,
  224. 0,
  225. SRCCOPY);
  226.  
  227.             DeleteDC(hdcMem); 
  228.             return TRUE; 
  229. }
  230. case WM_COMMAND: 
  231. if (HIWORD(wParam) == BN_CLICKED)
  232. {
  233. //Handle the Pin for holding the window
  234. if(LOWORD(wParam) == tbIDC_PIN)
  235. {
  236. if(TitleBarThis->AutoHide==TRUE)
  237. {
  238. TitleBarThis->AutoHide=FALSE;
  239. TitleBarThis->DisplayWindow(TRUE);
  240. }
  241. else
  242. {
  243. TitleBarThis->AutoHide=TRUE;
  244. TitleBarThis->DisplayWindow(FALSE);
  245. }
  246. //Redraw window to show the new gfx...
  247. ::RedrawWindow(TitleBarThis->Pin, NULL, NULL, TRUE);
  248. }
  249. //If default = true we'll send usally showwindow and close messages
  250. if(tbDefault==TRUE)
  251. {
  252. if(LOWORD(wParam) == tbIDC_CLOSE)
  253. ::SendMessage(TitleBarThis->Parent, WM_CLOSE, NULL, NULL);
  254. if(LOWORD(wParam) == tbIDC_MAXIMIZE)
  255. {
  256. if(::IsZoomed(TitleBarThis->Parent)==TRUE)
  257. ShowWindow(TitleBarThis->Parent, SW_RESTORE);
  258. else
  259. ShowWindow(TitleBarThis->Parent, SW_MAXIMIZE);
  260. }
  261. if(LOWORD(wParam) == tbIDC_MINIMIZE)
  262. ShowWindow(TitleBarThis->Parent, SW_MINIMIZE);
  263. }
  264. else //default = false - send custom message on buttons
  265. {
  266. if(LOWORD(wParam) == tbIDC_CLOSE)
  267. ::SendMessage(TitleBarThis->Parent, tbWM_CLOSE, NULL, NULL);
  268. if(LOWORD(wParam) == tbIDC_MAXIMIZE)
  269. ::SendMessage(TitleBarThis->Parent, tbWM_MAXIMIZE, NULL, NULL);
  270. if(LOWORD(wParam) == tbIDC_MINIMIZE)
  271. ::SendMessage(TitleBarThis->Parent, tbWM_MINIMIZE, NULL, NULL);
  272. }
  273.         }
  274. //Menu part starts here
  275. {
  276. UINT IDNum=LOWORD(wParam);
  277. if(IDNum>=tbWMCOMMANDIDStart&&IDNum<tbWMCOMMANDIDEnd) //The ID is in range for a menuclick
  278. {
  279. UINT Num=IDNum-tbWMCOMMANDIDStart;
  280. //When the close,minimize, maximize is not present just send! :)
  281. if(tbLastIsStandard==FALSE)
  282. ::SendMessage(TitleBarThis->Parent, WM_USER+tbWMUSERID+Num, NULL,NULL);
  283. else //Handle close, minimize and maximize
  284. {
  285. HMENU Menu=LoadMenu(TitleBarThis->hInstance,MAKEINTRESOURCE (tbMENUID));
  286. HMENU SubMenu=GetSubMenu(Menu,0);;
  287. UINT Total=0;
  288. //Get the real number of entries (exluding seperators)
  289. for(int i=0;i<GetMenuItemCount(SubMenu);i++)
  290. {
  291. int res=::GetMenuString(SubMenu, i, NULL, 0, MF_BYPOSITION);
  292. if(res!=0)
  293. Total++;
  294. }
  295. if(Num==Total-1) //Close button
  296. ::SendMessage(TitleBarThis->m_hWnd,WM_COMMAND,MAKEWPARAM(tbIDC_CLOSE,BN_CLICKED),NULL);
  297. else if(Num==Total-2) //Minimize button
  298. ::SendMessage(TitleBarThis->m_hWnd,WM_COMMAND,MAKEWPARAM(tbIDC_MINIMIZE,BN_CLICKED),NULL);
  299. else if(Num==Total-3) //Maximize button
  300. ::SendMessage(TitleBarThis->m_hWnd,WM_COMMAND,MAKEWPARAM(tbIDC_MAXIMIZE,BN_CLICKED),NULL);
  301. else
  302. ::SendMessage(TitleBarThis->Parent, WM_USER+tbWMUSERID+Num, NULL,NULL);
  303. DestroyMenu (SubMenu);
  304. DestroyMenu (Menu);
  305. }
  306. }
  307. }
  308.         break;
  309. case WM_MOUSEMOVE:
  310. if(TitleBarThis->HideAfterSlide==FALSE)
  311. {
  312. TitleBarThis->SlideDown=TRUE;
  313. ::SetTimer(TitleBarThis->m_hWnd, tbScrollTimerID, 20, NULL);
  314. }
  315. break;
  316. case WM_LBUTTONDBLCLK:
  317. //If the default entries on the context menu is activated then doubleclick is restore :)
  318. if(tbLastIsStandard==TRUE)
  319. ::SendMessage(TitleBarThis->m_hWnd,WM_COMMAND,MAKEWPARAM(tbIDC_MAXIMIZE,BN_CLICKED),NULL);
  320. break;
  321.     
  322. case WM_RBUTTONDOWN:
  323. {
  324. HMENU Menu=LoadMenu(TitleBarThis->hInstance,MAKEINTRESOURCE (tbMENUID));
  325. HMENU SubMenu=GetSubMenu(Menu,0);;
  326. POINT  lpPoint;
  327. ::GetCursorPos(&lpPoint);
  328. int Pos=0;
  329. //Set ID values to each item
  330. for(int i=0;i<GetMenuItemCount(SubMenu);i++)
  331. {
  332. TCHAR Text[MAX_PATH];
  333. ZeroMemory(Text,sizeof(LPTSTR));
  334. int res=::GetMenuString(SubMenu, i, Text, MAX_PATH, MF_BYPOSITION);
  335. if(res!=0)
  336. {
  337. ::ModifyMenu(SubMenu,i,MF_BYPOSITION, tbWMCOMMANDIDStart+Pos,Text);
  338. Pos++;
  339. }
  340. }
  341. //Loop through each item from pos to set the default value on restore
  342. if(tbLastIsStandard==TRUE)
  343. {
  344. int RealPos=0;
  345. for(int i=0;i<GetMenuItemCount(SubMenu);i++)
  346. {
  347. TCHAR Text[MAX_PATH];
  348. ZeroMemory(Text,sizeof(LPTSTR));
  349. int res=::GetMenuString(SubMenu, i, Text, MAX_PATH, MF_BYPOSITION);
  350. if(res!=0)
  351. {
  352. RealPos++;
  353. if(RealPos==Pos-2)
  354. ::SetMenuDefaultItem(SubMenu, i, TRUE);
  355. }
  356. }
  357. }
  358. TrackPopupMenu(SubMenu,TPM_LEFTALIGN, lpPoint.x, lpPoint.y, 0, TitleBarThis->m_hWnd, NULL);
  359. SetForegroundWindow (TitleBarThis->m_hWnd);
  360. DestroyMenu (SubMenu);
  361. DestroyMenu (Menu);
  362. break;
  363. }
  364.     /**/
  365. case WM_TIMER:
  366. {
  367. UINT TimerID=(UINT)wParam;
  368. if(TimerID==tbScrollTimerID)
  369. {
  370. RECT lpRect;
  371. ::GetWindowRect(TitleBarThis->m_hWnd, &lpRect);
  372. if( ((lpRect.top==0)&&(TitleBarThis->SlideDown==TRUE))
  373. ||
  374. ((lpRect.top==-tbHeigth+1)&&(TitleBarThis->SlideDown==FALSE)))
  375. {
  376. KillTimer(TitleBarThis->m_hWnd, tbScrollTimerID);
  377. if(TitleBarThis->HideAfterSlide==TRUE)
  378. {
  379. TitleBarThis->HideAfterSlide=FALSE;
  380. ShowWindow(TitleBarThis->GetSafeHwnd(), SW_HIDE);
  381. }
  382. return 0;
  383. }
  384. if(TitleBarThis->SlideDown==TRUE)
  385. {
  386. lpRect.top++; lpRect.bottom++;
  387. }
  388. else
  389. {
  390. lpRect.top--; lpRect.bottom--;
  391. }
  392. ::MoveWindow(TitleBarThis->m_hWnd, lpRect.left, lpRect.top, lpRect.right-lpRect.left, lpRect.bottom-lpRect.top, TRUE);
  393. }
  394. //Check mouse cordinates and hide if the mouse haven't been in the window for a few seconds
  395. if(TimerID==tbAutoScrollTimer)
  396. {
  397. RECT lpRect;
  398. POINT pt;
  399. ::GetWindowRect(TitleBarThis->m_hWnd, &lpRect);
  400. ::GetCursorPos(&pt);
  401. if(PtInRect(&lpRect, pt)==FALSE) 
  402. {
  403. TitleBarThis->IntAutoHideCounter++;
  404. if(TitleBarThis->IntAutoHideCounter==tbAutoScrollTime)
  405. {
  406. TitleBarThis->SlideDown=FALSE;
  407. ::SetTimer(TitleBarThis->m_hWnd, tbScrollTimerID, tbScrollDelay, NULL);
  408. }
  409. }
  410. else
  411. {
  412. TitleBarThis->IntAutoHideCounter=0;
  413. }
  414. }
  415. break;
  416. }
  417. }//Case - end
  418. return DefWindowProc(hwnd, iMsg, wParam, lParam);
  419. }
  420. //***************************************************************************************
  421. void CTitleBar::LoadPictures()
  422. {
  423. hClose=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_CLOSE));
  424. hMaximize=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MAXIMIZE));
  425. hMinimize=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MINIMIZE));
  426. hPinUp=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PINUP));
  427. hPinDown=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PINDOWN));
  428. }
  429. void CTitleBar::FreePictures()
  430. {
  431. DeleteObject(hClose);
  432. DeleteObject(hMaximize);
  433. DeleteObject(hMinimize);
  434. DeleteObject(hPinUp);
  435. DeleteObject(hPinDown);
  436. }
  437. //***************************************************************************************
  438. void CTitleBar::Draw()
  439. {
  440. PAINTSTRUCT ps;
  441. HDC hdc = BeginPaint(m_hWnd, &ps);
  442. int r1 = GetRValue(tbStartColor);
  443. int g1 = GetGValue(tbStartColor);
  444. int b1 = GetBValue(tbStartColor);
  445. int r2 = GetRValue(tbEndColor);
  446. int g2 = GetGValue(tbEndColor);
  447. int b2 = GetBValue(tbEndColor);
  448. //2 different styles of gradient is available... :)
  449. if(tbGradientWay==TRUE)
  450. {
  451. for ( int x = 0; x<tbWidth; x++)
  452. RECT Rect;
  453. Rect.left=x;
  454. Rect.top=0;
  455. Rect.right=x+1;
  456. Rect.bottom=tbHeigth;
  457. HBRUSH Brush=CreateSolidBrush(RGB(r1 * (tbWidth-x)/tbWidth + r2 * x/tbWidth, 
  458. g1 * (tbWidth-x)/tbWidth + g2 * x/tbWidth, b1 * (tbWidth-x)/tbWidth + b2 * x/tbWidth));
  459. ::FillRect(hdc, &Rect, Brush);
  460. DeleteObject(Brush);
  461. }
  462. }
  463. else
  464. {
  465. for ( int y = 0; y<tbHeigth; y++)
  466. RECT Rect;
  467. Rect.left=0;
  468. Rect.top=y;
  469. Rect.right=tbWidth;
  470. Rect.bottom=y+1;
  471. HBRUSH Brush=CreateSolidBrush(RGB(r1 * (tbHeigth-y)/tbHeigth + r2 * y/tbHeigth, 
  472. g1 * (tbHeigth-y)/tbHeigth + g2 * y/tbHeigth, b1 * (tbHeigth-y)/tbHeigth + b2 * y/tbHeigth));
  473. ::FillRect(hdc, &Rect, Brush);
  474. DeleteObject(Brush);
  475. }
  476. }
  477. //Draw border around window
  478. HPEN Border=::CreatePen(PS_SOLID, tbBorderWidth, tbBorderPenColor);
  479. ::SelectObject(hdc, Border);
  480. //Draw border around window
  481. ::MoveToEx(hdc, 0,0, NULL);
  482. ::LineTo(hdc, tbTriangularPoint, tbHeigth);
  483. ::LineTo(hdc, tbWidth-tbTriangularPoint, tbHeigth);
  484. ::LineTo(hdc, tbWidth, 0);
  485. ::LineTo(hdc, 0,0);
  486. //Draw extra shadow at bottom
  487. DeleteObject(Border);
  488. Border=::CreatePen(PS_SOLID, tbBorderWidth, tbBorderPenShadow);
  489. ::SelectObject(hdc, Border);
  490. ::MoveToEx(hdc, tbTriangularPoint+1,tbHeigth-1, NULL);
  491. ::LineTo(hdc, tbWidth-tbTriangularPoint-1, tbHeigth-1);
  492. //Create rect for drawin the text
  493. RECT lpRect;
  494. lpRect.left=tbLeftSpace+tbcxPicture+tbButtonSpace;
  495. lpRect.top=tbBorderWidth;
  496. lpRect.right=tbWidth-tbRightSpace-(tbcxPicture*3)-(tbButtonSpace*3);
  497. lpRect.bottom=tbHeigth-tbBorderWidth;
  498. //Draw text
  499. ::SelectObject(hdc, Font);
  500. ::SetBkMode(hdc, TRANSPARENT);
  501. ::SetTextColor(hdc, tbTextColor);
  502. ::DrawText(hdc, Text,-1,&lpRect, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
  503. EndPaint(m_hWnd, &ps);
  504. }
  505. //***************************************************************************************
  506. void CTitleBar::SetText(LPTSTR TextOut)
  507. {
  508. Text=TextOut;
  509. }
  510. //***************************************************************************************
  511. void CTitleBar::DisplayWindow(BOOL Show, BOOL SetHideFlag)
  512. {
  513. IntAutoHideCounter=0;
  514. if(Show==TRUE)
  515. {
  516. if(tbScrollWindow==TRUE)
  517. {
  518. if(SetHideFlag==TRUE)
  519. {
  520. HideAfterSlide=FALSE;
  521. SlideDown=TRUE;
  522. }
  523. ShowWindow(m_hWnd, SW_SHOW);
  524. SetTimer(m_hWnd, tbScrollTimerID, tbScrollDelay, NULL);
  525. }
  526. else
  527. ShowWindow(m_hWnd, SW_SHOW);
  528. if(AutoHide==TRUE)
  529. SetTimer(m_hWnd, tbAutoScrollTimer, tbAutoScrollDelay, NULL);
  530. else
  531. KillTimer(m_hWnd, tbAutoScrollTimer);
  532. }
  533. else
  534. {
  535. if(tbScrollWindow==TRUE)
  536. {
  537. if(SetHideFlag==TRUE)
  538. {
  539. HideAfterSlide=TRUE;
  540. SlideDown=FALSE;
  541. }
  542. SetTimer(m_hWnd, tbScrollTimerID, tbScrollDelay, NULL);
  543. }
  544. else
  545. ShowWindow(m_hWnd, SW_HIDE);
  546. if(AutoHide==TRUE)
  547. SetTimer(m_hWnd, tbAutoScrollTimer, tbAutoScrollDelay, NULL);
  548. else
  549. KillTimer(m_hWnd, tbAutoScrollTimer);
  550. }
  551. }
  552. //***************************************************************************************