TaskbarNotifier.cpp
上传用户:dengkfang
上传日期:2008-12-30
资源大小:5233k
文件大小:15k
源码类别:

CA认证

开发平台:

Visual C++

  1. // TaskbarNotifier.cpp : implementation file
  2. // By John O'Byrne - 05 July 2002
  3. #include "stdafx.h"
  4. #include "TaskbarNotifier.h"
  5. #define IDT_HIDDEN 0
  6. #define IDT_APPEARING 1
  7. #define IDT_WAITING 2
  8. #define IDT_DISAPPEARING 3
  9. #define TASKBAR_ON_TOP 1
  10. #define TASKBAR_ON_LEFT 2
  11. #define TASKBAR_ON_RIGHT 3
  12. #define TASKBAR_ON_BOTTOM 4
  13. // CTaskbarNotifier
  14. IMPLEMENT_DYNAMIC(CTaskbarNotifier, CWnd)
  15. CTaskbarNotifier::CTaskbarNotifier()
  16. {
  17. m_strCaption="";
  18. m_pWndParent=NULL;
  19. m_bMouseIsOver=FALSE;
  20. m_hSkinRegion=NULL;
  21. m_hCursor=NULL;
  22. m_crNormalTextColor=RGB(133,146,181);
  23. m_crSelectedTextColor=RGB(10,36,106);
  24. m_nSkinHeight=0;
  25. m_nSkinWidth=0;
  26. m_dwTimeToShow=0;
  27. m_dwTimeToLive=0;
  28. m_dwTimeToHide=0;
  29. m_dwDelayBetweenShowEvents=0;
  30. m_dwDelayBetweenHideEvents=0;
  31. m_nStartPosX=0;
  32. m_nStartPosY=0;
  33. m_nCurrentPosX=0;
  34. m_nCurrentPosY=0;
  35. m_nIncrement=2;
  36. m_nTaskbarPlacement=0;
  37. m_nAnimStatus=IDT_HIDDEN;
  38. m_rcText.SetRect(0,0,0,0);
  39. }
  40. CTaskbarNotifier::~CTaskbarNotifier()
  41. {
  42. // No need to delete the HRGN,  SetWindowRgn() owns it after being called
  43. }
  44. int CTaskbarNotifier::Create(CWnd *pWndParent)
  45. {
  46. m_pWndParent=pWndParent;
  47. CString strWndClass=AfxRegisterWndClass(0,AfxGetApp()->LoadStandardCursor(IDC_ARROW),GetSysColorBrush(COLOR_WINDOW),NULL);
  48. return CreateEx(0,strWndClass,NULL,WS_POPUP,0,0,0,0,pWndParent->m_hWnd,NULL);
  49. }
  50. void CTaskbarNotifier::SetTextFont(LPCTSTR szFont,int nSize,int nNormalStyle,int nSelectedStyle)
  51. {
  52. LOGFONT lf;
  53. m_myNormalFont.DeleteObject();
  54. m_myNormalFont.CreatePointFont(nSize,szFont);
  55. m_myNormalFont.GetLogFont(&lf);
  56. // We  set the Font of the unselected ITEM
  57. if (nNormalStyle & TN_TEXT_BOLD)
  58. lf.lfWeight = FW_BOLD;
  59. else
  60. lf.lfWeight = FW_NORMAL;
  61. if (nNormalStyle & TN_TEXT_ITALIC)
  62. lf.lfItalic=TRUE;
  63. else
  64. lf.lfItalic=FALSE;
  65. if (nNormalStyle & TN_TEXT_UNDERLINE)
  66. lf.lfUnderline=TRUE;
  67. else
  68. lf.lfUnderline=FALSE;
  69. m_myNormalFont.DeleteObject();
  70. m_myNormalFont.CreateFontIndirect(&lf);
  71. // We set the Font of the selected ITEM
  72. if (nSelectedStyle & TN_TEXT_BOLD)
  73. lf.lfWeight = FW_BOLD;
  74. else
  75. lf.lfWeight = FW_NORMAL;
  76. if (nSelectedStyle & TN_TEXT_ITALIC)
  77. lf.lfItalic=TRUE;
  78. else
  79. lf.lfItalic=FALSE;
  80. if (nSelectedStyle & TN_TEXT_UNDERLINE)
  81. lf.lfUnderline=TRUE;
  82. else
  83. lf.lfUnderline=FALSE;
  84. m_mySelectedFont.DeleteObject();
  85. m_mySelectedFont.CreateFontIndirect(&lf);
  86. }
  87. void CTaskbarNotifier::SetTextColor(COLORREF crNormalTextColor,COLORREF crSelectedTextColor)
  88. {
  89. m_crNormalTextColor=crNormalTextColor;
  90. m_crSelectedTextColor=crSelectedTextColor;
  91. RedrawWindow();
  92. }
  93. void CTaskbarNotifier::SetTextRect(RECT rcText)
  94. {
  95. m_rcText=rcText;
  96. }
  97. BOOL CTaskbarNotifier::SetSkin(UINT nBitmapID,short red,short green,short blue)
  98. {
  99. BITMAP bm;
  100. m_biSkinBackground.DeleteObject();
  101. if (!m_biSkinBackground.LoadBitmap(nBitmapID))
  102. return FALSE;
  103. GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
  104. m_nSkinWidth=bm.bmWidth;
  105. m_nSkinHeight=bm.bmHeight;
  106. m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight);
  107. if (red!=-1 && green!=-1 && blue!=-1)
  108. {
  109. // No need to delete the HRGN,  SetWindowRgn() owns it after being called
  110. m_hSkinRegion=GenerateRegion((HBITMAP)m_biSkinBackground.GetSafeHandle(),(BYTE) red,(BYTE) green,(BYTE) blue);
  111. SetWindowRgn(m_hSkinRegion, true);
  112. }
  113. return TRUE;
  114. }
  115. BOOL CTaskbarNotifier::SetSkin(LPCTSTR szFileName,short red,short green,short blue)
  116. {
  117. BITMAP bm;
  118. HBITMAP hBmp;
  119. hBmp=(HBITMAP) ::LoadImage(AfxGetInstanceHandle(),szFileName,IMAGE_BITMAP,0,0, LR_LOADFROMFILE);
  120. if (!hBmp)
  121. return FALSE;
  122. m_biSkinBackground.DeleteObject();
  123. m_biSkinBackground.Attach(hBmp);
  124. GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
  125. m_nSkinWidth=bm.bmWidth;
  126. m_nSkinHeight=bm.bmHeight;
  127. m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight);
  128. if (red!=-1 && green!=-1 && blue!=-1)
  129. {
  130. // No need to delete the HRGN,  SetWindowRgn() owns it after being called
  131. m_hSkinRegion=GenerateRegion((HBITMAP)m_biSkinBackground.GetSafeHandle(),(BYTE) red,(BYTE) green,(BYTE) blue);
  132. SetWindowRgn(m_hSkinRegion, true);
  133. }
  134. return TRUE;
  135. }
  136. void CTaskbarNotifier::Show(LPCTSTR szCaption,DWORD dwTimeToShow,DWORD dwTimeToLive,DWORD dwTimeToHide,int nIncrement)
  137. {
  138. unsigned int nDesktopHeight;
  139. unsigned int nDesktopWidth;
  140. unsigned int nScreenWidth;
  141. unsigned int nScreenHeight;
  142. CRect rcDesktop;
  143. m_strCaption=szCaption;
  144. m_dwTimeToShow=dwTimeToShow;
  145. m_dwTimeToLive=dwTimeToLive;
  146. m_dwTimeToHide=dwTimeToHide;
  147. ::SystemParametersInfo(SPI_GETWORKAREA,0,&rcDesktop,0);
  148. nDesktopWidth=rcDesktop.right-rcDesktop.left;
  149. nDesktopHeight=rcDesktop.bottom-rcDesktop.top;
  150. nScreenWidth=::GetSystemMetrics(SM_CXSCREEN);
  151. nScreenHeight=::GetSystemMetrics(SM_CYSCREEN);
  152. BOOL bTaskbarOnRight=nDesktopWidth<nScreenWidth && rcDesktop.left==0;
  153. BOOL bTaskbarOnLeft=nDesktopWidth<nScreenWidth && rcDesktop.left!=0;
  154. BOOL bTaskBarOnTop=nDesktopHeight<nScreenHeight && rcDesktop.top!=0;
  155. BOOL bTaskbarOnBottom=nDesktopHeight<nScreenHeight && rcDesktop.top==0;
  156. switch (m_nAnimStatus)
  157. {
  158. case IDT_HIDDEN:
  159. ShowWindow(SW_SHOW);
  160. if (bTaskbarOnRight)
  161. {
  162. m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinWidth/m_nIncrement);
  163. m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinWidth/m_nIncrement);
  164. m_nStartPosX=rcDesktop.right;
  165. m_nStartPosY=rcDesktop.bottom-m_nSkinHeight;
  166. m_nTaskbarPlacement=TASKBAR_ON_RIGHT;
  167. }
  168. else if (bTaskbarOnLeft)
  169. {
  170. m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinWidth/m_nIncrement);
  171. m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinWidth/m_nIncrement);
  172. m_nStartPosX=rcDesktop.left-m_nSkinWidth;
  173. m_nStartPosY=rcDesktop.bottom-m_nSkinHeight;
  174. m_nTaskbarPlacement=TASKBAR_ON_LEFT;
  175. }
  176. else if (bTaskBarOnTop)
  177. {
  178. m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinHeight/m_nIncrement);
  179. m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinHeight/m_nIncrement);
  180. m_nStartPosX=rcDesktop.right-m_nSkinWidth;
  181. m_nStartPosY=rcDesktop.top-m_nSkinHeight;
  182. m_nTaskbarPlacement=TASKBAR_ON_TOP;
  183. }
  184. else //if (bTaskbarOnBottom)
  185. {
  186. // Taskbar is on the bottom or Invisible
  187. m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinHeight/m_nIncrement);
  188. m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinHeight/m_nIncrement);
  189. m_nStartPosX=rcDesktop.right-m_nSkinWidth;
  190. m_nStartPosY=rcDesktop.bottom;
  191. m_nTaskbarPlacement=TASKBAR_ON_BOTTOM;
  192. }
  193. m_nCurrentPosX=m_nStartPosX;
  194. m_nCurrentPosY=m_nStartPosY;
  195. SetTimer(IDT_APPEARING,m_dwDelayBetweenShowEvents,NULL);
  196. break;
  197. case IDT_WAITING:
  198. RedrawWindow();
  199. KillTimer(IDT_WAITING);
  200. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  201. break;
  202. case IDT_APPEARING:
  203. RedrawWindow();
  204. break;
  205. case IDT_DISAPPEARING:
  206. KillTimer(IDT_DISAPPEARING);
  207. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  208. if (bTaskbarOnRight)
  209. m_nCurrentPosX=rcDesktop.right-m_nSkinWidth;
  210. else if (bTaskbarOnLeft)
  211. m_nCurrentPosX=rcDesktop.left;
  212. else if (bTaskBarOnTop)
  213. m_nCurrentPosY=rcDesktop.top;
  214. else //if (bTaskbarOnBottom)
  215. m_nCurrentPosY=rcDesktop.bottom-m_nSkinHeight;
  216. SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE);
  217. RedrawWindow();
  218. break;
  219. }
  220. }
  221. void CTaskbarNotifier::Hide()
  222. {
  223. switch (m_nAnimStatus)
  224. {
  225. case IDT_APPEARING:
  226. KillTimer(IDT_APPEARING);
  227. break;
  228. case IDT_WAITING:
  229. KillTimer(IDT_WAITING);
  230. break;
  231. case IDT_DISAPPEARING:
  232. KillTimer(IDT_DISAPPEARING);
  233. break;
  234. }
  235. MoveWindow(0,0,0,0);
  236. ShowWindow(SW_HIDE);
  237. m_nAnimStatus=IDT_HIDDEN;
  238. }
  239. HRGN CTaskbarNotifier::GenerateRegion(HBITMAP hBitmap, BYTE red, BYTE green, BYTE blue)
  240. {
  241. WORD wBmpWidth,wBmpHeight;
  242. HRGN hRgn, hTmpRgn;
  243. // 24bit pixels from the bitmap
  244. BYTE *pPixels = Get24BitPixels(hBitmap, &wBmpWidth, &wBmpHeight);
  245. if (!pPixels) return NULL;
  246. // create our working region
  247. hRgn = CreateRectRgn(0,0,wBmpWidth,wBmpHeight);
  248. if (!hRgn) { delete pPixels; return NULL; }
  249. DWORD p=0;
  250. for (WORD y=0; y<wBmpHeight; y++)
  251. {
  252. for (WORD x=0; x<wBmpWidth; x++)
  253. {
  254. BYTE jRed   = pPixels[p+2];
  255. BYTE jGreen = pPixels[p+1];
  256. BYTE jBlue  = pPixels[p+0];
  257. if (jRed==red && jGreen==green && jBlue==blue)
  258. {
  259. // remove transparent color from region
  260. hTmpRgn = CreateRectRgn(x,y,x+1,y+1);
  261. CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
  262. DeleteObject(hTmpRgn);
  263. }
  264. // next pixel
  265. p+=3;
  266. }
  267. }
  268. // release pixels
  269. delete pPixels;
  270. // return the region
  271. return hRgn;
  272. }
  273. BYTE* CTaskbarNotifier::Get24BitPixels(HBITMAP pBitmap, WORD *pwWidth, WORD *pwHeight)
  274. {
  275. BITMAP bmpBmp;
  276. LPBITMAPINFO pbmiInfo;
  277. BITMAPINFO bmiInfo;
  278. WORD wBmpWidth, wBmpHeight;
  279. GetObject(pBitmap, sizeof(bmpBmp),&bmpBmp);
  280. pbmiInfo   = (LPBITMAPINFO)&bmpBmp;
  281. wBmpWidth  = (WORD)pbmiInfo->bmiHeader.biWidth;
  282. wBmpWidth -= (wBmpWidth%4);
  283. wBmpHeight = (WORD)pbmiInfo->bmiHeader.biHeight;
  284. *pwWidth  = wBmpWidth;
  285. *pwHeight = wBmpHeight;
  286. BYTE *pPixels = new BYTE[wBmpWidth*wBmpHeight*3];
  287. if (!pPixels) return NULL;
  288. HDC hDC =::GetWindowDC(NULL);
  289. bmiInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
  290. bmiInfo.bmiHeader.biWidth = wBmpWidth;
  291. bmiInfo.bmiHeader.biHeight = -wBmpHeight;
  292. bmiInfo.bmiHeader.biPlanes = 1;
  293. bmiInfo.bmiHeader.biBitCount = 24;
  294. bmiInfo.bmiHeader.biCompression = BI_RGB;
  295. bmiInfo.bmiHeader.biSizeImage = wBmpWidth*wBmpHeight*3;
  296. bmiInfo.bmiHeader.biXPelsPerMeter = 0;
  297. bmiInfo.bmiHeader.biYPelsPerMeter = 0;
  298. bmiInfo.bmiHeader.biClrUsed = 0;
  299. bmiInfo.bmiHeader.biClrImportant = 0;
  300. // get pixels from the original bitmap converted to 24bits
  301. int iRes = GetDIBits(hDC,pBitmap,0,wBmpHeight,(LPVOID)pPixels,&bmiInfo,DIB_RGB_COLORS);
  302. // release the device context
  303. ::ReleaseDC(NULL,hDC);
  304. // if failed, cancel the operation.
  305. if (!iRes)
  306. {
  307. delete pPixels;
  308. return NULL;
  309. };
  310. // return the pixel array
  311. return pPixels;
  312. }
  313. BEGIN_MESSAGE_MAP(CTaskbarNotifier, CWnd)
  314. ON_WM_CREATE()
  315. ON_WM_MOUSEMOVE()
  316. ON_WM_DESTROY()
  317. ON_WM_ERASEBKGND()
  318. ON_WM_PAINT()
  319. ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)
  320. ON_MESSAGE(WM_MOUSEHOVER, OnMouseHover)
  321. ON_WM_SETCURSOR()
  322. ON_WM_LBUTTONUP()
  323. ON_WM_TIMER()
  324. END_MESSAGE_MAP()
  325. // CTaskbarNotifier message handlers
  326. int CTaskbarNotifier::OnCreate(LPCREATESTRUCT lpCreateStruct)
  327. {
  328. if (CWnd::OnCreate(lpCreateStruct) == -1)
  329. return -1;
  330. m_hCursor = ::LoadCursor(NULL, MAKEINTRESOURCE(32649));
  331. return 0;
  332. }
  333. void CTaskbarNotifier::OnDestroy()
  334. {
  335. CWnd::OnDestroy();
  336. // TODO: Add your message handler code here
  337. }
  338. void CTaskbarNotifier::OnMouseMove(UINT nFlags, CPoint point)
  339. {
  340. TRACKMOUSEEVENT t_MouseEvent;
  341. t_MouseEvent.cbSize      = sizeof(TRACKMOUSEEVENT);
  342. t_MouseEvent.dwFlags     = TME_LEAVE | TME_HOVER;
  343. t_MouseEvent.hwndTrack   = m_hWnd;
  344. t_MouseEvent.dwHoverTime = 1;
  345. ::_TrackMouseEvent(&t_MouseEvent);
  346. CWnd::OnMouseMove(nFlags, point);
  347. }
  348. void CTaskbarNotifier::OnLButtonUp(UINT nFlags, CPoint point)
  349. {
  350. m_pWndParent->PostMessage(WM_TASKBARNOTIFIERCLICKED,0,0);
  351. CWnd::OnLButtonUp(nFlags, point);
  352. }
  353. LRESULT CTaskbarNotifier::OnMouseHover(WPARAM w, LPARAM l)
  354. {
  355. if (m_bMouseIsOver==FALSE)
  356. {
  357. m_bMouseIsOver=TRUE;
  358. RedrawWindow();
  359. }
  360. return 0;
  361. }
  362. LRESULT CTaskbarNotifier::OnMouseLeave(WPARAM w, LPARAM l)
  363. {
  364. if (m_bMouseIsOver==TRUE)
  365. {
  366. m_bMouseIsOver=FALSE;
  367. RedrawWindow();
  368. }
  369. return 0;
  370. }
  371. BOOL CTaskbarNotifier::OnEraseBkgnd(CDC* pDC)
  372. {
  373. CDC memDC;
  374. CBitmap *pOldBitmap;
  375. BITMAP bm;
  376. memDC.CreateCompatibleDC(pDC);
  377. GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm);
  378. pOldBitmap=memDC.SelectObject(&m_biSkinBackground);
  379. pDC->BitBlt(0,0,bm.bmWidth,bm.bmHeight,&memDC,0,0,SRCCOPY);
  380. memDC.SelectObject(pOldBitmap);
  381. return TRUE;
  382. }
  383. void CTaskbarNotifier::OnPaint()
  384. {
  385. CPaintDC dc(this);
  386. CRect rcClient;
  387. CFont *pOldFont;
  388. char *szBuffer;
  389. if (m_bMouseIsOver)
  390. {
  391. dc.SetTextColor(m_crSelectedTextColor);
  392. pOldFont=dc.SelectObject(&m_mySelectedFont);
  393. }
  394. else
  395. {
  396. dc.SetTextColor(m_crNormalTextColor);
  397. pOldFont=dc.SelectObject(&m_myNormalFont);
  398. }
  399. szBuffer=new char[m_strCaption.GetLength()+10];
  400. strcpy(szBuffer,m_strCaption);
  401. dc.SetBkMode(TRANSPARENT); 
  402. rcClient.DeflateRect(10,20,10,20);
  403. dc.DrawText(szBuffer,-1,m_rcText,DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_END_ELLIPSIS);
  404. delete[] szBuffer;
  405. dc.SelectObject(pOldFont);
  406. }
  407. BOOL CTaskbarNotifier::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
  408. {
  409. if (nHitTest == HTCLIENT)
  410. {
  411. ::SetCursor(m_hCursor);
  412. return TRUE;
  413. }
  414. return CWnd::OnSetCursor(pWnd, nHitTest, message);
  415. }
  416. void CTaskbarNotifier::OnTimer(UINT nIDEvent)
  417. {
  418. switch (nIDEvent)
  419. {
  420. case IDT_APPEARING:
  421. m_nAnimStatus=IDT_APPEARING;
  422. switch(m_nTaskbarPlacement)
  423. {
  424. case TASKBAR_ON_BOTTOM:
  425. if (m_nCurrentPosY>(m_nStartPosY-m_nSkinHeight))
  426. m_nCurrentPosY-=m_nIncrement;
  427. else
  428. {
  429. KillTimer(IDT_APPEARING);
  430. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  431. m_nAnimStatus=IDT_WAITING;
  432. }
  433. break;
  434. case TASKBAR_ON_TOP:
  435. if ((m_nCurrentPosY-m_nStartPosY)<m_nSkinHeight)
  436. m_nCurrentPosY+=m_nIncrement;
  437. else
  438. {
  439. KillTimer(IDT_APPEARING);
  440. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  441. m_nAnimStatus=IDT_WAITING;
  442. }
  443. break;
  444. case TASKBAR_ON_LEFT:
  445. if ((m_nCurrentPosX-m_nStartPosX)<m_nSkinWidth)
  446. m_nCurrentPosX+=m_nIncrement;
  447. else
  448. {
  449. KillTimer(IDT_APPEARING);
  450. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  451. m_nAnimStatus=IDT_WAITING;
  452. }
  453. break;
  454. case TASKBAR_ON_RIGHT:
  455. if (m_nCurrentPosX>(m_nStartPosX-m_nSkinWidth))
  456. m_nCurrentPosX-=m_nIncrement;
  457. else
  458. {
  459. KillTimer(IDT_APPEARING);
  460. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  461. m_nAnimStatus=IDT_WAITING;
  462. }
  463. break;
  464. }
  465. SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE);
  466. //RedrawWindow();
  467. break;
  468. case IDT_WAITING:
  469.                   KillTimer(IDT_WAITING);
  470. SetTimer(IDT_DISAPPEARING,m_dwDelayBetweenHideEvents,NULL);
  471. break;
  472. case IDT_DISAPPEARING:
  473. m_nAnimStatus=IDT_DISAPPEARING;
  474. switch(m_nTaskbarPlacement)
  475. {
  476. case TASKBAR_ON_BOTTOM:
  477. if (m_nCurrentPosY<m_nStartPosY)
  478. m_nCurrentPosY+=m_nIncrement;
  479. else
  480. {
  481. KillTimer(IDT_DISAPPEARING);
  482. Hide();
  483. }
  484. break;
  485. case TASKBAR_ON_TOP:
  486. if (m_nCurrentPosY>m_nStartPosY)
  487. m_nCurrentPosY-=m_nIncrement;
  488. else
  489. {
  490. KillTimer(IDT_DISAPPEARING);
  491. Hide();
  492. }
  493. break;
  494. case TASKBAR_ON_LEFT:
  495. if (m_nCurrentPosX>m_nStartPosX)
  496. m_nCurrentPosX-=m_nIncrement;
  497. else
  498. {
  499. KillTimer(IDT_DISAPPEARING);
  500. Hide();
  501. }
  502. break;
  503. case TASKBAR_ON_RIGHT:
  504. if (m_nCurrentPosX<m_nStartPosX)
  505. m_nCurrentPosX+=m_nIncrement;
  506. else
  507. {
  508. KillTimer(IDT_DISAPPEARING);
  509. Hide();
  510. }
  511. break;
  512. }
  513. SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE);
  514. //RedrawWindow();
  515. break;
  516. }
  517. CWnd::OnTimer(nIDEvent);
  518. }