数组的使用
1.申请
POINT *PPP1 =new POINT[4];
POINT *PPP2 =new POINT[4];
2.删除
delete[] PPP1;
delete[] PPP2;
==========================================================================================
GetPrivateProfileString("Instruction Group Name","Group Name", "", RetStr, 300, "D://My Documents//Visual Studio Projects//PLCCommand//Debug//FunLsChs.txt");
WritePrivateProfileString("jj","kk","iafdsf","D://My Documents//Visual Studio Projects//PLCCommand//Debug//dd.ini");
//要用绝对路径//如果不用Private,则读写的是win.ini文件
==========================================================================================
m_hCEdit1.EnableScrollBarCtrl(SB_HORZ,0);//去掉水平滚动条
==========================================================================================
增加字符串 或者是连接
CString m_hhua;
m_hhua.AppendFormat("%s/r/n","sdfsdfsd");
m_hhua.AppendFormat("%s","1234567890");
MessageBox(m_hhua);
==========================================================================================
临时目录
char*huahuahua;
huahuahua=new char[255];
::GetTempPath(255,huahuahua);
MessageBox(huahuahua);
delete huahuahua;
==========================================================================================
列表框 选择
int nIndex =m_hList1.GetCurSel();
m_hList1.GetText(nIndex, sText);
==========================================================================================
<?xml version="1.0" encoding="gb2312"?>
==========================================================================================
向数据库中写东西,不论是什么类型字段,只要是格式对,均用cstring.getbuffer()来写入即可
列表框 需要调整以下下来框的大小,点击下拉尖头即可调整
创建新数据库
//CDaoDatabase db1;
//db1.Create("d://123.mdb",dbLangChineseSimplified,dbVersion30);//////
创建表和字段 索引
db.Create("MyNet.mdb",dbLangChineseSimplified,dbVersion40);
m_strFileName="MyNet.mdb";
//创建空表
CDaoTableDef*mtable=new CDaoTableDef(&db);
mtable->Create("information");
CDaoFieldInfo*mfieldinfo=new CDaoFieldInfo;
//-------------------------------------------------------
mfieldinfo->m_nOrdinalPosition=0;
mfieldinfo->m_strName=_T("id");
mfieldinfo->m_nType=dbLong;
mfieldinfo->m_lSize=4;
mfieldinfo->m_strDefaultValue=_T("");
mfieldinfo->m_bRequired=FALSE;
#if _MFC_VER == 0x400
mfieldinfo->m_bAllowZeroLength=TRUE;
#else
mfieldinfo->m_bAllowZeroLength=FALSE;
#endif;
mfieldinfo->m_strValidati("");
mfieldinfo->m_strValidati("");
mfieldinfo->m_lAttributes=dbFixedField+dbAutoIncrField;//自动编号
mtable->CreateField(*mfieldinfo);
mtable->Append();
//mtable->CreateField("ID1",dbLong,4,dbFixedField + dbAutoIncrField);
//mtable->CreateField("NAME1",dbText,10);
//主键
//index name:PrimaryKey
//primary required unique
CDaoIndexInfo*indexinfo=new CDaoIndexInfo;
CDaoIndexFieldInfo*fieldinfo=new CDaoIndexFieldInfo;
fieldinfo->m_strName=_T("id");
fieldinfo->m_bDescending=FALSE;
indexinfo->m_strName=_T("PrimaryKey");
indexinfo->m_pFieldInfos=fieldinfo;
indexinfo->m_bPrimary=TRUE;
indexinfo->m_bRequired=TRUE;
indexinfo->m_bIgnoreNulls=FALSE;
indexinfo->m_bUnique=TRUE;
indexinfo->m_nFields=1;
mtable->CreateIndex(*indexinfo);
mtable->Close();
db.Close();
delete mfieldinfo;
delete indexinfo;
delete mtable;
1.申请
POINT *PPP1 =new POINT[4];
POINT *PPP2 =new POINT[4];
2.删除
delete[] PPP1;
delete[] PPP2;
==========================================================================================
GetPrivateProfileString("Instruction Group Name","Group Name", "", RetStr, 300, "D://My Documents//Visual Studio Projects//PLCCommand//Debug//FunLsChs.txt");
WritePrivateProfileString("jj","kk","iafdsf","D://My Documents//Visual Studio Projects//PLCCommand//Debug//dd.ini");
//要用绝对路径//如果不用Private,则读写的是win.ini文件
==========================================================================================
m_hCEdit1.EnableScrollBarCtrl(SB_HORZ,0);//去掉水平滚动条
==========================================================================================
增加字符串 或者是连接
CString m_hhua;
m_hhua.AppendFormat("%s/r/n","sdfsdfsd");
m_hhua.AppendFormat("%s","1234567890");
MessageBox(m_hhua);
==========================================================================================
临时目录
char*huahuahua;
huahuahua=new char[255];
::GetTempPath(255,huahuahua);
MessageBox(huahuahua);
delete huahuahua;
==========================================================================================
列表框 选择
int nIndex =m_hList1.GetCurSel();
m_hList1.GetText(nIndex, sText);
==========================================================================================
<?xml version="1.0" encoding="gb2312"?>
==========================================================================================
向数据库中写东西,不论是什么类型字段,只要是格式对,均用cstring.getbuffer()来写入即可
列表框 需要调整以下下来框的大小,点击下拉尖头即可调整
创建新数据库
//CDaoDatabase db1;
//db1.Create("d://123.mdb",dbLangChineseSimplified,dbVersion30);//////
创建表和字段 索引
db.Create("MyNet.mdb",dbLangChineseSimplified,dbVersion40);
m_strFileName="MyNet.mdb";
//创建空表
CDaoTableDef*mtable=new CDaoTableDef(&db);
mtable->Create("information");
CDaoFieldInfo*mfieldinfo=new CDaoFieldInfo;
//-------------------------------------------------------
mfieldinfo->m_nOrdinalPosition=0;
mfieldinfo->m_strName=_T("id");
mfieldinfo->m_nType=dbLong;
mfieldinfo->m_lSize=4;
mfieldinfo->m_strDefaultValue=_T("");
mfieldinfo->m_bRequired=FALSE;
#if _MFC_VER == 0x400
mfieldinfo->m_bAllowZeroLength=TRUE;
#else
mfieldinfo->m_bAllowZeroLength=FALSE;
#endif;
mfieldinfo->m_strValidati("");
mfieldinfo->m_strValidati("");
mfieldinfo->m_lAttributes=dbFixedField+dbAutoIncrField;//自动编号
mtable->CreateField(*mfieldinfo);
mtable->Append();
//mtable->CreateField("ID1",dbLong,4,dbFixedField + dbAutoIncrField);
//mtable->CreateField("NAME1",dbText,10);
//主键
//index name:PrimaryKey
//primary required unique
CDaoIndexInfo*indexinfo=new CDaoIndexInfo;
CDaoIndexFieldInfo*fieldinfo=new CDaoIndexFieldInfo;
fieldinfo->m_strName=_T("id");
fieldinfo->m_bDescending=FALSE;
indexinfo->m_strName=_T("PrimaryKey");
indexinfo->m_pFieldInfos=fieldinfo;
indexinfo->m_bPrimary=TRUE;
indexinfo->m_bRequired=TRUE;
indexinfo->m_bIgnoreNulls=FALSE;
indexinfo->m_bUnique=TRUE;
indexinfo->m_nFields=1;
mtable->CreateIndex(*indexinfo);
mtable->Close();
db.Close();
delete mfieldinfo;
delete indexinfo;
delete mtable;