自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(224)
  • 收藏
  • 关注

原创 使用 SetDeviceGammaRamp 调整屏幕亮度

使用 SetDeviceGammaRamp 调整屏幕亮度

2017-08-01 10:13:57 4015

原创 使用CreateFile API 枚举串口

使用CreateFile API 枚举串口

2017-07-10 16:39:44 880

原创 SQLGetInstalledDrivers 获取ODBC已经安装的驱动列表

#include <ODBCINST.H>void GetSQLDriverList(){ TCHAR szDrivers[4096]; memset(szDrivers, 0, sizeof(szDrivers)); WORD wRet = 0; if(SQLGetInstalledDrivers(szDrivers, _countof(szDriv...

2017-07-05 11:57:46 2856 3

原创 使用 #pragma message 输出自定义警告信息

可以在编译窗口中输出自定义警告信息, 并且可以双击信息行 定位到文件位置//宏定义#define __STR2__(x) #x#define __STR1__(x) __STR2__(x)#define __LOC__ __FILE__ "("__STR1__(__LINE__)")"#define _warning(iCode, msgStr) message( __LOC_

2017-06-15 08:54:50 4241

原创 从CButton派生一个可检测按下状态和定时重复发送消息的按钮控件

从CButton派生一个可检测按下状态和定时重复发送消息的按钮控件

2017-05-09 00:03:59 872

原创 GetMenuItemInfo & InsertMenuItem 枚举和追加菜单操作

GetMenuItemInfo & InsertMenuItem 枚举和追加菜单操作

2017-05-02 09:22:09 3439

原创 等差数列应用——控制台输出沙漏

#includeint main(){ int i,j,k,l, a1, an, d, n, sn, iN, hN; while(1) { //输入N printf("\r\nPlease input N:"); scanf("%d", &iN); //小于1退出 if(iN < 1) break; //确定边界范

2017-03-11 16:28:17 540

原创 CRC8

CRC8 计算//CRC8#define CRC8_POLY 0x31 //Polynomial 0x31(X8 + X5 + X4 + 1)#define CRC8_INIT 0xFF //Initialization 0xFFBYTE CRC8(const void *pInData, int iLen){ BYTE i, crc, *buf = (BYTE *)pIn

2017-02-27 12:54:39 1817

原创 让 基于 CWnd 类能接收键盘消息

让 基于 CWnd 类能接收键盘消息, 两个关键点  WM_GETDLGCODE 返回时增加  DLGC_WANTALLKEYS|DLGC_WANTCHARS, 第二 使用 SetFocus 选中焦点LRESULT CMyWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: Add your

2017-02-16 17:30:14 1309

原创 SetupDI 枚举串口

//具有完整的设备名 #include #include #include #pragma comment(lib, "Setupapi.lib")void main(){ HDEVINFO hDevInfo = SetupDiGetClassDevs(&GUID_DEVCLASS_PORTS, NULL, NULL, 0); if(hDevInfo) {

2016-12-15 14:50:43 1194 1

原创 使用DirectX截屏

//奇慢无比 //DXScreenCaputre.h#pragma once#include #include #pragma comment(lib, "D3D9.lib")#pragma comment(lib, "D3dx9.lib")class CDXScreenCaputre{protected: LPDIRECT3D9 g_pD3D; LPDIRE

2016-09-19 11:43:49 6763 8

原创 MemBuffer 模板类

MemBuffer 模板类

2016-08-24 06:58:55 675

原创 使用 StretchBlt 制作 缩略图标

使用 StretchBlt 制作 缩略图标

2016-08-19 17:35:15 1416 2

原创 线程监视 OutputDebugString 的调试输出

#include class CDBWinMonitor {#pragma pack(push, 1) typedef struct _tagDBWinBuffer_t { DWORD dwProcessId; char data[4096-sizeof(DWORD)]; }DBWINBUFFER, *LPDBWINBUFFER;#pragma p

2016-08-06 17:03:00 1761 1

原创 通过WMI 获取 CPU 温度

MSAcpi_ThermalZoneTemperature

2016-08-04 21:52:30 9229 3

