随笔 - 547  文章 - 213 评论 - 417 阅读 - 107万

随笔分类 -  C++

上一页 1 2 3 4 下一页
How to: Convert Between Various String Types
摘要:This topic demonstrates how to convert various Visual C++ string types into other strings. The strings types that are covered includechar *,wchar_t*,_bstr_t,CComBSTR,CString,basic_string, and... 阅读全文
posted @ 2016-12-20 10:55 今夜太冷 阅读(201) 评论(0) 推荐(0) 编辑
An attempt was made to load a program with an incorrect format
摘要:用.net调用一个C++ 32位的DLL, 编译的时候选择x86, 在部署到一个64位的机器上的时候报错:"An attempt was made to load a program with an incorrect format" 解决方法: 在出错的机器上,用VS命令行工具定位到.net exe所在的目录,然后运行 corflags /32Bit+ 参考文章如下: Tip ... 阅读全文
posted @ 2016-10-08 11:28 今夜太冷 阅读(1471) 评论(0) 推荐(0) 编辑
VS2008的DLL项目添加了方法但是找不到怎么办?
摘要:VS2008中建立了一个DLL项目,使用了一段时间后,在其中一个类中添加了一个方法,然后编译后,拷贝了新的.h文件到使用DLL的项目中,并且.dll和.lib也拷贝到了需要的位置,但是在目标项目中智能提示却无法找到新建的方法。怎么回事那? 【解决方法】 关掉VS2008,然后重新打开项目,智能提示就能找到新建的方法了。 阅读全文
posted @ 2016-09-21 21:23 今夜太冷 阅读(1470) 评论(0) 推荐(0) 编辑
error C2259: 'CException' : cannot instantiate abstract class
摘要:vc6.0编译通过,VS2008则报错 解决方法: 把CException改为CUserException 阅读全文
posted @ 2016-08-26 11:43 今夜太冷 阅读(1524) 评论(0) 推荐(0) 编辑
c++子类调用基类方法的一个例子
摘要:Base.h #pragma once class Base { public: Base(void); ~Base(void); bool CreatClone(Base* item); char* m_baseprop1; }; Base.cpp #include "StdAfx.h" #include ... 阅读全文
posted @ 2016-08-19 09:59 今夜太冷 阅读(5852) 评论(0) 推荐(0) 编辑
no 'object' file generated
摘要:c++编译的时候出现如下的错误: no 'object' file generated 【解决方法】 Go to project properties -> configurations properties -> C/C++ -> treats warning as error -> No (/WX-). 阅读全文
posted @ 2016-08-17 14:14 今夜太冷 阅读(1593) 评论(0) 推荐(0) 编辑
CString转换成char*
摘要:CString转换成char* CString strSource;//宣告CStringchar* charSource; //宣告char*法1:charSource = (char*)strSource.GetBuffer(0);法2:charSource = (char*)strSource.GetBuffer(strSource.GetLength());法3:charSource = ... 阅读全文
posted @ 2016-08-10 15:47 今夜太冷 阅读(39143) 评论(0) 推荐(0) 编辑
C++中用完需要释放掉内存的几个类
摘要:BSTR BSTR bstrXML = NULL; //用完以后,或者 catch段中 if(bstrXML) ::SysFreeString(result);VARIANT VARIANT varFileName; //用完以后,或者 catch段中 VariantClear(&varFileName);支持Release的COM接口,例如: IXMLDOMDocument *pXMLDom... 阅读全文
posted @ 2016-08-02 14:28 今夜太冷 阅读(646) 评论(0) 推荐(0) 编辑
fatal error C1853: '<filename>' is not a precompiled header file
摘要:当编译c和c++混合的项目时,会出现如下类似的错误 fatal error C1853: '' is not a precompiled header file 解决方法: 设置Not using precompiled header. 阅读全文
posted @ 2016-07-27 14:21 今夜太冷 阅读(269) 评论(0) 推荐(0) 编辑
[转载]C++中处理XML文件
摘要:写Unmanaged Code在.NET时代成为一种很悲惨的事,当你需要处理XML文件时,这种感觉会变得尤其强烈。FCL中的System.XML多简单啊,连Steve Ballmer都知道怎么用。事情不会总是那么理想的,假如你要在C/C++程序里处理XML怎么办呢?选择一:市面上的XML lib还是有几个的,最有名的当然是libXML。我一年前用过,很不错,我还特意写了一份简明教程,后来... 阅读全文
posted @ 2016-07-14 21:49 今夜太冷 阅读(3764) 评论(0) 推荐(1) 编辑
C++ RegCreateKeyEx成功了,但是注册表并没有这一项
摘要:C++ - RegCreateKeyEx success but without result Could anybody tell me what's wrong is with this code? There is no errors. Everything returns ERROR_SUCCESS but in register can't see any changes. void ... 阅读全文
posted @ 2016-07-13 16:38 今夜太冷 阅读(4048) 评论(0) 推荐(0) 编辑
C++ vector用法(转)
摘要:在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。 1 基本操作 (1)头文件#include. (2)创建vector对象,vector vec; (3)尾部插入数字:vec.push_back(a); (4)使用下标访问元素,cout::iterator it; for(it=vec.begin();it!=vec.end();it++) cout #... 阅读全文
posted @ 2016-07-12 21:38 今夜太冷 阅读(234) 评论(0) 推荐(0) 编辑
_com_util::ConvertBSTRToString的使用问题
摘要:#include 然后调用_com_util::ConvertBSTRToString提示如下错误: error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString 。。。。 怎么回事那? 【解决方法】 #pragma comment(lib, "comsuppw.l... 阅读全文
posted @ 2016-07-12 17:17 今夜太冷 阅读(3006) 评论(0) 推荐(0) 编辑
Ofstream的endl不好用怎么回事?
摘要:用endl,std::endl, "\n"都不好用,不输出换行,怎么回事? 【解决方法】 If you're writing a text file, you shouldn't be using the binary flag.fout.open ("bodyfat.txt", ios::out | ios::app | ios::binary);Remove the ios::binary. ... 阅读全文
posted @ 2016-07-11 14:51 今夜太冷 阅读(474) 评论(0) 推荐(0) 编辑
string、wstring、cstring、 char、 tchar、int、dword转换方法(转)
摘要:string、wstring、cstring、 char、 tchar、int、dword转换方法(转) 最近编程一直头痛这集中类型的转化,明知都可以转却总是记不住,不断的上网查来查去,在这里小结一下。以备以后方便使用,当然有些方法可能不是最新的,或者最简单的,但是对于自己已经了解的使用起来应该方便的多: 1》string转wstring wstring s2ws(const st... 阅读全文
posted @ 2016-07-11 14:06 今夜太冷 阅读(3900) 评论(0) 推荐(1) 编辑
OleView.exe:查看机器上的COM 组件。
摘要:OleView.exe可以查看机器上安装的所有COM组件的类别以及各个类别下的COM组件。 阅读全文
posted @ 2016-07-06 16:07 今夜太冷 阅读(2071) 评论(0) 推荐(0) 编辑
COM中导出GUID
摘要:编写COM组件的时候需要导出GUID,以下是代码示例。 extern "C" const GUID CLSID_Dictionary = { 0x54bf6567, 0x1007, 0x11d1, { 0xb0, 0xaa, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} } ; 这种格式的GUID可以... 阅读全文
posted @ 2016-07-06 15:22 今夜太冷 阅读(492) 评论(0) 推荐(0) 编辑
进程外组件以及进程间通信方式
摘要:进程外组件以及进程间通信方式的描述。 阅读全文
posted @ 2016-07-06 14:50 今夜太冷 阅读(390) 评论(0) 推荐(0) 编辑
拼接多个 wchar_t *
摘要:/* wcscat example */ #include int main () { wchar_t wcs[80]; wcscpy (wcs,L"these "); //这句很重要,否则wcs会是乱码。 wcscat (wcs,L"wide strings "); wcscat (wcs,L"are ");... 阅读全文
posted @ 2016-07-06 11:21 今夜太冷 阅读(1418) 评论(0) 推荐(0) 编辑
wstring to wchar_t*
摘要:If you want to convert fromstd::wstringtoconst WCHAR*(i.e. the returned pointer givesread-only accessto the string content), then callingstd::wstring::c_str()method is just fine: std::wstrin... 阅读全文
posted @ 2016-07-05 14:44 今夜太冷 阅读(2221) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 下一页
点击右上角即可分享
微信分享提示