首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

!关于GetSystemTimes函数未定义的有关问题

2012-04-14 
在线等!关于GetSystemTimes函数未定义的问题最近在做的一个东西用到了GetSystemTimes函数,在MSDN上查过后

在线等!关于GetSystemTimes函数未定义的问题
最近在做的一个东西用到了GetSystemTimes函数,在MSDN上查过后知道它是包含在winbase.h头文件里面。
但是在用的过程中,就算我添加了#inclue <winbase.h>,编译时也还是提示GetSystemTimes函数未定义。

在本地计算机进行搜索后,发现在C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include中的winbase.h里面有这个函数,但系统每次都找到的都是C:\Program Files\Microsoft Visual Studio\VC98\Include中的winbase.h。

尝试了两种方法改正:
1、将正确的winbase.h文件拷到project目录下,代码中改为#include "winbase.h",依然找的是C:\Program Files\Microsoft Visual Studio\VC98\Include中的winbase.h,失败;

2、在Tools->Options->Directories中将C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include换到最上方,又出现另一个错误:cannot open include file 'sal.h',仍然失败。

请问各位大侠,是我引用头文件方法不对吗?还是别的什么原因?希望哪位知道的大侠指条明路给我吧,不胜感激~~~


[解决办法]
#include<windows.h>
[解决办法]
查MSDN是Windows程序员必须掌握的技能之一。
ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.chs/sysinfo/base/getsystemtimes.htm
GetSystemTimes Function

Retrieves system timing information. On a multiprocessor system, the values returned are the sum of the designated times across all processors.


BOOL WINAPI GetSystemTimes(
__out LPFILETIME lpIdleTime,
__out LPFILETIME lpKernelTime,
__out LPFILETIME lpUserTime
);

Parameters
lpIdleTime 
A pointer to a FILETIME structure that receives the amount of time that the system has been idle.

lpKernelTime 
A pointer to a FILETIME structure that receives the amount of time that the system has spent executing in Kernel mode (including all threads in all processes, on all processors).

lpUserTime 
A pointer to a FILETIME structure that receives the amount of time that the system has spent executing in User mode (including all threads in all processes, on all processors).

Return Value
If the function succeeds, the return value is nonzero. 

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
To compile an application that uses this function, define _WIN32_WINNT as 0x0501 or later. For more information, see Using the Windows Headers.

Requirements
Client
 Requires Windows Vista or Windows XP SP1.
 
Server
 Requires Windows Server 2008 or Windows Server 2003.
 
Header
 Declared in Winbase.h; include Windows.h.
 
Library
 Use Kernel32.lib.
 
DLL
 Requires Kernel32.dll.
 

See Also
FILETIME
System Time
Time Functions



Send comments about this topic to Microsoft 

Build date: 8/15/2007

热点排行