
C++
文章平均质量分 62
hckme
这个作者很懒,什么都没留下…
展开
-
C++实现简单异或加密算法
#pragma once#include class NXCORE_API XorCrypt{public: static std::string Xor(__in const std::string& input, __in const std::string& key); static bool Encrypt(__in const std::string& input,原创 2014-12-19 13:05:09 · 7639 阅读 · 0 评论 -
数字格式化输出
软件开发中有时候需要将数字格式化输出,例如文件大小或者金额大小使用win32 api函数:GetNumberFormat和GetLocaleInfoCString FormatNumber(ULONGLONG ull){ TCHAR szBuf[MAX_PATH] = { 0 }; _ui64tot_s(ull, szBuf, _countof(szBuf), 10);原创 2015-08-06 12:22:58 · 781 阅读 · 0 评论 -
vc递归删除文件夹
HRESULT FolderListCtrl::RemoveDirectoryTree(LPCTSTR Directory){ WIN32_FIND_DATA fd = {0}; CString curDir = Directory; curDir += TEXT("\\*"); HRESULT hr = E_NOINTERFACE; HANDLE hFind = FindFirstF原创 2015-08-06 12:11:57 · 632 阅读 · 0 评论 -
实用注册表管理类
#pragma onceclass Registry{public: Registry(HKEY root, const std::wstring& path); ~Registry(); bool Create(); bool CreateKey(const std::wstring& subKey); std::wstring QueryValue(const std::ws原创 2015-03-11 14:07:14 · 571 阅读 · 0 评论 -
控制台输出调试类
此类可以实现在Windows窗口程序中创建一个控制台窗口来打印出调试信息。这样可以方便查看变量的值或函数的状态。#pragma once////////////////////////////////////////////////////////////////////////////class OutputFuncScope{public: explicit原创 2015-03-16 09:14:32 · 657 阅读 · 0 评论 -
VC获取Unix时间戳
// 获取Unix时间戳std::wstring GetUnixTimeStamp(void){ FILETIME ft = { 0 }; SYSTEMTIME st = { 0 }; ULARGE_INTEGER ull = { 0 }; ::GetSystemTime(&st); ::SystemTimeToFileTime(&st, &ft); ull.LowPart = f原创 2015-03-04 10:06:17 · 1107 阅读 · 0 评论 -
Flash加速功能实现
实现Flash加速原理是Hook住与时间相关的几个API函数,将API返回的实际时间值进行改写,来实现加速。模板依赖于mhook库(https://github.com/SirAnthony/mhook)#pragma onceclass SpeedMgr{public: static SpeedMgr& Instance(); BOOL StartService(); BO原创 2015-03-03 11:52:32 · 2138 阅读 · 0 评论 -
C++ Rijndael加密算法
//Rijndael.h#ifndef __RIJNDAEL_H__#define __RIJNDAEL_H__#include #include using namespace std;//Rijndael (pronounced Reindaal) is a block cipher, designed by Joan Daemen and Vincent Rijmen a转载 2015-02-13 10:03:08 · 4348 阅读 · 0 评论 -
简单系统托盘类
#pragma onceclass SystemTray{public: SystemTray(); ~SystemTray(void); void Create(HWND hWnd, UINT uID, UINT uMsg, LPWSTR lpTip); BOOL Show(); BOOL Close();private: NOTIFYICONDATA m_nid;};原创 2015-02-26 14:18:19 · 456 阅读 · 0 评论 -
C++日志记录类logging
// Copyright (c) 2012 Ohyo net work. All rights reserved.// 2012/01/04// logging.h////#ifndef __INCLUDE_LOGGING_H__#define __INCLUDE_LOGGING_H__#include "str_conv.inl"#include #include #in原创 2015-02-08 10:50:11 · 1758 阅读 · 0 评论 -
很实用的C++ ini解析类
头文件:#pragma once#include #include class INIReader{public: INIReader(std::string filename); INIReader(const char* buf); int ParseError(); std::string Get(std::string section, std::string na原创 2015-02-04 10:45:19 · 2356 阅读 · 0 评论 -
C++ base64编码和解码算法
#include namespace base64 { std::string base64_encode(unsigned char const* , unsigned int len); std::string base64_decode(std::string const& s);}#include "base64.h"namespace base64{ sta原创 2014-12-10 15:41:39 · 1091 阅读 · 0 评论 -
VC常用进程函数
class ProcessUtils{public: static DWORD FindProcess(const TCHAR* strProcessName); static BOOL KillProcess(const TCHAR* strProcessName); static BOOL GetDebugPriv(); static DWORD GetMainThreadId(D原创 2015-01-13 10:39:00 · 1054 阅读 · 0 评论 -
string与wstring互转
std::string -> std::wstringwstring stdcxx_s2ws(string s){ wstring ws; #ifdef _MSC_VER int iLen = ::MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, NULL, 0); if(iLen > 0) { wchar_t* pwszDs原创 2015-01-12 10:03:30 · 715 阅读 · 0 评论 -
HWND句柄与字符串互转
HWND -> std::wstringwstring hwnd2ws(HWND hWnd) { wchar_t wszHWndView[64] = {}; ::wnsprintfW(wszHWndView, _countof(wszHWndView), L"%X", hWnd); return wszHWndView; }std::wstring -> HWNDH原创 2015-01-12 09:58:29 · 4884 阅读 · 0 评论 -
C++软件版本比较函数
规定版本格式为:x.x.x.x (例如:1.0.0.0)。int wscmp_ver(const wstring& ver1, const wstring& ver2){ int vVer1[4] = {0}; int vVer2[4] = {0}; swscanf(ver1.c_str(), L"%d.%d.%d.%d", &vVer1[0], &vVer1[1], &vV原创 2015-01-12 10:06:37 · 701 阅读 · 0 评论 -
Happy Registry: A quick wrapper for the Win32 database(译文)
Happy Registry: A quick wrapper for the Win32 database(Happy Registry:快速Win32注册表封装类)作者:Michael Chourdakis翻译:Sam Tan原文地址:http://www.codeproject.com/Articles/1040618/Happy-Registry-A-qu翻译 2015-11-21 12:20:37 · 619 阅读 · 0 评论