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

随笔分类 -  C++

上一页 1 2 3 4
BSTR
摘要:BSTR A BSTR (Basic string or binary string) is a string data type that is used by COM, Automation, and Interop functions. Use the BSTR data type in all interfaces that will be accessed from script. C+... 阅读全文
posted @ 2016-07-05 11:58 今夜太冷 阅读(918) 评论(0) 推荐(0) 编辑
GetProcAddress 使用注意事项
摘要:使用GetProcAddressFunction时,有以下几点需要特别留意: 1. 第二个参数类型是LPCSTR,不是; 2. 用__declspec(dllexport),按C名称修饰(extern "C") 导出的函数名,对于__stdcall和__fastcall调用约定是相同的;对__cdecl是不同的(导出的函数名没有前面的下划线);... 阅读全文
posted @ 2016-07-05 11:29 今夜太冷 阅读(14330) 评论(0) 推荐(0) 编辑
C++和.net的集合类对应
摘要:Here's what I've found (ignoring the old non-generic collections): Array- C array, though the .NET Arraycanhave a non-zero starting index. List-std::vector Dictionary-unordered_map ... 阅读全文
posted @ 2016-07-03 21:31 今夜太冷 阅读(396) 评论(0) 推荐(0) 编辑
COM的一些基本概念
摘要:Windows lets you share code at the binary level using DLLs. After all, that's how Windows apps function - reusing kernel32.dll, user32.dll, etc. But since the DLLs are written to a C interface, they... 阅读全文
posted @ 2016-06-28 17:13 今夜太冷 阅读(377) 评论(0) 推荐(0) 编辑
Error Lookup工具
摘要:GetLastError()获取到的错误代码,可以通过VS2013自带的Error Lookup工具来查询错误的描述。 阅读全文
posted @ 2016-06-28 16:52 今夜太冷 阅读(668) 评论(0) 推荐(0) 编辑
关于COM的Unicode string的精彩论述
摘要:I need to make a detour for a few moments, and discuss how to handle strings in COM code. If you are familiar with how Unicode and ANSI strings work, and know how to convert between the two, then you ... 阅读全文
posted @ 2016-06-28 14:50 今夜太冷 阅读(328) 评论(0) 推荐(0) 编辑
const char * 转换为char*
摘要:可以用const_cast const char* aa = "this is a const string."; char* bb = const_cast(aa); return 0; 更多const_cast的用法如下: http://en.cppreference.com/w/cpp/language/const_cast 阅读全文
posted @ 2016-06-24 14:06 今夜太冷 阅读(5049) 评论(0) 推荐(0) 编辑
Convert CString to ANSI string in UNICODE projects
摘要:Convert CString to ANSI string in UNICODE projects Quick Answer: use an intermediate CStringA. Normally, this is not something that should be done. *It is technically unreliable, unless you can guar... 阅读全文
posted @ 2016-05-27 14:15 今夜太冷 阅读(869) 评论(0) 推荐(0) 编辑
如何在程序中使用CString
摘要:在新建项目的时候,如果选择了MFC并且使用ATL,那么在程序中使用CString是没有问题的。 但是如果当初没有选,后面再改,虽然选上了,但是CString在编译的时候还是不被编译器识别。怎么办那? 解决方案: http://blog.csdn.net/xiashengfu/article/details/7911086 同时也复制到这里一份: -------------------------... 阅读全文
posted @ 2016-05-13 21:17 今夜太冷 阅读(3714) 评论(0) 推荐(0) 编辑
MFC apps must not include windows.h
摘要:用VS2008建立一个DLL项目,一开始的时候不想用MFC, 所以选择的是使用标准Windows库。 使用了一段时间后又想用MFC了,所以把选项改成使用在共享 DLL 中使用 MFC。 但是编译的时候报错: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include 看看那么多的... 阅读全文
posted @ 2016-04-26 21:06 今夜太冷 阅读(3755) 评论(0) 推荐(0) 编辑
C++中无法解析的外部符号错误
摘要:在编译C++程序的时候,如果引用了对应的头文件,但是调用一个函数的时候仍然出现" 无法解析的外部符号错误"的编译错误,比如: 无法解析的外部符号__imp__PathFileExistsW@4,该符号在函数 _main 中被引用 那是因为在项目中没有引用.lib文件。 有两种方式解决此问题: 在项目属性->编译器->输入->附加依赖项 中加入.lib文件。 代码头部引入.lib文... 阅读全文
posted @ 2015-11-22 18:57 今夜太冷 阅读(5383) 评论(0) 推荐(0) 编辑
VS2008中生成DLL项目
摘要:创建项目 新建项目-> 选择Win32项目 输入项目名称,点击确定。在程序向导中选择下一步 选择DLL. 由于我想创建的是相对独立的DLL,所以不选择ATL和MFC. 点击完成。 Main文件分析。 打开dllmain.cpp文件,这是DLL的入口文件,在这个文件里,可以在进程或者线程加载此文件时进行一些自己额外的处理。 添加自己的类。 右键点击项目,选择新建-... 阅读全文
posted @ 2015-05-09 11:40 今夜太冷 阅读(7912) 评论(0) 推荐(0) 编辑
C++中delete和delete[]的区别
摘要:一直对C++中的delete和delete[]的区别不甚了解,今天遇到了,上网查了一下,得出了结论。做个备份,以免丢失。 C++告诉我们在回收用 new 分配的单个对象的内存空间的时候用 delete,回收用 new[] 分配的一组对象的内存空间的时候用 delete[]。关于 new[] 和 delete[],其中又分为两种情况:(1) 为基本数据类型分配和回收空间;(2) 为... 阅读全文
posted @ 2014-11-21 16:21 今夜太冷 阅读(148) 评论(0) 推荐(0) 编辑

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