平时的经验

 BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID);

参数解释:

LPCTSTR lpszCaption     指针类型的字符串    对象的标题
DWORD dwStyle           双字节              对象的风格
const RECT &rect        矩形区域            对象的图象大小
CWnd *pParentWnd        窗口指针            对象所在的窗口
UINT nID                ID类型              对象所属的ID

 

TCHAR imagepath[MAX_PATH];
wcscpy(imagepath,unit_image[n].c_str());

1.定义一个TCHAR型的变量
2.将unit_image[n]的内容复制给变量,其中unit_image为vector<wstring>类型

 


void MoveWindow(LPCRECT lpRect, BOOL bRepaint = TRUE);
RECT pic_rc;
m_staticimage.MoveWindow(&pic_rc);

1.根据参数要求填写参数
2.可以用&符合来表示引用对象的指针


USES_CONVERSION; A2T转换时要用到的宏,A2T是unicode的中的字符转换命令:

ATL 3.0 String Conversion Macros
The original text conversion macros are still available and are listed in the table below:

 In the macro names, the source string type is on the left (for example, A) and the destination string type is on the right (for example, W). A stands for LPSTR, OLE stands for LPOLESTR, T stands for LPTSTR, and W stands for LPWSTR.

 If there is a C in the macro name, the macro converts to a const string. For example, W2CA converts an LPWSTR to an LPCSTR.

 Thus, A2W converts an LPSTR to an LPWSTR, OLE2T converts an LPOLESTR to an LPTSTR, and so on.

 The behavior of the ATL string conversion macros depends on the compiler directive in effect, if any. If the source and destination types are the same, no conversion takes place. Compiler directives change T and OLE as follows:


 The destination string is created using _alloca, except when the destination type is BSTR. Using _alloca allocates memory off the stack, so that when your function returns, it is automatically cleaned up. By default this macro will only convert up to 500KB at one time.

 When using an ATL string conversion macro, specify the USES_CONVERSION macro at the beginning of your function in order to avoid compiler errors. For example:

void func( LPSTR lpsz )
{
   USES_CONVERSION;
   ...
   LPWSTR x = A2W(lpsz)
   // Do something with x
   ...
}


wstring和CString之间的转换:

wstring  text1;
CString text2;

wstring text1 = text2.GetBuffer(1);  其中1表示他的最小长度

CString text2 = text1.c_str();

 


Time类型与string类型的转换:

CTime==>CString

CTime time;
time.GetCurrentTime();
CString str;
str.Format("%s",time.Format("%y:%m:%d %H-%M-%S")

1
CString str;
CTime t = CTime::GetCurrentTime();
str.Format("%d-%d-%d",t.GetYear(),t.GetMonth(),t.GetDay());
2
CString strTime;
CTime tTime = CTime::GetCurrentTime();
strTime = tTime.Format("%Y-%m-%d %H:%M:%S");

CString ==>CTime

strCString="2003-10-27 6:24:37"; //CString--->COleDateTime
COleVariant vtime(strCString);
vtime.ChangeType(VT_DATE);
COleDateTime time4=vtime;

COleDateTime time1(1977,4,16,2,2,2); //COleDataTime--->CTime
SYSTEMTIME systime;
VariantTimeToSystemTime(time1, &systime);
CTime tm(systime);

time_t time2=tm.GetTime(); //CTime--->time_t
COleDateTime time3(time2); //time_t--->COleDateTime

时间差
COleDateTime strFirst,strEnd;
strFirst = COleDateTime(strFirst.GetYear(),strFirst.GetMonth(),strFirst.GetDay(),0,0,0);
strEnd = COleDateTime(tmCurrent.GetYear(),tmCurrent.GetMonth(),tmCurrent.GetDay(),23,59,59);
tspan= strEnd - strFirst;
注:两个时间相减时,小时数不足24小时的,自动略去,不做一天计算。如7.1号 5点与7.2号3点间,就不能计算为一天。想要得出结果为一天的,要注意小时的赋值!!


平时使用Keil可以说是我在嵌入式软件开发中的重要工具之一。我主要使用Keil来进行ARM微控制器的开发,以下是我在使用Keil过程中的一些经验积累。 首先,Keil提供了一个友好的集成开发环境(IDE),具有图形化界面和丰富的功能,使得编写、调试和测试代码变得更加方便。我习惯使用其编辑器来编写程序代码,它提供了自动完成、错误检查和代码格式化等功能,帮助我提高代码质量和开发效率。 其次,Keil针对不同的微控制器提供了对应的软件包和驱动程序,使得开发过程更加高效。我可以轻松地选择和导入合适的软件包,为我提供了许多功能模块,如定时器、串口通信和外设控制等。通过简单的配置和编程,我可以轻松地实现所需的功能,并减少了很多开发工作量。 此外,Keil还提供了丰富的调试功能,方便我进行程序的调试和错误排查。我可以使用其集成的仿真器来查看寄存器的状态、变量的值和堆栈跟踪等信息,有助于我找到问题并进行修复。同时,Keil还提供了性能分析和代码覆盖率等功能,帮助我优化程序性能和测试代码覆盖率。 最后,Keil还有一个强大的版本管理功能,可以帮助我管理和控制代码的版本变更。我可以轻松地对不同版本的代码进行比较、回滚和合并等操作,确保团队成员之间的协作和代码的可追溯性。 综上所述,通过平时的使用,我积累了不少关于Keil的经验。它为我提供了一个高效、便捷和可靠的开发环境,帮助我更好地进行ARM微控制器的开发工作。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值