}
}
else
{
printf("Could not copy file.\n");
//return;
}
if (!FindNextFile(hSearch, &FileData))
{
if (GetLastError() == ERROR_NO_MORE_FILES)
{
printf("Copied all cpp files.\n");
fFinished = TRUE;
}
else
{
printf("Could not find next file.\n");
return;
}
}
}
// Close the search handle.
FindClose(hSearch);
}
void main()
SYSTEMTIME tm;
::GetLocalTime(&tm);
char szBuf[] = "当前时间是:2010年12月31日 23:59:59";
sprintf(szBuf, "当前时间是:%4d年%.2d月%.2d日 %.2d:%.2d:%.2d",
tm.wYear, tm.wMonth, tm.wDay, tm.wHour, tm.wMinute, tm.wSecond);
cout << szBuf <
tm.wYear--;
BOOL bDone = SetLocalTime(&tm);
tm.wYear++;
bDone = SetLocalTime(&tm);
cout << endl;
CopyCppFile();
cout << endl;
GetSysInfo();
cout << endl;
}
编译执行,结果会显示当前的系统时间和相关的系统信息。
由于API接口太多,这里就不一一举例说明了。我们就把它们理解为系统已经提供的这么一些函数,使用的时候在程序中调用就可以。如果参数及函数功能不了解的话,可以查阅MSDN相关资料即可。
作业:
1、使用VC创建典型的“Hello World!”工程,编译并对程序进行单步跟踪,进一步理解Win32程序框架,熟悉相关函数。
2、创建一个Win32应用程序,其中包含一个主窗口和一个子窗口,要求子窗口可以关闭,子窗口关闭后在主窗口中点击鼠标右键重新打开子窗口。
摘自 Java教程