原创 FormatMessage 格式化 GetLastError 错误代码

LPCSTR _FormatErrorMessage( LPCTSTR szReason, DWORD dwErrCode ){ static TCHAR szErrMsg[1024]; memset(szErrMsg, 0, sizeof(szErrMsg)); //DWORD dwErrCode = GetLastError(); //之前的错误代码 LPVOID lpM

2016-07-17 13:02:49 1067

原创 在任务栏上的时钟区域显示自己的内容 MFC 封装

//ClockTrayWnd.h#pragma onceclass CColockTrayWnd : public CWnd{ CWnd *m_pNotifyWnd; //通知窗口 UINT m_uNotifyMessage; //通知消息public: CColockTrayWnd() { m_pNotifyWnd = NULL; m_uNotify

2016-07-15 22:18:50 820

原创 数字按千分组格式化

LPCTSTR FormatThousandNumber(const INT64 iInVal){ static CString strVal; INT64 iVal = (INT64)(iInVal < 0 ? (-iInVal):(iInVal)); strVal.Empty(); do { CString szSub; szSub.Format(_T(

2016-07-15 21:05:55 490

原创 在任务栏上的时钟区域显示自己的内容

以 TrayClockWClass 为父窗口测试, 诸多不完美, 单调, 可能有闪烁,  仅作为基础测试使用 // ShellClock.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"#include #if _MSC_VER <

2016-07-15 07:33:32 1124

原创 使用 ShellExecuteEx 显示文件属性

ShellExecuteEX MSDN SHELLEXECUTEINFO sei; ZeroMemory(&sei,sizeof(sei)); sei.cbSize = sizeof(sei); sei.lpFile = _T("C:\\"); //or path sei.lpVerb = "properties"; sei.fMask = SEE_MASK

2016-07-12 08:44:13 1102 1

原创 Flash memory E2Rom 等常用到的页写算法

long xxxPageWrite(long uAddr, const void *pSrcData, long iLen){ #define PAGE_SIZE 128 //页面大小 #define MAX_ADDRESS 0x10000UL //最大地址 long iDoneBytes=0; //写入的长度 long iOffset, iNewWrLen; unsig

2016-04-07 10:55:19 1142

原创 16进制字符模式的图标处理

16进制字符模式的图标处理

2016-01-13 15:39:02 2614 2

原创 CStatic + CImage 实现简单的图片显示控件

#pragma once// ImageStatic.h#include #include class CImageStatic : public CStatic{ DECLARE_DYNAMIC(CImageStatic)public: CImageStatic(); virtual ~CImageStatic(); BOOL SetImage(LPCT

2015-06-26 19:42:05 6689 9

原创 URL编解码

//URL编码BSTR URLEncode(LPCSTR srcURL, UINT CodePage = CP_ACP){ BSTR bstrVal = NULL; int iWchLen=0, iUtf8Len=0, iEncLen = 0; wchar_t *wchBuff = NULL; char *utf8Buff = NULL; char *encURL = N

2015-06-18 05:56:01 1117

原创 CreateRemoteThread 牛刀小试

// RmtTest.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <windows.h>#include <shlwapi.h>#pragma comment(lib, "shlwapi.lib")#pragma comment(lib, "Advapi32.lib")BOOL Set...

2015-06-08 07:15:10 2197

原创 我的调试输出 _TRACE 第三版

在第二版的基础上增加了非法检查功能  另外使用_WINDOWS宏来区分控制台和Windows程序#include #include #include class __CTrace{#ifdef _WINDOWS #define dbgOutputA(str) OutputDebugStringA(str) #define dbgOutputW(str) Ou

2015-06-05 05:36:02 820

原创 SNTP 获取时间服务器UTC时间

// SntpTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include #include #pragma comment(lib, "wsock32.lib")//ref : www.ietf.org/rfc/rfc2030.txt

2015-05-25 15:05:47 3754 1

原创 在ActiveX中调出属性页

HRESULT CTestActiveXCtrl::ShowPorpertyPages(void){ AFX_MANAGE_STATE(AfxGetStaticModuleState()); // TODO: 在此添加调度处理程序代码 HRESULT hr = S_OK; LPUNKNOWN lpDisp = GetIDispatch(FALSE); LCID lcid

2015-05-13 05:16:17 912 1

原创 获取单色位图指定坐标的数据

int GetMonoBMPData(LPBYTE pData, int nWidth, int x, int y){ int iOffset = y * (nWidth + 7)/8; //每行按字节对齐 iOffset += x/8; //每个像素占一位 UINT iData = pData[iOffset]; //所在的字节数据 return ((iData & (1<

2014-11-19 09:15:46 1563

原创 WAVE 文件操作

//WaveFileOperate.h#pragma once#include #include #include #pragma comment(lib, "winmm.lib")class CWaveFileOperate{protected: int WaveOpenFile(LPTSTR, HMMIO *, WAVEFORMATEX **, MMCKINFO *)

2014-05-20 16:03:53 3521 2

原创 Enumerating All Device Drivers in the System

#include #pragma comment(lib, "psapi.lib")void EnumAllDeviceDrivers(){ do { LPVOID aDrivers[1024]; memset(aDrivers, 0, sizeof(aDrivers)); DWORD cbNeeded = 0; if ( !EnumDeviceDr

2014-05-16 10:14:40 740

原创 简易剪贴板查看器

//引用MSDN上的注释 The SetClipboardViewer function adds the specified window to the chain of clipboard viewers. Clipboard viewer windows receive a WM_DRAWCLIPBOARD message whenever the content of th

2013-12-26 11:45:05 2126

原创 HTTP页面下载(CInternetSession 和 CHttpFile应用)

//http下载DWORD HttpRead(LPCTSTR pstrURL, CString &szReturn){ DWORD dwError = 0; //初始化Socket do { if(!AfxSocketInit()) { dwError = ERROR_INTERNET_TCPIP_NOT_INSTALLED; AS

2013-12-21 12:04:25 2730

原创 使用字符串构造一个FILE指针

typedef struct __FILEX : FILE { CRITICAL_SECTION lock; __FILEX(LPCSTR string) { memset(this, 0, sizeof(*this)); InitializeCriticalSection(&lock); _flag =...

2013-12-12 16:26:15 745

原创 枚举HTML中的超链接

//IHTMLDocument2::links Propertyvoid EnumLinks(IHTMLDocument2 *phtmlDoc){ do { if(phtmlDoc == NULL) break; IHTMLElementCollection *p = NULL; if(FAILED(phtmlDoc->get_links(&p)

2013-12-12 05:38:37 1831

原创 求一组战力值最大算法

在论述上看到此问题,觉得有点意思,写段代码 欢迎大家测试拍砖typedef struct _tagCard_t{ int iCost, iValue; _tagCard_t() { iCost = iValue = 0; }}CARD;template struct CardSelct{ int bSelected[NUM]; int

2013-12-03 09:48:45 1063

原创 操作 WORD 画线

#import "office/MSO.DLL" rename("RGB", "msRGB")#import "office/VBE6EXT.OLB" no_namespace #import "office/MSWORD.OLB" \ rename("FindText", "msFindText")\ rename("ExitWindows","ExitWindowsEx")v

2013-11-26 09:40:02 1789

原创 枚举剪切板数据和格式名称

if(OpenClipboard()) //open clipboard { UINT uFormat = 0; while(uFormat = EnumClipboardFormats(uFormat)) //emulate format { HGLOBAL hGlobal = GetClipboardData(uFormat); //ge

2013-08-30 15:42:58 1362

原创 解析JPGE文件 获取文件像素尺寸

SIZE GetJPGEImagePiex(LPCTSTR szFileName){ SIZE sizePiex={0,0}; HANDLE hFile = INVALID_HANDLE_VALUE; do { hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_WRITE,

2013-08-16 09:24:18 1766

原创 使用文件映射获取打开的文件名

#include "stdafx.h"#include #include #include #include #include #include #include #pragma comment(lib, "psapi.lib")LPCTSTR GetFileNameFromHandle(HANDLE hFile) { static TCHAR pszFilename

2013-08-14 10:39:52 1119

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除