1.跳出消息说明为System::Windows::Forms::MessageBox::Show();
2.类的属性声明为 private: static int i=0;必须添加static
3.控件属性为this->label1->Text
4.C++没有null这个标记符
5.对于类型的new一般设置为gcnew
6.线程的定义为private: static System::Threading::Thread^ threadtest;
7.在string类型在C++中是#include <string>和using namespace std;
声明字符串是 std::string这是VC6.0中的定义
8. 利用VS2008中的字符串定义
System::String^ test="hello world!";
System::Windows::Forms::MessageBox::Show(test);
添加 #include<iostream>
using namespace std;
string a;
9.数组的定义。
整型数组定义 System::Int32 a[10];
字符串数组定义 array<System::String^>^ StrArray;
array<System::String ^> 是System::String的泛类.其实就是个字符串数组
例子:array<System::String^,2>^ doubleArray=gcnew array<System::String^,2>(2,2);
整型定义 System::Int32 a;
10.Std:string与System::String ^相互转换
std::string ConvertToString(System::String^ str)
{
int q=(int)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str);
char* p=(char*)q;
return std::string(p);
}
主要是为了unicode到ansi的转换
11.
::的含义:
^的含义:类型名称String后面的字符^表示这是引用String类型对象的句柄。
12. array与System:Array是不相同的
13.C#中的new 与VC++中的gcnew
14.Header Files文件夹
Resource Files文件夹
Source Files文件夹
ReadMe.txt
这四个部分
主函数部分
#include "stdafx.h"
#include<iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
15.stdafx.h
名称的英文全称为:Standard Application Framework Extensions
16.C++程序类别
1.ATL
2.CLR
在这里可以使用using namespace System;
因为其多了个AssemblyInfo.cpp
3.General
4.MFC
5.Smart Device
6.Win32
win32 Console Application
win32 Project
17.利用C++书写界面,一个是直接利用MFC来实现,另外一个是通过WIN32Project来实现。
(1)建立一个win32Project应用
控件的文本 在这里是Caption
在Resource Files里面的.rc文件 双击
可以看到Dialog文本框
Accelerator
Dialog
Icon
Menu
String Table
(2)主架构在程序定义的时候已经实现