摘要:
为了调试方便,将CRgn rgn对象以图片形式输出,便于查看(如果想直接显示出来可以用 CDC::FrameRgn){ CRgn rgn int w = m_lpShapePoints[4].x+4; int h = m_lpShapePoints[4].y+4; HWND hDesk = GetDesktopWindow(); HDC hDC = ::GetDC(hDesk); CMemDC MemDC(hDC, CSize(w, h), 0); for (int x=0; x<w; x++) { for (int y=0; y<h; y++) { CPoint pt(x, y) 阅读全文
摘要:
>>>改进:可以使用结构来返回多个返回值>> 方法1:CreateMemSrcDC 返回值 -----创建的内存DCHBITMAP &hBmp -----创建的内存DC选中的图片HBITMAP &hOldBmp -----创建的内存DC选中的图片前保存的图片m_hMemSrcDC = CreateMemSrcDC(m_hSrcBmp, m_hOldSrcBmp, pDC, sz.cx+2, sz.cy+2);HDC CLDCText30Control::CreateMemSrcDC(HBITMAP &hBmp, HBITMAP &h 阅读全文
摘要:
AllInput 待查找的完整字符串,key 被查找的子字符串 { CString AllInput = GetAllTxt(); CString key = _T("/r/n")+strGuestName; CString strLastInput; CString stemp = AllInput; int pos = stemp.ReverseFind('/r'); while (pos>0) { CString sSub = stemp.Mid(pos); // 获得最后1行字符串 if (sSub.... 阅读全文
摘要:
#include "stdafx.h"#include "PathStringManager.h"CPathStringOper::CPathStringOper(void){}CPathStringOper::~CPathStringOper(void){}CPathStringOper::GetFolderPathFromFullPath(LPCTSTR lpszFullPath){ // 获取文件路径: // 注意不是“/”以结尾,因为使用过程中加上一个“/”容易,减去一个不容易 CString m_strOriFileName(lpszFullP 阅读全文
摘要:
简单、简练的一句话搞定资源中字符串的读取和加载、AfxMessageBox(CString((LPCTSTR)MSG_008) ); 阅读全文
摘要:
http://blog.csdn.net/nxjbill/archive/2008/04/29/2342587.aspx我的日志记录组件 - 东方散人 - CSDN博客和大家分享下我写的日志记录文件组件。下面是一些定义和调用的封装。如存在bug,欢迎指正。如需要demo程序和组件可去我在csdn下的下载资源或是去风华软件在线(www.fhuasoft.cn)网站上去下载。//下面是定义文件#ifndef _DEBUG_TRACE_2004#define _DEBUG_TRACE_2004#include <atlbase.h>#include "logdeal.h&quo 阅读全文
摘要:
DWORD derr = GetLastError(); derr = derr; LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); // Process any inserts in lpMsgBuf.// ... // Display 阅读全文
摘要:
1、遍历子节点DWORD dRes;if ( 0 == (dRes=xmloper.selectFirstChildNode()) ){//nodetxt = "Programe"while (0==dRes){CString strProg;xmloper.readNodeValue(strProg);CDocument *pDoc = this->OpenDocumentFile(strProg);dRes = xmloper.selectNextNode();}xmloper.selectParentNode();}2、获取节点IDxmloper.readNod 阅读全文
摘要:
int CCorreDataMain::IsDirectoryFind(CString szPath)//文件夹是否存在 0存在 -1为空,-2为非法路径,-3为盘符异常,-4需要创建目录{ if (szPath == "") return -1;//为空 if (szPath.Right(1)=='//') szPath.TrimRight('//');//去掉 if (szPath.GetLength()<2) return -2;//非法路径 else if (szPath.GetLength()==2) { szPath.Mak 阅读全文
摘要:
CConfigXmlFile02.h#pragma once#import <msxml6.dll> // raw_interfaces_only,named_guiIDs using namespace MSXML2;#include <vector>using namespace std;class CConfigXmlFile02 {public: CConfigXmlFile02(void); virtual ~CConfigXmlFile02(void); CConfigXmlFile02(CString path);protected: bool InitD 阅读全文
摘要:
{ DWORD pCount=1024; TCHAR szValue[1024]; CString str; CRegKey reg; if ( ERROR_SUCCESS==reg.Create(HKEY_CURRENT_USER, _T("Software//Leyard"))) { if (ERROR_SUCCESS==reg.QueryValue(szValue, _T("Language"), &pCount)) { str.Format(_T("%s"), szValue); } else { str = _T(& 阅读全文
摘要:
CString CXXApp::ConfigGetAppPath(){ CString strAppPath; TCHAR path[MAX_PATH]; memset(path,0,sizeof(TCHAR)*MAX_PATH); GetModuleFileName( NULL,path, MAX_PATH ); TCHAR drive[MAX_PATH],dir[MAX_PATH],fname[MAX_PATH],ext[MAX_PATH]; _tsplitpath(path,drive,dir,fname,ext ); strAppPath = drive; strAppPath += 阅读全文
摘要:
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }#define JIF(x) if (FAILED(hr=(x))) / {Msg(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("/n"), hr); return FALSE;}inline void Msg(char *szFormat, ...){ TCHAR szBuffer[512]; // Large buffer for very long filenames (like with 阅读全文
摘要:
CStdioFile file; BOOL res = FALSE; if (clean) { res = file.Open(strFilePath, CFile::modeCreate|CFile::modeReadWrite); } else { res = file.Open(strFilePath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite); } if (res) { if (!clean) { file.SeekToEnd(); } if (_T("")!=tag) { fi... 阅读全文
摘要:
c++ // 没有盘符,为相对路径 strDllPath.Trim(_T("\\")); strDllPath = CEnvironment::ConfigAppDir()+strDllPath;c#String strDir = Environment.CommandLine.Substring(0, Environment.CommandLine.LastIndexOf(@"\XQ-4."));或者Environment.CurrentDirectory // 当操作中途有使用文件打开对话框的情况时,该函数可能会发生变化《Environment.h》 阅读全文