HFONT AppUtil::GetFont(int pixel,bool bold,const wchar_t* font_name) { LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); // zero out structure lf.lfHeight = pixel; // request a 8-pixel-height font if(bold) { lf.lfWeight = FW_BOLD; } lstrcpy(lf.lfFaceName, font_name); // request a face name "Arial" HFONT font = ::CreateFontIndirect(&lf); return font; }
void AppUtil::OpenUrl(std::string url) { ::ShellExecuteA(NULL, "open", url.c_str(),NULL, NULL, SW_SHOWNORMAL); }
void AppUtil::OpenFolder(std::wstring output_dir_) { ::ShellExecute(NULL, L"explore",output_dir_.c_str(), NULL, NULL, SW_SHOWNORMAL); }
BITMAP GetDCBitmapSize(HDC hdc) { BITMAP structBitmapHeader; memset( &structBitmapHeader, 0, sizeof(BITMAP) ); HGDIOBJ hBitmap = GetCurrentObject(hdc, OBJ_BITMAP); GetObject(hBitmap, sizeof(BITMAP), &structBitmapHeader); return structBitmapHeader; }
原文地址:http://blog.csdn.net/infoworld/article/details/46494443