Skip to content

Instantly share code, notes, and snippets.

View lookat23's full-sized avatar
🤔
Searching.

hao lookat23

🤔
Searching.
View GitHub Profile
@lookat23
lookat23 / win32 获得系统各种路径
Created October 18, 2014 02:22
win32 获得系统各种路径
#include
main()
{
char MyDir[MAX_PATH];
SHGetSpecialFolderPath(NULL,MyDir,CSIDL_APPDATA,0); // CSIDL_APPDATA 获取的是 APPDATA的路径,其它路径可以去看MSDN
// 微软推荐用这个API SHGetKnownFolderPath ,但这个API不能向下兼容,到xp就用不了
}
@lookat23
lookat23 / std::string 改变大小写
Created October 18, 2014 02:22
std::string 改变大小写
static void toLowerCase( std::string& str )
{
std::transform(
str.begin(),
str.end(),
str.begin(),
tolower);
}
del /F /A /Q *.sdf
del /F /A /Q *.suo
del /F /A /Q *.opensdf
rd /s/q "DuiLib\Release_u"
rd /s/q "DuiLib\Debug_u"
rd /s/q "DuiLib\Release"
rd /s/q "DuiLib\Debug"
rd /s/q "DuiLib\Build"
rd /s/q "_UpgradeReport_Files"
rd /s/q "LoginDemo\Debug"
@lookat23
lookat23 / consloe 程序截获关闭事件
Last active August 29, 2015 14:03
独立的代码片段整理 留待以后组织成一个公共类
#include <windows.h>
#include <stdio.h>
bool ctrlhandler( DWORD fdwctrltype )
{
switch( fdwctrltype )
{
// handle the ctrl-c signal.
case CTRL_C_EVENT:
printf( "ctrl-c event\n\n" );
@lookat23
lookat23 / gist:48404a1706861b062994
Created June 29, 2014 23:55
加载资源,然后写成文件
HINSTANCE instance = AfxGetInstanceHandle();
// 定位资源
HRSRC hRsrc = FindResource(instance, MAKEINTRESOURCE(IDR_FILE1), _T("File"));
// 获取资源大小
DWORD dwSize = SizeofResource(instance, hRsrc);
assert(dwSize != 0);
// 加载资源
HGLOBAL hGlobal = LoadResource(instance, hRsrc);