|
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().
|
|
|
|
|
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
modified 12-Oct-17 8:35am.
|
|
|
|
|
I am on VS2017 and the only code required is
#define _WIN32_WINNT 0x0600
#include <WinBase.h>
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"
typedef long long (*tickproc64) (void);
tickproc64 myTick;
long long test(void)
{
long long i = 0;
BOOL freeResult, runTimeLinkSuccess = FALSE;
HMODULE dllHandle = NULL;
dllHandle = LoadLibrary(_T("C:\\Windows\\System32\\kernel32.dll"));
if (NULL != dllHandle)
{
myTick = (tickproc64)GetProcAddress(dllHandle, "GetTickCount64");
if (runTimeLinkSuccess = (NULL != myTick))
{
i = myTick();
}
freeResult = FreeLibrary(dllHandle);
}
return (i);
}
In vino veritas
modified 12-Oct-17 4:49am.
|
|
|
|
|
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
modified 12-Oct-17 8:36am.
|
|
|
|
|
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
|
|
|
|
|
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 called sysinfoapi.h
This file is part of the Windows SDK.
On my machine I have 2 SDKs available and so 2 copies of sysinfoapi.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.h Try 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) Polymorphism in C
|
|
|
|
|
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.
|
|
|
|
|
Any body know how to make VST for Overture 4.0?
|
|
|
|
|
|
this is a try at GP in C++ whit strings
GP what :
from array or grafic to formula
GP how :
1 : write random formula's
2 : sort formula's on error
3 : best fumula's mix to kid's
4 : some kid's are mutated
5 : if genration < max and error > whised goto 2
version 0.1.1
building function run
get "list" outof formula
bluatigro 9 okt 2017
#include <math.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std ;
typedef VSTR vector<string> ;
VSTR split( string in , char cut = ' ' )
{
VSTR uit ;
size_type i = 0 ;
size_type j = in.find( cut ) ;
while ( j != string::npos )
{
uit.push_back( in.substr( i , j - i ) ) ;
i = ++j ;
j = in.find( cut , j ) ;
if ( j == string::npos )
in.push_back( in.substr( i , in.lenght() ) ) ;
}
return uit ;
}
string dbl2str( double x )
{
stringsream ss ;
ss << x ;
return ss.str() ;
}
double str2dbl( string x )
{
}
class GeneProg
{
private :
int numberMode ;
VSTR genes ;
double in[ 10 ] ;
int inmax ;
public :
GeneProg()
{
numberMode = 0 ;
inmax = 0 ;
}
string run( string prog )
{
int einde = prog.find( ']' ) ;
int begin = einde ;
while ( prog[ begin ] != '[' ) ;
begin-- ;
return prog.substr( begin , einde - begin ) ;
}
} ;
int main()
{
GeneProg GP ;
string a = "[ + 7 [ - 2 3 ] ]" ;
string b = "[ * 9 [ / 8 6 ] ]" ;
cout << "[ test run ]" << endl ;
cout << "prog a = " << a << endl ;
cout << "run a = " << GP.run( a ) << endl ;
cout << "check a = " << 7 + ( 2 - 3 ) << endl ;
cout << "prog b = " << b << endl ;
cout << "run b = " << GP.run( b ) << endl ;
cout << "check b = " << 9 * ( 8 / 6 ) << endl ;
cout << "[ game over ]" << endl ;
cin.get() ;
}
|
|
|
|
|
See here for the answers to all of your questions.
Yes, I know you did not actually ask any questions, but if you did, the link would still be considered valuable.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
In this program i have tried to store all the input in the array. The while should continue till the user input 0, but the loop exits only after one input.
#include <conio.h>
#include <stdio.h>
int main(){
int num[50], i, j;
int count = 0;
printf("Enter your integer: \n");
do{
scanf(" %d", &num[i]);
i++;
count++;
}while(num[i]!=0);
for(j=1; j<= count; j++){
if(num[1] > num[j]){
num[1] = num[j];
}
}
printf("%d is the greatest of them all !", num[0]);
return 0;
}
|
|
|
|
|
After entering the first digit you increment i to the next empty cell in the num array. So when you get to the end of the block the expression while(num[i]!=0); is false, and the loop ends. This may not always be the case with an array that is not initialised. You should check the number at the time that it is entered and exit when that is zero.
|
|
|
|
|
can you write the correct code. please!
|
|
|
|
|
I have explained what you need to do, and where to do it. Please try for yourself, you will learn so much more.
|
|
|
|
|
|
First suspicious point : you declare i but you do not initialize it (you also declare j but at least you plan to initialize it in the for loop so it is acceptable).
Second suspicious point: you are to hasty to increment i. If you want to insist using a
do {
...
} while (condition)
loop , and not a
while (condition)
{ ... }
then you must realize that you need to check the value just read (if it was zero) and then , if it not 0 , meaning the user want to keep giving values , increase i++ , getting ready for reading the next element.
Try to implement those 2 points , and also as an extra exercise , implement the
while(condition) {
...
}
It is not hard, you can do it in around half an hour or less, and you will benefit a lot by pondering on how it will differ from your
do { ... } while(condition)
|
|
|
|
|
|
One more thing that I would like to add is that you should initialize variable i to 0 .
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
|
|
|
|
|
|
THE WORKING CODE
Quote: #include <conio.h>
#include <stdio.h>
int main(){
int num[50], i=0, j;
int count = 0;
printf("Enter your integer: \n");
do{
scanf(" %d", &num[i]);
i++;
count++;
}while(num[i-1]!=0);
for(j=1; j<= count-1; j++){
if(num[0] < num[j]){
num[0] = num[j];
}
}
printf("%d is the greatest of them all !", num[0]);
return 0;
}
|
|
|
|
|
Suggestions:
1) The variable count is not necessary. You can use i instead.
2) The separate for() loop is not necessary. You can do the min/max checking in the while() loop.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|