随笔分类 -  C++

1

The C++ Learning!
FAT32与NTFS磁盘格式转换
摘要:ShellExecute(this->GetSafeHWnd(), “open”, “convert”, “D:/fs:NTFS”, NULL, SW_SHOW); 阅读全文

posted @ 2014-10-24 00:38 Leadtheway 阅读(130) 评论(0) 推荐(0)

使用SHFormatDrive格式化硬盘
摘要:从实际应用的角度看,从Windows 9X到Windows NT都应该提供这个FormatDisk函数,否则怎么实现资源管理器窗口的磁盘格式化呢?笔者通过仔细查找发现,Windows 确实提供了这样一个函数,尽管文档资料没有注明,但是如果我们使用View Dependencies打开Shel... 阅读全文

posted @ 2014-10-24 00:19 Leadtheway 阅读(1088) 评论(0) 推荐(0)

StretchBlt
摘要:StretchBlt 函数功能:函数从源矩形中复制一个位图到目标矩形,必要时按目前目标设备设置的模式进行图像的拉伸或压缩。 函数原型:BOOL StretchBlt(HDC hdcDest, int nXOriginDest, intnYOriginDest, int nWidthDest, ... 阅读全文

posted @ 2014-10-23 23:44 Leadtheway 阅读(201) 评论(0) 推荐(0)

ExtFloodFill 可以填充不规则区域
摘要:ExtFloodFill functionTheExtFloodFillfunction fills an area of the display surface with the current brush.SyntaxC++BOOL ExtFloodFill( _In_HDC hdc, _In_... 阅读全文

posted @ 2014-10-23 22:09 Leadtheway 阅读(1026) 评论(0) 推荐(0)

获取点颜色值 GetPixel
摘要:GetDIBits functionTheGetDIBitsfunction retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specifie... 阅读全文

posted @ 2014-10-23 21:36 Leadtheway 阅读(811) 评论(0) 推荐(0)

VC调试小方法
摘要:1、 设置断点逐步调试。通过Watch、Call Stack窗口查看调试信息。2、 添加调试代码。#ifdef _DEBUG //Code for debugging Purposes#endif //_DEBUG3、 使用宏。ASSERT宏VERIFY宏TRACE宏4、 检查内存泄露。非M... 阅读全文

posted @ 2014-10-17 23:12 Leadtheway 阅读(385) 评论(0) 推荐(0)

VS2008在release下设置断点调试
摘要:VS2008在release下设置断点调试 设置VS2008的方法步骤。1、 将程序编译模式配置选择为Release。2、 开启Release模式下生成调试信息。项目属性——>Linker——>Debugging——>Generate Debug Info选择为YES3、 选择调试信息... 阅读全文

posted @ 2014-10-17 20:47 Leadtheway 阅读(916) 评论(0) 推荐(0)

Vector 矢量中的指针
摘要:与其他容器一样,矢量容器Vector为添加到其中的对象创建一个副本。在大多数情况下这是极大的优点。但是在有些情况下这个功能可能非常不方便。例如,如果我们的对象比较大,向容器中添加对象时复制它们的开销会相当大。在这种场合下,在容器中存储对象的指针并在外部管理对象比存储对象本身更好。 阅读全文

posted @ 2014-10-12 20:24 Leadtheway 阅读(403) 评论(0) 推荐(0)

VC获取IE版本号
摘要:1、通过注册表获取IE版本号Cstring GetIEVersion(void){ HKEY hSerKey; CString str = _T("Software\\Microsoft\\Internet Explorer"); long nRet; DWORD dw... 阅读全文

posted @ 2014-10-11 21:48 Leadtheway 阅读(863) 评论(0) 推荐(0)

VS修改应用程序名称
摘要:vs自动生成exe时总是默认为工程的名称。如何自定义生成时的名称在工程名里右键-->属性-->连接器(linker)-->输出(output)下$(OutDir)\$(ProjectName).exe 把$(ProjectName)改成自己的应用程序名称 阅读全文

posted @ 2014-10-11 11:54 Leadtheway 阅读(2078) 评论(0) 推荐(0)

删除String中的空格
摘要:三种删除String中空格的方法。可用根据需要自由进行选择使用。1、C风格#include "stdafx.h"void RemoveStringSpaces(char* pStr);int _tmain(int argc, _TCHAR* argv[]){ return 0;}void Re... 阅读全文

posted @ 2014-09-28 00:47 Leadtheway 阅读(867) 评论(0) 推荐(0)

vc++加载透明png图片方法——GDI+和CImage两种
摘要:vc++加载透明png图片方法——GDI+和CImage两种在加载png时遇到了麻烦,后来用了两个方法解决了。一个是用GDI+,另外就是用vs.net MFC自带的CImage。先看看GDI+的方法方法1:1.GDI+画透明图层(alpha)的png图片stdafx加入如下:#include//初始... 阅读全文

posted @ 2014-09-01 21:04 Leadtheway 阅读(1127) 评论(0) 推荐(0)

CreateDirectory 创建文件夹
摘要:函数原型:CreateDirectory( LPCTSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);简介: CreateDirectory 是Win32API函数,用于创建文件夹。 参数 lpPathName 表示路径 参数 ... 阅读全文

posted @ 2014-08-15 00:34 Leadtheway 阅读(2901) 评论(0) 推荐(0)

_tsplitpath_s(分解路径) _tmakepath_s(创建路径)
摘要:函数原型:函数原型:errno_t _splitpath_s( const char * path, char * drive, size_t driveNumberOfElements, char * dir, size_t dirNumberOfElements, char * fname, s... 阅读全文

posted @ 2014-08-13 23:28 Leadtheway 阅读(2590) 评论(0) 推荐(0)

cctype 头文件定义函数
摘要:header (ctype.h)Character handling functionsThis header declares a set of functions to classify and transform individual characters.FunctionsThese fun... 阅读全文

posted @ 2014-05-19 16:01 Leadtheway 阅读(551) 评论(0) 推荐(0)

cin cin.get() cin.getline() getline() gets() getchar()
摘要:1、cin2、cin.get()3、cin.getline()4、getline()5、gets()6、getchar()1、cin>>用法1:最基本,也是最常用的用法,输入一个数字:#include using namespace std;int main (){ int a,b; cin>>a>>b; cout> 是会过滤掉不可见字符(如 空格 回车,TAB 等)cin>>noskipws>>input[j];//不想略过空白字符,那就使用 noskipws 流控制用法2:接受一个字符串,遇“空格”、“TAB”、“回车”都结 阅读全文

posted @ 2014-04-06 20:21 Leadtheway 阅读(320) 评论(0) 推荐(0)

VC++使用用crtdbg定位内存泄露错误
摘要:#define _CRTDBG_MAP_ALLOC#ifdef _DEBUG#define new new( _CLIENT_BLOCK, __FILE__, #endif#include #include int main(){ int* p = new int(); _CrtDumpMemoryLeaks(); return 0;}可以【定位】出内存泄露的代码在哪一行!output信息如下:'Test.exe': Loaded 'E:\CODE\Test\Debug\Test.exe', Symbols loaded.'Test.exe': 阅读全文

posted @ 2014-03-30 19:25 Leadtheway 阅读(956) 评论(0) 推荐(0)

string与time_t互相转换
摘要:#include #include #include using namespace std;time_t string2time_t(const string string_time);string time_t2string(const time_t time_t_time);int main(... 阅读全文

posted @ 2014-03-28 21:59 Leadtheway 阅读(7420) 评论(0) 推荐(0)

使用BOOL还是bool好?
摘要:考虑移植的话使用bool c++原生的,平时使用BOOL既可以当布尔,还可以当整型,尤其是函数返回值非常好;用TRUEFALSE。 阅读全文

posted @ 2014-03-20 23:44 Leadtheway 阅读(218) 评论(0) 推荐(0)

char[] 字符数组初始化
摘要:1 char szBuffer[1024] = {0};2 char szBuffer[1024] = {_T('\0')};以上两种方法是等价的,均是将字符数组szBuffer初始化为空字符串。因为'\0'是字符串的结束标志,其ASCII码为0。然而1 char szBuffer[1024] = {'0'};则是将字符数组初始化为字符'0'。另外2种初始化方式:1 char szBuffer[1024];2 ZeroMemory(szBuffer,1024); 3 4 5 6 ZeroMemory(szBuffer,size0f 阅读全文

posted @ 2014-03-16 15:36 Leadtheway 阅读(9811) 评论(0) 推荐(0)

1

导航