博客园  :: 首页  :: 联系 :: 管理

文章分类 -  Visual C++ 2005

摘要:Managed Extensions for C++ Reference Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode Managed Extensions for C++ projects that are created as DLLs by defa... 阅读全文

posted @ 2006-12-15 23:08 sunrack 阅读(857) 评论(0) 推荐(0) 编辑

摘要:This month marks the 11th anniversary of my column and the inauguration of a new title: C++ At Work. We're also adding a new bimonthly column, "Pure C++," by my pal Stan Lippman, one of the great C++ ... 阅读全文

posted @ 2006-12-15 22:24 sunrack 阅读(744) 评论(0) 推荐(0) 编辑

摘要:在 Visual Studio .NET 2003 中初始化混合DLLs很麻烦,需要手工干预。但在 Visual Studio 2005 中,Visual C++ 和 CLR 团队设计了一种新的初始化模型,这种新模型更简单,更自动化。 Visual Studio .NET 2003 的根本问题在于将本地代码和托管代码一起置于单“池”中。DllMain 期间该池的运行是不安全的,托管代码根本就不能... 阅读全文

posted @ 2006-12-15 02:51 sunrack 阅读(310) 评论(0) 推荐(0) 编辑

摘要:Visual C++ 链接器选项 /ENTRY(入口点符号) /ENTRY:function 备注 其中: function 一个函数,指定 .exe 文件或 DLL 的用户定义起始地址。 备注 /ENTRY 选项指定一个入口点函数作为 .exe 文件或 DLL 的起始地址。 必须用 __stdcall 调用约定来定义函数。必须按 WinMain... 阅读全文

posted @ 2006-12-15 02:14 sunrack 阅读(1216) 评论(1) 推荐(0) 编辑

摘要:C/C++ 运行时库代码执行 DLL 启动序列,从而不必像 Windows 3.x 中那样必须链接到单独的模块。C/C++ 运行时库代码中包含的是名为 _DllMainCRTStartup 的 DLL 入口点函数。_DllMainCRTStartup 函数执行若干操作,其中包括调用 _CRT_INIT,此操作初始化 C/C++ 运行时库并在静态非局部变量上调用 C++ 构造函数。如果没有此函数,运... 阅读全文

posted @ 2006-12-15 02:12 sunrack 阅读(337) 评论(0) 推荐(0) 编辑

摘要:在 Visual C++ .NET 和 Visual C++ 2003 中,用 /clr 编译器选项编译的 DLL 在加载时可能会发生不确定的死锁;此问题被称为混合 DLL 加载或加载程序锁问题。在 Visual C++ 2005 中,已经从混合 DLL 加载进程中消除了所有的不确定性。但是,还有一些其他情况会导致加载程序锁发生。有关此问题的更多信息,请参见: 网址为 http... 阅读全文

posted @ 2006-12-15 01:48 sunrack 阅读(764) 评论(0) 推荐(0) 编辑

摘要:MFC的DLL 一般的,在介绍Windows编程的书中讲述DLL的有关知识较多,而介绍MFC的书则比较少地提到。即使使用MFC来编写动态链接库,对于初步接触DLL的程序员来说,了解DLL的背景知识是必要的。另外,MFC提供了新的手段来帮助编写DLL程序。所以,本节先简洁的介绍有关概念。 DLL的背景知识 静态链接和动态链接 ... 阅读全文

posted @ 2006-12-15 01:47 sunrack 阅读(7724) 评论(0) 推荐(0) 编辑

摘要:Like you observed, in DllMain (from dllmodul.cpp) we check if __mixedModuleStartup and we don't call InternalDllMain. We do call it later, after managed initalization, using PostDllMain. Not sure if y... 阅读全文

posted @ 2006-12-14 18:58 sunrack 阅读(552) 评论(0) 推荐(0) 编辑

摘要:In Visual C++ .NET and Visual C++ 2003, DLLs compiled with the /clr compiler option could non-deterministically deadlock when loaded; this issue was called the mixed DLL loading or loader lock issue. ... 阅读全文

posted @ 2006-12-14 18:16 sunrack 阅读(956) 评论(0) 推荐(0) 编辑

