阅读:1173回复:6
AllenZh请帮帮我!
人笨真的是没办法,虽然看了你发的那两个函数的说明,但我还是不太懂这两个函数的用法,能帮我讲一下你给我发的那一段代码吗?还有,我把那段代码加到我的文件里去,但编译时提示error C2088: '*' : illegal for union和 error C2088: '-' : illegal for union 两个错误.不清楚该怎么改啊?请多帮忙!多谢多谢!!!
|
|
沙发#
发布于:2004-08-01 08:38
明显的语法错误,把出错的几行贴出来
|
|
|
板凳#
发布于:2004-08-01 10:12
void Delay(ULONG xMs)
{ LARGE_INTEGER llStart ; LARGE_INTEGER llEnd ; LARGE_INTEGER llFreq ; llFreq = llFreq*xMs/1000 ; KeQueryPerformanceCounter(&llFreq ) KeQuerySystemTime(&llStart) ; do KeQuerySystemTime(&llEnd) ; while((llEnd-llStart)<llFreq) ; } KeQueryPerformance和KeQuerySystemTime这两个函数你用过吗?我看搞太懂怎么用这两个函数控制时间,请多多指点!先谢过了!出错的两行是llFreq = llFreq*xMs/1000 和while((llEnd-llStart)<llFreq) ; [编辑 - 8/1/04 by zsh_7769] |
|
地板#
发布于:2004-08-01 12:50
这样
void Delay(ULONG xMs) { LARGE_INTEGER llStart ; LARGE_INTEGER llEnd ; LARGE_INTEGER llFreq ; KeQueryPerformanceCounter(&llFreq ) ; llFreq.QuadPart = llFreq.QuadPart*xMs/1000 ; KeQuerySystemTime(&llStart) ; do KeQuerySystemTime(&llEnd) ; while((llEnd.QuadPart-llStart.QuadPart)<llFreq.QuadPart) ; } 上次哪个随手写的,没有测试,不好意思给添麻烦了。 ________________________________________________________ 回答的好请给分 |
|
|
地下室#
发布于:2004-08-01 12:52
你看哪个do while循环
通过它控制看时间是不是过了给定的值 ________________________________________________________ 回答的好请给分 |
|
|
5楼#
发布于:2004-08-03 20:08
看一看LARGE_INTEGER结构的定义
typedef union _LARGE_INTEGER { struct { DWORD LowPart; LONG HighPart; }; LONGLONG QuadPart; } LARGE_INTEGER, *PLARGE_INTEGER; 明显得语法错误,需要引用其成员,如 llFreq.QuadPart,说明如下: The LARGE_INTEGER structure is actually a union. If your compiler has built-in support for 64-bit integers, use the QuadPart member to store the 64-bit integer. Otherwise, use the LowPart and HighPart members to store the 64-bit integer. [编辑 - 8/3/04 by snowStart] |
|
|
6楼#
发布于:2004-08-04 21:10
多谢AllenZh和snowStart的帮助!给分啦,接住!虽然不多!请别介意.
|
|