Where is GetTickCount64()?
-
Hi, You did not give enough information... what compiler are you using? What is the target platform? It sounds like you are using an old compiler. If you are on an older compiler then you may need to download the "Platform SDK" or "Windows SDK"[^] to obtain more recent LIB and headers. Side Note: If these older SDK are critical for your business then I highly recommend downloading and keeping an archived copy before the Windows 7 SKU reaches EOL of the 2020 extended support. Once those operating systems reach EOL the SDK download links may disappear. Best Wishes, -David Delaune
Hi and thank you for the help. The compiler is Microsoft visual Studio 2005 and 2015, (MSVC). I run the program on these OS's: Windows 7, 8, and 10. I search both compilers for any header file that contains GetTickCount64 but its not hear, Yes, I google the internet but nothing suggest where it is defined. Microsoft defines it in Winbase.h but not in my compilers from Microsoft. Most importantly, what is the LIB that has this function? Its also helpful if I can find the header file but really not that important, just want the LIB and maybe a file date of the LIB to make sure I have the right one.
-
The function is defined in Winbase.h did you include it?
In vino veritas
Hi and thanks but I looked there and the Internet before I would post it here. I just need some extra help in locating this elusive function, GetTickCount64().
-
Please help: I cannot find the header file for GetTickCount64() I am using GetTickCount() but that is only good for about 49 days and my program runs forever..maybe. Anyway, I am using C++ with MFC I even tried this: #if (_WIN32_WINNT >= 0x0600) WINBASEAPI ULONGLONG WINAPI GetTickCount64(void); #endif But that only declares it so the compiler doesn't complain and don't need the header file but its not in any library or DLL that I can find. I have tried searching everywhere on the computer and the internet, what am I doing wrong? I am using both MSVC2005 and MSVC2015 with very bad luck. Compilers parameters: Application (.exe) Use MFC in a Static Library Use of ATL: Static Link to ATL Use Multi-Byte Character Set No Common Language Runtime support and #define WINVER 0x0601 Thanks in advance Craig
The documentation for
GetTickCount64
says to include windows.h - https://msdn.microsoft.com/en-us/ms724411[^] When searching for the method declaration, I was able to find it in a file calledsysinfoapi.h
This file is part of the Windows SDK. On my machine I have 2 SDKs available and so 2 copies ofsysinfoapi.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\sysinfoapi.h
C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.hTry compiling after downloading and installing the SDK from here - https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk[^]
«_Superman_» _I love work. It gives me something to do between weekends.
_Microsoft MVP (Visual C++) (October 2009 - September 2013)
-
Hi and thank you for the help. The compiler is Microsoft visual Studio 2005 and 2015, (MSVC). I run the program on these OS's: Windows 7, 8, and 10. I search both compilers for any header file that contains GetTickCount64 but its not hear, Yes, I google the internet but nothing suggest where it is defined. Microsoft defines it in Winbase.h but not in my compilers from Microsoft. Most importantly, what is the LIB that has this function? Its also helpful if I can find the header file but really not that important, just want the LIB and maybe a file date of the LIB to make sure I have the right one.
Well, I can assure you that both of those compilers were distributed with headers and libs that include the GetTickCount64 function. If you are using VS2015 and cannot compile/link with the GetTickCount64 function then you need to fix your headers and compiler macro/defines. Search all your files for _WIN32_WINNT and WINVER. Using the Windows Headers[^] Best Wishes, -David Delaune
-
Hi and thanks but I looked there and the Internet before I would post it here. I just need some extra help in locating this elusive function, GetTickCount64().
The documentation is clear: GetTickCount64 function (Windows)[^]. If you cannot find it then there must be something corrupted in your installation. Your original message says you are using VS 2005 and 2015; are you sure you have the latest SDK connected?
-
Hi and thanks but I looked there and the Internet before I would post it here. I just need some extra help in locating this elusive function, GetTickCount64().
I am on VS2017 and the only code required is
#define _WIN32_WINNT 0x0600
#include
void test(void)
{
long long i = GetTickCount64();
}You also have me slight bemused you keep talking about finding the code, which is impossible it is buried in the kernel32.dll all you will find is the header file. Here let me dynamically link it for you .. that is where the code is end of story. If it doesn't work your O/S is earlier than Vista.
#include "tchar.h" // Unicode support
typedef long long (*tickproc64) (void);
tickproc64 myTick;long long test(void)
{
long long i = 0;
BOOL freeResult, runTimeLinkSuccess = FALSE;
HMODULE dllHandle = NULL;//Load the dll and keep the handle to it dllHandle = LoadLibrary(\_T("C:\\\\Windows\\\\System32\\\\kernel32.dll")); // If the handle is valid, try to get the function address. if (NULL != dllHandle) { //Get pointer to our function using GetProcAddress: myTick = (tickproc64)GetProcAddress(dllHandle, "GetTickCount64"); // Name must be ascii // If the function address is valid, call the function. if (runTimeLinkSuccess = (NULL != myTick)) { i = myTick(); } //Free the library: freeResult = FreeLibrary(dllHandle); } return (i);
}
In vino veritas
-
The documentation is clear: GetTickCount64 function (Windows)[^]. If you cannot find it then there must be something corrupted in your installation. Your original message says you are using VS 2005 and 2015; are you sure you have the latest SDK connected?
Yes, thank you. My environment variables were corrupted. Probably when installed the MSVC2015 while 2005 was active. I do have the latest WindowsSDK (v7.1A) and pointed to it inside MSVC2005 project, not options. It compiles and Links ok. I do have a warning message stating TmSchema.h is obsolete. Please include vssym32.h instead. However,not sure where its coming from so I have to search each file of 1,900 header files in the SDK to find a header that is pointing to it. It gets this message every-time it compiles a file because it does the stdafx.h first. So, I need to check each include in the stdafx.h too. Thanks for the help
-
I am on VS2017 and the only code required is
#define _WIN32_WINNT 0x0600
#include
void test(void)
{
long long i = GetTickCount64();
}You also have me slight bemused you keep talking about finding the code, which is impossible it is buried in the kernel32.dll all you will find is the header file. Here let me dynamically link it for you .. that is where the code is end of story. If it doesn't work your O/S is earlier than Vista.
#include "tchar.h" // Unicode support
typedef long long (*tickproc64) (void);
tickproc64 myTick;long long test(void)
{
long long i = 0;
BOOL freeResult, runTimeLinkSuccess = FALSE;
HMODULE dllHandle = NULL;//Load the dll and keep the handle to it dllHandle = LoadLibrary(\_T("C:\\\\Windows\\\\System32\\\\kernel32.dll")); // If the handle is valid, try to get the function address. if (NULL != dllHandle) { //Get pointer to our function using GetProcAddress: myTick = (tickproc64)GetProcAddress(dllHandle, "GetTickCount64"); // Name must be ascii // If the function address is valid, call the function. if (runTimeLinkSuccess = (NULL != myTick)) { i = myTick(); } //Free the library: freeResult = FreeLibrary(dllHandle); } return (i);
}
In vino veritas
Many thanks. The reason I wanted to know where the function resides is because I also saw the documentation of this function and I specified this kernel32 in my project to link with it but still didn't work. I do have more than one Kernel32 and tried them all. That is why I wanted to know where this function is defined. As it turns out, my environment variables were corrupted and my directory search for the compiler/linker didn't go beyond its own base directory. I manually put in the WindowsSDK lib and include and got it running. Still have minor issues but will get there. Thanks again for your patients. Craig
-
The documentation for
GetTickCount64
says to include windows.h - https://msdn.microsoft.com/en-us/ms724411[^] When searching for the method declaration, I was able to find it in a file calledsysinfoapi.h
This file is part of the Windows SDK. On my machine I have 2 SDKs available and so 2 copies ofsysinfoapi.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\sysinfoapi.h
C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.hTry compiling after downloading and installing the SDK from here - https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk[^]
«_Superman_» _I love work. It gives me something to do between weekends.
_Microsoft MVP (Visual C++) (October 2009 - September 2013)
REALLY!! I did not know this. I looked at this file "sysinfoapi.h" and it looks like the contents of the file Winbase.h in the WindowsSDK That is fantastic so if I compile for windows 8 or 10, I will include it. I re-downloaded 8.1 and refreshed it because mine was downloaded about 2 years ago and I had forgotten all about them, thanks for the memory jog...getting old.
-
I am on VS2017 and the only code required is
#define _WIN32_WINNT 0x0600
#include
void test(void)
{
long long i = GetTickCount64();
}You also have me slight bemused you keep talking about finding the code, which is impossible it is buried in the kernel32.dll all you will find is the header file. Here let me dynamically link it for you .. that is where the code is end of story. If it doesn't work your O/S is earlier than Vista.
#include "tchar.h" // Unicode support
typedef long long (*tickproc64) (void);
tickproc64 myTick;long long test(void)
{
long long i = 0;
BOOL freeResult, runTimeLinkSuccess = FALSE;
HMODULE dllHandle = NULL;//Load the dll and keep the handle to it dllHandle = LoadLibrary(\_T("C:\\\\Windows\\\\System32\\\\kernel32.dll")); // If the handle is valid, try to get the function address. if (NULL != dllHandle) { //Get pointer to our function using GetProcAddress: myTick = (tickproc64)GetProcAddress(dllHandle, "GetTickCount64"); // Name must be ascii // If the function address is valid, call the function. if (runTimeLinkSuccess = (NULL != myTick)) { i = myTick(); } //Free the library: freeResult = FreeLibrary(dllHandle); } return (i);
}
In vino veritas
My problem is fixed, environment issues. But, how do you like VS2017? I hear its about like 2015. I would love to hear your comments. Craig
-
My problem is fixed, environment issues. But, how do you like VS2017? I hear its about like 2015. I would love to hear your comments. Craig
Download and try it, costs nothing for a single developer except download time. It is similar to VS2015 but a pile of new features. Few annoyances you have to select to install C++ it doesn't default to installing it.
In vino veritas