C/CPP
liumu1209
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
DecreaseSort
<br />1:<br />using namespace std;#include "vector"template <typename T>void DecreaseSort(std::vector<T>& coll){ typename vector<T>::iterator iter; for(iter = coll.begin();iter != coll.end(); iter++) { typename vector<T>::i原创 2011-01-04 15:06:00 · 357 阅读 · 0 评论 -
曾经犯过的错误c++
1.无限构造struct A{A(A a){}};-----------------------------------------------------------------struct A{A(const A& a);}2.switch case块里定义数据int a = 0;switch(a){case 0原创 2012-04-13 01:56:20 · 383 阅读 · 0 评论 -
tstring
#include "stdafx.h"#include #include #ifdef UNICODE #define TEXT(s) L##s#else #define TEXT(s) s#endif#ifdef UNICODE #define tstring std::wstring#else #define tstring std::string#endif转载 2012-04-09 13:55:00 · 876 阅读 · 0 评论 -
c/c++ 操纵sqlite
#include "stdafx.h"#include #include #include #include "sqlite3.h"#pragma comment(lib,"sqlite3.lib")using namespace std;bool sqlitedbcreate(char* name){ sqlite3* conn; if(SQLITE_OK != sql转载 2012-03-04 10:14:18 · 373 阅读 · 0 评论 -
用异常来通知线程安全结束
突然领悟到异常其实是中断。于是想到用异常来通知线程安全结束,就是不知道这样做的效率怎么样,据说catch exception很费时间。#include "stdafx.h"#include "windows.h"#include "process.h"struct param{ param() : _signal(false) {} void close_signal() {原创 2012-03-02 10:26:51 · 735 阅读 · 0 评论 -
查找目录下所有文件及子目录
#include "windows.h"void FindFilesInDir(TCHAR* rootDir){ WIN32_FIND_DATA fd; ZeroMemory(&fd, sizeof(WIN32_FIND_DATA)); HANDLE hFile; TCHAR tmpPath[256]; TCHAR subPath[256]; ZeroMemory(tmpPat原创 2012-02-22 11:46:41 · 959 阅读 · 0 评论 -
C++编写及注册windows服务程序
原文链接:http://eggbucket.iteye.com/blog/11356301、注册服务 :在 "开始->运行->cmd" 中输入 sc create TEST binPath = "C:\TEST.EXE" 则在windows下注册了一项服务sc create TestService binpath= "c:\ServiceTest.exe" displa转载 2011-12-26 14:06:04 · 1474 阅读 · 0 评论 -
mfc将sql DateTime转换成字符串,及格式化当前时间
SYSTEMTIME st;VariantTimeToSystemTime(date,&st);CString time;time.Format(_T("%04d/%02d/%02d %02d:%02d:%02d"),st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond);获取当前时间:SYSTEMTIME cu原创 2011-11-02 19:12:20 · 1335 阅读 · 0 评论 -
如何动态添加菜单/菜单项、子菜单、右键菜单
转载自:http://www.cnblogs.com/jcss2008/archive/2009/01/02/1366882.html如何动态添加菜单/菜单项、子菜单、右键菜单 有关菜单的操作主要用到CMenu类,当然也可用相应API函数,CMenu类只是MFC对API中操作菜单的函数的封装而已。 不过能用类就尽量用类,类的组织方式好呗,代码看着也舒服。 若是SDK编程,那就用AP转载 2011-11-02 19:09:12 · 1211 阅读 · 0 评论 -
容器与元素应分别设计
struct Node{Node* next;int data;};struct List{Node* head;};原创 2011-10-11 23:50:40 · 330 阅读 · 0 评论 -
Uitility1.1版修改
1.加上类型配置信息,避免外部使用时对每个类都需要使用using classname;2.SqlHelper类Query时要区分本身无数据和sqlsentence错误。避免GetLastError错误。3.Handler类加上各重截操作符的const版。4.加上反射能原创 2011-09-27 11:28:55 · 834 阅读 · 0 评论 -
DebugPrint和字符串转换
#pragma once#pragma warning (disable:4996)#define MAXLEN 256#include namespace _Liuxb{ class Conver { public: static CString P原创 2011-08-27 16:41:56 · 713 阅读 · 0 评论 -
完成端口线程池及任务接口
/*------------------------------------------------------------------// 著作版权:Copyright (C) NST// 创建时间:[Liuxb|20110914]// 功能描述:线程池框架,任务基类/原创 2011-09-14 03:06:29 · 789 阅读 · 0 评论 -
纯C++版委托及Variant
#ifndef DELEGATION_H#define DELEGATION_H/********************************************************************************** Copyright (C原创 2011-09-09 11:22:08 · 458 阅读 · 0 评论 -
MFC CDC类
CDC有四个继承类:CClientDC,CPaintDC,CWindowDC,CMetaFileDC。01.获取及释放CDC类:CDC* pDC = GetDC(); //仅允许在窗口客户区画图 //orCDC* pDC = CWnd:原创 2011-08-09 13:11:13 · 643 阅读 · 0 评论 -
const关键字
const关键字在C++中有两个作用:1.将对象固化const int const_i = 10; //OKint val = 10;const int const_a = val; //OKconst修饰类成员时该成员必须是静态变量。//.hstruct原创 2011-08-09 01:15:34 · 251 阅读 · 0 评论 -
MFC Unicode 字符使用习惯
1.字符串使用_T宏:_T("Hello");2.将字符声明为TCHAR类型而不是char类型。3.不要使用char*或者wchar_t*来声明TCHAR字符串的指针,而应该使用TCHAR*,或者更佳的LPTSTR(指向TCHAR字符串的指针)和LPCTSTR(指向con转载 2011-08-08 22:25:31 · 437 阅读 · 0 评论 -
c++ constructor
class A{public: static A intance(int n) { A a; a._a = n; return a; }public: int _a;private: A() {} A(A& a) {}};A create原创 2011-09-03 21:26:52 · 593 阅读 · 0 评论 -
CDHtmlDialog与js交互
在界面类.h添加 public:virtual BOOL IsExternalDispatchSafe() { return TRUE; }virtual void OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl);protected:DECLARE_DISPATCH_MAP()DECLARE_MESSAGE_M原创 2012-07-20 14:51:17 · 2170 阅读 · 0 评论
分享