VC中提取系统时间怎么老错误啊

来源:百度知道 编辑:UC知道 时间:2024/06/06 21:42:21
void CDynamiclockDlg::LockData(char *FileName, char *TempFile, CString strPassWord)
{

SYSTEMTIME SysTime;GetSystemTime(&Systime);
CString strSysTime;
strSysTime.Format("%d%d%d%d",SysTime.wHour,SysTime.wSecond,SysTime.wMinute,SysTime.wMilliseconds);
unsigned long systime=atol(strSysTime);
strSysTime.Format("%10d",systime);
}
为什么老是显示'Systime' : undeclared identifier。在都文件中我加上了#include "time.h"了啊

你前面一个是SysTime 后面一个是Systime 手误了

void CDynamiclockDlg::LockData(char *FileName, char *TempFile, CString strPassWord)
{

SYSTEMTIME SysTime;
GetSystemTime(&Systime); //此处Systime是什么?与上一行定义不一样啊~
CString strSysTime;
strSysTime.Format("%d%d%d%d",SysTime.wHour,SysTime.wSecond,SysTime.wMinute,SysTime.wMilliseconds);
unsigned long systime=atol(strSysTime);
strSysTime.Format("%10d",systime);
}

C++语言要区分大小写的
把倒数第二行的strSysTime.Format("%10d",systime);
改成
strSysTime.Format("%10d",SysTime);
就行了

本来就没定义,当然是未定义标识了啊
你看你的定义是什么:SYSTEMTIME SysTime

换一个试试,看是哪边有问题!