TaskbarNotifier.cpp
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:15k
源码类别:

网格计算

开发平台:

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. CString stipinfo = szBuffer;
  404. int nlen = stipinfo.GetLength();
  405. if(nlen > 50)
  406. {
  407. nlen = 50;
  408. stipinfo = stipinfo.Left(nlen) + "......";
  409. }
  410. nlen = stipinfo.GetLength();
  411. dc.DrawText(stipinfo.GetBuffer(0), nlen, m_rcText, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_WORD_ELLIPSIS);
  412. delete[] szBuffer;
  413. dc.SelectObject(pOldFont);
  414. }
  415. BOOL CTaskbarNotifier::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
  416. {
  417. if (nHitTest == HTCLIENT)
  418. {
  419. ::SetCursor(m_hCursor);
  420. return TRUE;
  421. }
  422. return CWnd::OnSetCursor(pWnd, nHitTest, message);
  423. }
  424. void CTaskbarNotifier::OnTimer(UINT nIDEvent)
  425. {
  426. switch (nIDEvent)
  427. {
  428. case IDT_APPEARING:
  429. m_nAnimStatus=IDT_APPEARING;
  430. switch(m_nTaskbarPlacement)
  431. {
  432. case TASKBAR_ON_BOTTOM:
  433. if (m_nCurrentPosY>(m_nStartPosY-m_nSkinHeight))
  434. m_nCurrentPosY-=m_nIncrement;
  435. else
  436. {
  437. KillTimer(IDT_APPEARING);
  438. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  439. m_nAnimStatus=IDT_WAITING;
  440. }
  441. break;
  442. case TASKBAR_ON_TOP:
  443. if ((m_nCurrentPosY-m_nStartPosY)<m_nSkinHeight)
  444. m_nCurrentPosY+=m_nIncrement;
  445. else
  446. {
  447. KillTimer(IDT_APPEARING);
  448. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  449. m_nAnimStatus=IDT_WAITING;
  450. }
  451. break;
  452. case TASKBAR_ON_LEFT:
  453. if ((m_nCurrentPosX-m_nStartPosX)<m_nSkinWidth)
  454. m_nCurrentPosX+=m_nIncrement;
  455. else
  456. {
  457. KillTimer(IDT_APPEARING);
  458. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  459. m_nAnimStatus=IDT_WAITING;
  460. }
  461. break;
  462. case TASKBAR_ON_RIGHT:
  463. if (m_nCurrentPosX>(m_nStartPosX-m_nSkinWidth))
  464. m_nCurrentPosX-=m_nIncrement;
  465. else
  466. {
  467. KillTimer(IDT_APPEARING);
  468. SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
  469. m_nAnimStatus=IDT_WAITING;
  470. }
  471. break;
  472. }
  473. SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE);
  474. //RedrawWindow();
  475. break;
  476. case IDT_WAITING:
  477.                   KillTimer(IDT_WAITING);
  478. SetTimer(IDT_DISAPPEARING,m_dwDelayBetweenHideEvents,NULL);
  479. break;
  480. case IDT_DISAPPEARING:
  481. m_nAnimStatus=IDT_DISAPPEARING;
  482. switch(m_nTaskbarPlacement)
  483. {
  484. case TASKBAR_ON_BOTTOM:
  485. if (m_nCurrentPosY<m_nStartPosY)
  486. m_nCurrentPosY+=m_nIncrement;
  487. else
  488. {
  489. KillTimer(IDT_DISAPPEARING);
  490. Hide();
  491. }
  492. break;
  493. case TASKBAR_ON_TOP:
  494. if (m_nCurrentPosY>m_nStartPosY)
  495. m_nCurrentPosY-=m_nIncrement;
  496. else
  497. {
  498. KillTimer(IDT_DISAPPEARING);
  499. Hide();
  500. }
  501. break;
  502. case TASKBAR_ON_LEFT:
  503. if (m_nCurrentPosX>m_nStartPosX)
  504. m_nCurrentPosX-=m_nIncrement;
  505. else
  506. {
  507. KillTimer(IDT_DISAPPEARING);
  508. Hide();
  509. }
  510. break;
  511. case TASKBAR_ON_RIGHT:
  512. if (m_nCurrentPosX<m_nStartPosX)
  513. m_nCurrentPosX+=m_nIncrement;
  514. else
  515. {
  516. KillTimer(IDT_DISAPPEARING);
  517. Hide();
  518. }
  519. break;
  520. }
  521. SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE);
  522. //RedrawWindow();
  523. break;
  524. }
  525. CWnd::OnTimer(nIDEvent);
  526. }