Posts tagged C++/CLI
How to: Migrating a CLR console Visual C++ project to Windows Forms
- 17 December 2012
Note: Windows Forms programming in new development is discouraged by Microsoft at this point as Microsoft wants to make full use of hardware accelerated drawing instead of using the CPU-intensive GDI. But maintaining old Windows Forms code in Visual C++ 2012 is still supported, GDI isn’t going anywhere anytime soon. Visual C++ 2012 removed the Windows Forms project template and I see people scramble to find ways to create a Windows Forms project. There is a walkaround that’s been around for years, that is, to convert a CLR console application to a Windows one, then add forms related code to the project. The basic steps are listed at http://support.microsoft.com/kb/317433, conveniently named “How to suppress the console window for a managed extensions to Visual C++ Windows Forms application”. Yes, the need to convert a C++ console application to windows forms is that old, back all the way back in the managed extensions for C++ days. So what I need to do to add Windows Forms support to a C++/CLI console application? Of course the System.Windows.Forms.dll reference is missing in a new console application, so I need to reference it:
What is the difference between int and System::Int32
- 22 November 2010
Some may say identical, at least that’s what the Visual C++ compiler tells you at the first glance when you turn on /oldsyntax public __gc class Class1 { public: void F1(int a){} void F1(System::Int32 a){} //Error 2 error 2535: void Class1::F1(int)’ : member function already defined or declared } Okay, so if I add & to the parameter types I should get the same error right?void F1(int&a){} void F1(System::Int32& a){} Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped Wait, didn’t I get an error just now? You are right, somehow the compiler treat the two types differently when passing by reference. look at the function signatures in MSIL. Int32 is passed by reference as expected
《转换指南: 将程序从托管扩展C++迁移到C++/CLI》译后
- 17 March 2005
终于把Stan Lippman先生的这篇文章译完了。从去年4月在全球MVP峰会上拿到这篇文章的手稿到现在,差不多一年过去了。虽然当时的Visual Studio 2005还不支持一些语法,但是我和董颖涛对新的C++/CLI语言都很感兴趣,在当时就讨论过翻译的问题。之后我就开始翻译这篇文章,但是进度一直很慢——主要是杂务太多、语言上的困难(尽量避免误解和词不达意的情况,以及斟酌用词的选择)。在1月份完成了全文之后,看到了Sunhui的一篇文章(http://community.csdn.net/expert/Topicview1.asp?id=3834281),觉得附录里面讲到的一些内容或许一些人也有兴趣,所以继续翻译附录的工作,幸好现在是春假,比较有时间,终于在今天完成了。译文目前在http://blog.csdn.net/jiangsheng/archive/2004/10/18/140450.aspx可以访问,希望读者指正。