├── .gitignore ├── COC ├── COC.cpp ├── COC.h ├── COC.rc ├── COC.vcxproj ├── COC.vcxproj.filters ├── COCDlg.cpp ├── COCDlg.h ├── Global.h ├── IHListBox.cpp ├── IHListBox.h ├── INI.cpp ├── INI.h ├── MainDoc.cpp ├── MainDoc.h ├── Message.h ├── ReadMe.txt ├── Server.cpp ├── Server.h ├── SettingDlg.cpp ├── SettingDlg.h ├── ShutDownDlg.cpp ├── ShutDownDlg.h ├── SkinPPWTL.h ├── TaskbarNotifier.cpp ├── TaskbarNotifier.h ├── Type.h ├── res │ ├── COC.ico │ ├── COC.rc2 │ └── bitmap1.bmp ├── resource.h ├── skin │ ├── AlphaOS.ssk │ ├── Anion.ssk │ ├── AquaOS.ssk │ ├── Aura.ssk │ ├── Beige.ssk │ ├── BlueStandard.ssk │ ├── Christmas.ssk │ ├── DameK UltraBlue.ssk │ ├── Devoir.ssk │ ├── FauxS-TOON.ssk │ ├── Gloss.ssk │ ├── Longhorn Silver.ssk │ ├── Longhorn.ssk │ ├── Longhorn5203.ssk │ ├── MAC.ssk │ ├── MSN Messenger.ssk │ ├── Mako.ssk │ ├── Noire.ssk │ ├── OSXP.ssk │ ├── Phenom.ssk │ ├── PixOS.spp │ ├── PurpleClass.ssk │ ├── RedCopper.ssk │ ├── RedStar.ssk │ ├── RisingDragon.ssk │ ├── Royale.ssk │ ├── Skin.ssk │ ├── SlickOS2.ssk │ ├── Steel.ssk │ ├── UMskin.ssk │ ├── Vista.ssk │ ├── XP-Home.ssk │ ├── XP-Luna.ssk │ ├── XP-Metallic.ssk │ ├── avfone.ssk │ ├── bOzen.ssk │ ├── bbq.ssk │ ├── blue.ssk │ ├── default.ssk │ ├── dogmax.ssk │ ├── dogmax2.ssk │ ├── ferix.spp │ ├── gold.ssk │ ├── green.ssk │ ├── machine.ssk │ ├── santa.ssk │ ├── spring.ssk │ ├── thinblue.ssk │ ├── vladstudio.ssk │ └── xp_corona.ssk ├── skinppwtl.dll ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── README.md ├── SetupCOC └── SetupCOC.vdproj └── coc_assistant.sln /.gitignore: -------------------------------------------------------------------------------- 1 | Thumbs.db 2 | *.obj 3 | *.exe 4 | *.pdb 5 | *.user 6 | *.aps 7 | *.pch 8 | *.vspscc 9 | *_i.c 10 | *_p.c 11 | *.ncb 12 | *.suo 13 | *.sln.docstates 14 | *.tlb 15 | *.tlh 16 | *.bak 17 | *.cache 18 | *.ilk 19 | *.log 20 | [Bb]in 21 | [Dd]ebug*/ 22 | *.lib 23 | *.sbr 24 | obj/ 25 | [Rr]elease*/ 26 | _ReSharper*/ 27 | [Tt]est[Rr]esult* 28 | *.vssscc 29 | $tf*/ -------------------------------------------------------------------------------- /COC/COC.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/COC.cpp -------------------------------------------------------------------------------- /COC/COC.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/COC.h -------------------------------------------------------------------------------- /COC/COC.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/COC.rc -------------------------------------------------------------------------------- /COC/COC.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {38DB18A4-2DDB-4FB3-9E04-D64270BF54B8} 15 | COC 16 | MFCProj 17 | 18 | 19 | 20 | Application 21 | true 22 | MultiByte 23 | Dynamic 24 | 25 | 26 | Application 27 | false 28 | true 29 | MultiByte 30 | Dynamic 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | Use 51 | Level3 52 | Disabled 53 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 54 | 55 | 56 | Windows 57 | true 58 | SkinPPWTL.lib;%(AdditionalDependencies) 59 | 60 | 61 | false 62 | true 63 | _DEBUG;%(PreprocessorDefinitions) 64 | 65 | 66 | 0x0804 67 | _DEBUG;%(PreprocessorDefinitions) 68 | $(IntDir);%(AdditionalIncludeDirectories) 69 | 70 | 71 | 72 | 73 | Level3 74 | Use 75 | MaxSpeed 76 | true 77 | true 78 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 79 | 80 | 81 | Windows 82 | true 83 | true 84 | true 85 | SkinPPWTL.lib;%(AdditionalDependencies) 86 | 87 | 88 | false 89 | true 90 | NDEBUG;%(PreprocessorDefinitions) 91 | 92 | 93 | 0x0804 94 | NDEBUG;%(PreprocessorDefinitions) 95 | $(IntDir);%(AdditionalIncludeDirectories) 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | Create 134 | Create 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /COC/COC.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 资源文件 21 | 22 | 23 | 资源文件 24 | 25 | 26 | 资源文件 27 | 28 | 29 | 资源文件 30 | 31 | 32 | 33 | 34 | 头文件 35 | 36 | 37 | 头文件 38 | 39 | 40 | 头文件 41 | 42 | 43 | 头文件 44 | 45 | 46 | 头文件 47 | 48 | 49 | 头文件 50 | 51 | 52 | 头文件 53 | 54 | 55 | 头文件 56 | 57 | 58 | 头文件 59 | 60 | 61 | 头文件 62 | 63 | 64 | 头文件 65 | 66 | 67 | 头文件 68 | 69 | 70 | 头文件 71 | 72 | 73 | 头文件 74 | 75 | 76 | 头文件 77 | 78 | 79 | 头文件 80 | 81 | 82 | 83 | 84 | 源文件 85 | 86 | 87 | 源文件 88 | 89 | 90 | 源文件 91 | 92 | 93 | 源文件 94 | 95 | 96 | 源文件 97 | 98 | 99 | 源文件 100 | 101 | 102 | 源文件 103 | 104 | 105 | 源文件 106 | 107 | 108 | 源文件 109 | 110 | 111 | 源文件 112 | 113 | 114 | 115 | 116 | 资源文件 117 | 118 | 119 | -------------------------------------------------------------------------------- /COC/COCDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/COCDlg.cpp -------------------------------------------------------------------------------- /COC/COCDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/COCDlg.h -------------------------------------------------------------------------------- /COC/Global.h: -------------------------------------------------------------------------------- 1 | /* 2 | *Global.h 3 | * 4 | *2011-08 5 | * 6 | */ 7 | #pragma once 8 | #ifndef _GLOBAL_H_ 9 | #define _GLOBAL_H_ 10 | 11 | 12 | /**************************************************************/ 13 | static const char g_simSeps[] = ",\n"; 14 | 15 | #define INI_AUTO_START 0 16 | #define INI_USR_PATH 1 17 | #define INI_POP_UP_NOTIFY 2 18 | #define INI_SKIN_PATH 3 19 | #define INI_AUTO_TYPE 4 20 | 21 | static const char* g_INI[] = 22 | { 23 | "auto start", 24 | "user path", 25 | "pop up notify", 26 | "skin path", 27 | "auto type" 28 | }; 29 | 30 | static const char appName[]= "clash of clans client"; 31 | 32 | #endif -------------------------------------------------------------------------------- /COC/IHListBox.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/IHListBox.cpp -------------------------------------------------------------------------------- /COC/IHListBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CIHListBox 5 | 6 | class CIHListBox : public CListBox 7 | { 8 | DECLARE_DYNAMIC(CIHListBox) 9 | 10 | public: 11 | CIHListBox(); 12 | virtual ~CIHListBox(); 13 | 14 | 15 | protected: 16 | DECLARE_MESSAGE_MAP() 17 | public: 18 | int AddString(LPCTSTR lpszltem); 19 | 20 | int InsertString(int nIndex, LPCTSTR lpszltem); 21 | void RefushHorizontalScrollBar(void); 22 | }; 23 | 24 | 25 | -------------------------------------------------------------------------------- /COC/INI.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/INI.cpp -------------------------------------------------------------------------------- /COC/INI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CINI 4 | { 5 | public: 6 | CINI(); 7 | ~CINI(); 8 | public: 9 | void WriteVal(LPCTSTR lpSection, LPCTSTR lpKey, const CString& outStr); 10 | void WriteVal(LPCTSTR lpSection, LPCTSTR lpKey, const CString& fileName, const CString& outStr); 11 | void WriteStruct(LPCTSTR lpszSection, LPCTSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, const CString& fileName); 12 | 13 | BOOL GetIntVal(LPCTSTR lpSection, LPCTSTR lpKey, int& retVal); 14 | BOOL GetStrVal(LPCTSTR lpSection, LPCTSTR lpKey, CString& retStr); 15 | 16 | BOOL GetIntVal(LPCTSTR lpSection, LPCTSTR lpKey, const CString& fileName, int& retVal); 17 | BOOL GetStrVal(LPCTSTR lpSection, LPCTSTR lpKey, const CString& fileName, CString& retStr); 18 | BOOL GetStruct(LPCTSTR lpszSection, LPCTSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, const CString& fileName); 19 | 20 | CString CreateINI(const CString& fileName); 21 | 22 | public: 23 | void SetValid(const BOOL& bValid); 24 | BOOL GetValid()const; 25 | BOOL IsFileExist(const CString& fileName); 26 | 27 | private: 28 | BOOL IsExist(); 29 | BOOL IsExistEx(LPCTSTR lpFileName); 30 | BOOL IsExistEx(); 31 | BOOL CreateINI(); 32 | void Init(); 33 | private: 34 | CString m_appINIPath; 35 | CString m_appDir; 36 | BOOL m_bValid; 37 | }; -------------------------------------------------------------------------------- /COC/MainDoc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/MainDoc.cpp -------------------------------------------------------------------------------- /COC/MainDoc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/MainDoc.h -------------------------------------------------------------------------------- /COC/Message.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WM_CONNECT_REQ WM_USER+2 4 | #define WM_CONNECT_ACK WM_USER+3 5 | #define WM_START_REQ WM_USER+4 6 | #define WM_START_ACK WM_USER+5 7 | #define WM_TIME_REQ WM_USER+6 8 | #define WM_TIME_ACK WM_USER+7 9 | #define WM_IP_REQ WM_USER+8 10 | #define WM_IP_ACK WM_USER+9 11 | #define WM_STOP_REQ WM_USER+10 12 | #define WM_STOP_ACK WM_USER+11 13 | 14 | -------------------------------------------------------------------------------- /COC/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/ReadMe.txt -------------------------------------------------------------------------------- /COC/Server.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/Server.cpp -------------------------------------------------------------------------------- /COC/Server.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/Server.h -------------------------------------------------------------------------------- /COC/SettingDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/SettingDlg.cpp -------------------------------------------------------------------------------- /COC/SettingDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/SettingDlg.h -------------------------------------------------------------------------------- /COC/ShutDownDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/ShutDownDlg.cpp -------------------------------------------------------------------------------- /COC/ShutDownDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/ShutDownDlg.h -------------------------------------------------------------------------------- /COC/SkinPPWTL.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luwei2012/COC_Server/dc3ed9704869908b9700461c8d6ad0f2c0f0365d/COC/SkinPPWTL.h -------------------------------------------------------------------------------- /COC/TaskbarNotifier.cpp: -------------------------------------------------------------------------------- 1 | // TaskbarNotifier.cpp : implementation file 2 | // By John O'Byrne - 05 July 2002 3 | 4 | #include "stdafx.h" 5 | #include "TaskbarNotifier.h" 6 | 7 | #define IDT_HIDDEN 0 8 | #define IDT_APPEARING 1 9 | #define IDT_WAITING 2 10 | #define IDT_DISAPPEARING 3 11 | 12 | #define TASKBAR_ON_TOP 1 13 | #define TASKBAR_ON_LEFT 2 14 | #define TASKBAR_ON_RIGHT 3 15 | #define TASKBAR_ON_BOTTOM 4 16 | 17 | // CTaskbarNotifier 18 | 19 | IMPLEMENT_DYNAMIC(CTaskbarNotifier, CWnd) 20 | CTaskbarNotifier::CTaskbarNotifier() 21 | { 22 | m_strCaption=""; 23 | m_pWndParent=NULL; 24 | m_bMouseIsOver=FALSE; 25 | m_hSkinRegion=NULL; 26 | m_hCursor=NULL; 27 | m_crNormalTextColor=RGB(133,146,181); 28 | m_crSelectedTextColor=RGB(10,36,106); 29 | m_nSkinHeight=0; 30 | m_nSkinWidth=0; 31 | 32 | m_dwTimeToShow=0; 33 | m_dwTimeToLive=0; 34 | m_dwTimeToHide=0; 35 | m_dwDelayBetweenShowEvents=0; 36 | m_dwDelayBetweenHideEvents=0; 37 | m_nStartPosX=0; 38 | m_nStartPosY=0; 39 | m_nCurrentPosX=0; 40 | m_nCurrentPosY=0; 41 | m_nIncrement=2; 42 | m_nTaskbarPlacement=0; 43 | m_nAnimStatus=IDT_HIDDEN; 44 | m_rcText.SetRect(0,0,0,0); 45 | } 46 | 47 | CTaskbarNotifier::~CTaskbarNotifier() 48 | { 49 | // No need to delete the HRGN, SetWindowRgn() owns it after being called 50 | } 51 | 52 | int CTaskbarNotifier::Create(CWnd *pWndParent) 53 | { 54 | m_pWndParent=pWndParent; 55 | CString strWndClass=AfxRegisterWndClass(0,AfxGetApp()->LoadStandardCursor(IDC_ARROW),GetSysColorBrush(COLOR_WINDOW),NULL); 56 | return CreateEx(0,strWndClass,NULL,WS_POPUP,0,0,0,0,pWndParent->m_hWnd,NULL); 57 | } 58 | 59 | void CTaskbarNotifier::SetTextFont(LPCTSTR szFont,int nSize,int nNormalStyle,int nSelectedStyle) 60 | { 61 | LOGFONT lf; 62 | m_myNormalFont.DeleteObject(); 63 | m_myNormalFont.CreatePointFont(nSize,szFont); 64 | m_myNormalFont.GetLogFont(&lf); 65 | 66 | // We set the Font of the unselected ITEM 67 | if (nNormalStyle & TN_TEXT_BOLD) 68 | lf.lfWeight = FW_BOLD; 69 | else 70 | lf.lfWeight = FW_NORMAL; 71 | 72 | if (nNormalStyle & TN_TEXT_ITALIC) 73 | lf.lfItalic=TRUE; 74 | else 75 | lf.lfItalic=FALSE; 76 | 77 | if (nNormalStyle & TN_TEXT_UNDERLINE) 78 | lf.lfUnderline=TRUE; 79 | else 80 | lf.lfUnderline=FALSE; 81 | 82 | m_myNormalFont.DeleteObject(); 83 | m_myNormalFont.CreateFontIndirect(&lf); 84 | 85 | // We set the Font of the selected ITEM 86 | if (nSelectedStyle & TN_TEXT_BOLD) 87 | lf.lfWeight = FW_BOLD; 88 | else 89 | lf.lfWeight = FW_NORMAL; 90 | 91 | if (nSelectedStyle & TN_TEXT_ITALIC) 92 | lf.lfItalic=TRUE; 93 | else 94 | lf.lfItalic=FALSE; 95 | 96 | if (nSelectedStyle & TN_TEXT_UNDERLINE) 97 | lf.lfUnderline=TRUE; 98 | else 99 | lf.lfUnderline=FALSE; 100 | 101 | m_mySelectedFont.DeleteObject(); 102 | m_mySelectedFont.CreateFontIndirect(&lf); 103 | } 104 | 105 | void CTaskbarNotifier::SetTextColor(COLORREF crNormalTextColor,COLORREF crSelectedTextColor) 106 | { 107 | m_crNormalTextColor=crNormalTextColor; 108 | m_crSelectedTextColor=crSelectedTextColor; 109 | RedrawWindow(); 110 | } 111 | 112 | void CTaskbarNotifier::SetTextRect(RECT rcText) 113 | { 114 | m_rcText=rcText; 115 | } 116 | 117 | BOOL CTaskbarNotifier::SetSkin(UINT nBitmapID,short red,short green,short blue) 118 | { 119 | BITMAP bm; 120 | 121 | m_biSkinBackground.DeleteObject(); 122 | 123 | if (!m_biSkinBackground.LoadBitmap(nBitmapID)) 124 | return FALSE; 125 | GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm); 126 | m_nSkinWidth=bm.bmWidth; 127 | m_nSkinHeight=bm.bmHeight; 128 | m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight); 129 | 130 | if (red!=-1 && green!=-1 && blue!=-1) 131 | { 132 | // No need to delete the HRGN, SetWindowRgn() owns it after being called 133 | m_hSkinRegion=GenerateRegion((HBITMAP)m_biSkinBackground.GetSafeHandle(),(BYTE) red,(BYTE) green,(BYTE) blue); 134 | SetWindowRgn(m_hSkinRegion, true); 135 | } 136 | 137 | return TRUE; 138 | } 139 | 140 | BOOL CTaskbarNotifier::SetSkin(LPCTSTR szFileName,short red,short green,short blue) 141 | { 142 | BITMAP bm; 143 | HBITMAP hBmp; 144 | 145 | hBmp=(HBITMAP) ::LoadImage(AfxGetInstanceHandle(),szFileName,IMAGE_BITMAP,0,0, LR_LOADFROMFILE); 146 | if (!hBmp) 147 | return FALSE; 148 | 149 | m_biSkinBackground.DeleteObject(); 150 | m_biSkinBackground.Attach(hBmp); 151 | GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm); 152 | m_nSkinWidth=bm.bmWidth; 153 | m_nSkinHeight=bm.bmHeight; 154 | m_rcText.SetRect(0,0,bm.bmWidth,bm.bmHeight); 155 | 156 | if (red!=-1 && green!=-1 && blue!=-1) 157 | { 158 | // No need to delete the HRGN, SetWindowRgn() owns it after being called 159 | m_hSkinRegion=GenerateRegion((HBITMAP)m_biSkinBackground.GetSafeHandle(),(BYTE) red,(BYTE) green,(BYTE) blue); 160 | SetWindowRgn(m_hSkinRegion, true); 161 | } 162 | 163 | return TRUE; 164 | } 165 | 166 | void CTaskbarNotifier::Show(LPCTSTR szCaption,DWORD dwTimeToShow,DWORD dwTimeToLive,DWORD dwTimeToHide,int nIncrement) 167 | { 168 | unsigned int nDesktopHeight; 169 | unsigned int nDesktopWidth; 170 | unsigned int nScreenWidth; 171 | unsigned int nScreenHeight; 172 | CRect rcDesktop; 173 | 174 | m_strCaption=szCaption; 175 | m_dwTimeToShow=dwTimeToShow; 176 | m_dwTimeToLive=dwTimeToLive; 177 | m_dwTimeToHide=dwTimeToHide; 178 | 179 | ::SystemParametersInfo(SPI_GETWORKAREA,0,&rcDesktop,0); 180 | nDesktopWidth=rcDesktop.right-rcDesktop.left; 181 | nDesktopHeight=rcDesktop.bottom-rcDesktop.top; 182 | nScreenWidth=::GetSystemMetrics(SM_CXSCREEN); 183 | nScreenHeight=::GetSystemMetrics(SM_CYSCREEN); 184 | 185 | BOOL bTaskbarOnRight=nDesktopWidthbmiHeader.biWidth; 334 | wBmpWidth -= (wBmpWidth%4); 335 | wBmpHeight = (WORD)pbmiInfo->bmiHeader.biHeight; 336 | 337 | *pwWidth = wBmpWidth; 338 | *pwHeight = wBmpHeight; 339 | 340 | BYTE *pPixels = new BYTE[wBmpWidth*wBmpHeight*3]; 341 | if (!pPixels) return NULL; 342 | 343 | HDC hDC =::GetWindowDC(NULL); 344 | 345 | bmiInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 346 | bmiInfo.bmiHeader.biWidth = wBmpWidth; 347 | bmiInfo.bmiHeader.biHeight = -wBmpHeight; 348 | bmiInfo.bmiHeader.biPlanes = 1; 349 | bmiInfo.bmiHeader.biBitCount = 24; 350 | bmiInfo.bmiHeader.biCompression = BI_RGB; 351 | bmiInfo.bmiHeader.biSizeImage = wBmpWidth*wBmpHeight*3; 352 | bmiInfo.bmiHeader.biXPelsPerMeter = 0; 353 | bmiInfo.bmiHeader.biYPelsPerMeter = 0; 354 | bmiInfo.bmiHeader.biClrUsed = 0; 355 | bmiInfo.bmiHeader.biClrImportant = 0; 356 | 357 | // get pixels from the original bitmap converted to 24bits 358 | int iRes = GetDIBits(hDC,pBitmap,0,wBmpHeight,(LPVOID)pPixels,&bmiInfo,DIB_RGB_COLORS); 359 | 360 | // release the device context 361 | ::ReleaseDC(NULL,hDC); 362 | 363 | // if failed, cancel the operation. 364 | if (!iRes) 365 | { 366 | delete pPixels; 367 | return NULL; 368 | }; 369 | 370 | // return the pixel array 371 | return pPixels; 372 | } 373 | 374 | BEGIN_MESSAGE_MAP(CTaskbarNotifier, CWnd) 375 | ON_WM_CREATE() 376 | ON_WM_MOUSEMOVE() 377 | ON_WM_DESTROY() 378 | ON_WM_ERASEBKGND() 379 | ON_WM_PAINT() 380 | ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave) 381 | ON_MESSAGE(WM_MOUSEHOVER, OnMouseHover) 382 | ON_WM_SETCURSOR() 383 | ON_WM_LBUTTONUP() 384 | ON_WM_TIMER() 385 | END_MESSAGE_MAP() 386 | 387 | 388 | // CTaskbarNotifier message handlers 389 | 390 | int CTaskbarNotifier::OnCreate(LPCREATESTRUCT lpCreateStruct) 391 | { 392 | if (CWnd::OnCreate(lpCreateStruct) == -1) 393 | return -1; 394 | 395 | m_hCursor = ::LoadCursor(NULL, MAKEINTRESOURCE(32649)); 396 | return 0; 397 | } 398 | 399 | void CTaskbarNotifier::OnDestroy() 400 | { 401 | CWnd::OnDestroy(); 402 | 403 | // TODO: Add your message handler code here 404 | } 405 | 406 | void CTaskbarNotifier::OnMouseMove(UINT nFlags, CPoint point) 407 | { 408 | TRACKMOUSEEVENT t_MouseEvent; 409 | t_MouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); 410 | t_MouseEvent.dwFlags = TME_LEAVE | TME_HOVER; 411 | t_MouseEvent.hwndTrack = m_hWnd; 412 | t_MouseEvent.dwHoverTime = 1; 413 | 414 | ::_TrackMouseEvent(&t_MouseEvent); 415 | 416 | CWnd::OnMouseMove(nFlags, point); 417 | } 418 | 419 | void CTaskbarNotifier::OnLButtonUp(UINT nFlags, CPoint point) 420 | { 421 | m_pWndParent->PostMessage(WM_TASKBARNOTIFIERCLICKED,0,0); 422 | CWnd::OnLButtonUp(nFlags, point); 423 | } 424 | 425 | LRESULT CTaskbarNotifier::OnMouseHover(WPARAM w, LPARAM l) 426 | { 427 | if (m_bMouseIsOver==FALSE) 428 | { 429 | m_bMouseIsOver=TRUE; 430 | RedrawWindow(); 431 | } 432 | return 0; 433 | } 434 | 435 | LRESULT CTaskbarNotifier::OnMouseLeave(WPARAM w, LPARAM l) 436 | { 437 | if (m_bMouseIsOver==TRUE) 438 | { 439 | m_bMouseIsOver=FALSE; 440 | RedrawWindow(); 441 | } 442 | return 0; 443 | } 444 | 445 | BOOL CTaskbarNotifier::OnEraseBkgnd(CDC* pDC) 446 | { 447 | CDC memDC; 448 | CBitmap *pOldBitmap; 449 | BITMAP bm; 450 | 451 | memDC.CreateCompatibleDC(pDC); 452 | GetObject(m_biSkinBackground.GetSafeHandle(), sizeof(bm), &bm); 453 | pOldBitmap=memDC.SelectObject(&m_biSkinBackground); 454 | 455 | pDC->BitBlt(0,0,bm.bmWidth,bm.bmHeight,&memDC,0,0,SRCCOPY); 456 | memDC.SelectObject(pOldBitmap); 457 | 458 | return TRUE; 459 | } 460 | 461 | void CTaskbarNotifier::OnPaint() 462 | { 463 | CPaintDC dc(this); 464 | CRect rcClient; 465 | CFont *pOldFont; 466 | char *szBuffer; 467 | 468 | if (m_bMouseIsOver) 469 | { 470 | dc.SetTextColor(m_crSelectedTextColor); 471 | pOldFont=dc.SelectObject(&m_mySelectedFont); 472 | } 473 | else 474 | { 475 | dc.SetTextColor(m_crNormalTextColor); 476 | pOldFont=dc.SelectObject(&m_myNormalFont); 477 | } 478 | 479 | szBuffer=new char[m_strCaption.GetLength()+10]; 480 | strcpy(szBuffer,m_strCaption); 481 | 482 | dc.SetBkMode(TRANSPARENT); 483 | rcClient.DeflateRect(10,20,10,20); 484 | dc.DrawText(szBuffer,-1,m_rcText,DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_END_ELLIPSIS); 485 | 486 | delete[] szBuffer; 487 | dc.SelectObject(pOldFont); 488 | } 489 | 490 | BOOL CTaskbarNotifier::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 491 | { 492 | if (nHitTest == HTCLIENT) 493 | { 494 | ::SetCursor(m_hCursor); 495 | return TRUE; 496 | } 497 | return CWnd::OnSetCursor(pWnd, nHitTest, message); 498 | } 499 | 500 | void CTaskbarNotifier::OnTimer(UINT nIDEvent) 501 | { 502 | switch (nIDEvent) 503 | { 504 | case IDT_APPEARING: 505 | m_nAnimStatus=IDT_APPEARING; 506 | switch(m_nTaskbarPlacement) 507 | { 508 | case TASKBAR_ON_BOTTOM: 509 | if (m_nCurrentPosY>(m_nStartPosY-m_nSkinHeight)) 510 | m_nCurrentPosY-=m_nIncrement; 511 | else 512 | { 513 | KillTimer(IDT_APPEARING); 514 | SetTimer(IDT_WAITING,m_dwTimeToLive,NULL); 515 | m_nAnimStatus=IDT_WAITING; 516 | } 517 | break; 518 | case TASKBAR_ON_TOP: 519 | if ((m_nCurrentPosY-m_nStartPosY)(m_nStartPosX-m_nSkinWidth)) 540 | m_nCurrentPosX-=m_nIncrement; 541 | else 542 | { 543 | KillTimer(IDT_APPEARING); 544 | SetTimer(IDT_WAITING,m_dwTimeToLive,NULL); 545 | m_nAnimStatus=IDT_WAITING; 546 | } 547 | break; 548 | } 549 | SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE); 550 | //RedrawWindow(); 551 | break; 552 | 553 | case IDT_WAITING: 554 | KillTimer(IDT_WAITING); 555 | SetTimer(IDT_DISAPPEARING,m_dwDelayBetweenHideEvents,NULL); 556 | break; 557 | 558 | case IDT_DISAPPEARING: 559 | m_nAnimStatus=IDT_DISAPPEARING; 560 | switch(m_nTaskbarPlacement) 561 | { 562 | case TASKBAR_ON_BOTTOM: 563 | if (m_nCurrentPosYm_nStartPosY) 573 | m_nCurrentPosY-=m_nIncrement; 574 | else 575 | { 576 | KillTimer(IDT_DISAPPEARING); 577 | Hide(); 578 | } 579 | break; 580 | case TASKBAR_ON_LEFT: 581 | if (m_nCurrentPosX>m_nStartPosX) 582 | m_nCurrentPosX-=m_nIncrement; 583 | else 584 | { 585 | KillTimer(IDT_DISAPPEARING); 586 | Hide(); 587 | } 588 | break; 589 | case TASKBAR_ON_RIGHT: 590 | if (m_nCurrentPosX