摘要:Hi, I’m George Mileka and I work on the Visual C++ libraries team. My team owns the CRT, ATL, MFC and STL… One subject I have always been interested in is the startup code and initialization. The subj... 阅读全文

posted @ 2006-12-14 17:53 sunrack 阅读(436) 评论(0) 推荐(0) 编辑

摘要:大家都知道,当编写一个win32 console application时,当运行此类程序的时候默认情况下会有一个类似DOS窗口的console窗口,但是有的时候我们只想在程序中运行一段功能代码,不希望显示这个console窗口,让代码执行完毕之后程序自动退出. 下面就介绍一下,如何隐藏win32 console application的console窗口 因为此种方法是通过设置编译器的链接开关来... 阅读全文

posted @ 2006-12-14 16:23 sunrack 阅读(1284) 评论(0) 推荐(0) 编辑

摘要:User-defined reference types are data types a programmer develops that are accessed using handles,and where the actual data object is located on the managed heap. All reference types in C++/CLI areg... 阅读全文

posted @ 2006-12-14 01:32 sunrack 阅读(166) 评论(0) 推荐(0) 编辑

摘要:The value struct and value class data types are basically C++/CLI’s equivalent to traditional C++’sclass and struct data types but with an added bonus. Both are unmanaged (not garbage collected)constr... 阅读全文

posted @ 2006-12-14 01:24 sunrack 阅读(800) 评论(0) 推荐(0) 编辑

摘要:Table 2-8. Character Fundamental TypeC++/CLI Alias Class Library Valuewchar_t System::Char A single 16-bit Unicode character The .NET Framework class library System::Char is a 16-bit Unicode character... 阅读全文

posted @ 2006-12-14 01:06 sunrack 阅读(177) 评论(0) 推荐(0) 编辑

摘要:Only three kinds of user-defined value types can be created using C++/CLI:• enum class or enum struct (equivalent)• value struct• value classThe enum class and enum struct types are simply named const... 阅读全文

posted @ 2006-12-14 01:05 sunrack 阅读(147) 评论(0) 推荐(0) 编辑

摘要:Conceptually, enums and consts share a lot of similarities. Both enable better readability of code.They also allow for the actual value being represented to be maintained at one location in your code,... 阅读全文

posted @ 2006-12-14 01:05 sunrack 阅读(269) 评论(0) 推荐(0) 编辑

摘要:所谓超前引用是指一个类型在定义之前就被用来定义变量和声明函数。 一般情况下,C/C++要求所有的类型必须在使用前被定义,但是在一些特殊情况下,这种要求无法满足,例如,在类CMyView中保留了一个非模式对话框对象指针,该对象用于显示/修改一些信息。为了实现对话框"应用"按钮,把对话框做的修改立刻更新到view界面上,为此,需要在对话框类中需要保存view类的指针,这样定义关系就变成如下的代码... 阅读全文

posted @ 2006-12-12 23:25 sunrack 阅读(5751) 评论(1) 推荐(1) 编辑

摘要:... 阅读全文

posted @ 2006-12-11 18:59 sunrack 阅读(722) 评论(0) 推荐(0) 编辑

摘要:MFC已经有十几年的历史了,然而直到今天,他仍然是Visual C++的关键组成部分。从1996年的Visual C++ 4.2至今将近8年的时间,MFC的主体特征没有出现明显的变化,依旧是“古老”的面孔,因此关于这个类库的种种评论自然是情理之中的事情了。从我个人的观点上看,MFC功能依旧健壮、强大,而且是业界少有的、稳定的、经过足够长历史考验的开发框架。深入研究这个类库,你会找到酒越酿越醇的感觉... 阅读全文

posted @ 2006-12-11 18:45 sunrack 阅读(466) 评论(0) 推荐(0) 编辑

摘要:场景一:在.NET中调用WindowsAPI或DLL。 这是比较普遍的需求。一般来说,简单的函数调用,大可直接用C#/VB.NET,经过DllImport属性包装出函数来调用。如: [DllImport("KERNEL32.DLL", EntryPoint="MoveFileW", SetLastError=true,CharSet=CharSet.Unicode, ExactSpelling... 阅读全文

posted @ 2006-12-11 00:27 sunrack 阅读(640) 评论(0) 推荐(0) 编辑