|
Thanks a lot! It seems the method in your first post is so far the only solution I could find. Thanks again.
David
|
|
|
|
|
David wrote: It seems the method in your first post is so far the only solution I could find.
why we can't change the exe file through code??
Reason may be as follow..
The Exe which is in execution mode is locked,so that no one can change the file/exe name hold br Exe (Here exceptional case is shared resources)..even you can't delete the directory under which your exe reside and is in execution.
When the execution completes then the resources hold by the exe released and you can do whatever you want.
Conclusion is you can change the name of the exe through code of other executable not the same executable which is executing your code of changing the exe name.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
In Menu Project->Settings->Link Tab->In outputFile Name,enter new EXE name.
|
|
|
|
|
A_Laxman answered to the post earlier. You should be reading the post's before posting a new solution to it. Please do not repeat.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: You should be reading the post's before posting a new solution to it. Please do not repeat.
Do us all a favour and shut up.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
_AnShUmAn_ wrote: A_Laxman answered to the post earlier. You should be reading the post's before posting a new solution to it. Please do not repeat.
Posting the same information from more than one person does not warrant such a response. In many cases, those posts to which you refer have not been made at the time of responding. For example, I may have a dozen browser windows open, each with a different thread, sometimes to the same thread. If I am replying to several at once, it may be 5-10 minutes between the time I clicked Reply and the time I click Post.
In any case, if the OP receives several responses with the same solution, s/he can be assured that the given solution must be correct.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes David,
I acknowledged that .
Thanks for your guidance.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hello everyone,
What is the convenient way to calculate the execution time of a function? The function may be not a long and time consuming function -- only 10 lines in some situation.
thanks in advance,
George
|
|
|
|
|
One of the ways could be to use QueryPerformanceCounter()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thank you _AnShUmAn_!
I have tried the method, and the results are in LARGE_INTEGER structure. Do you know how to calculate the difference between two LARGE_INTEGER structure variable (the difference of begin time and complete time)? I have tried to use '-' sign, but there are compiling errors.
regards,
George
|
|
|
|
|
use GetTickCount function before and after the function and take the difference. But it only have a resolution of 15 milliseconds. For high resolution use
QueryPerformanceCounter()
nave
|
|
|
|
|
Thank you nave,
I have tried the method, and the results are in LARGE_INTEGER structure. Do you know how to calculate the difference between two LARGE_INTEGER structure variable (the difference of begin time and complete time)? I have tried to use '-' sign, but there are compiling errors.
regards,
George
|
|
|
|
|
check this
LARGE_INTEGER tBefore, tAfter, iPerfFrequency;
float TimeElapsed;
// to determine how often the performance counter increments
QueryPerformanceFrequency( &iPerfFrequency);
// Get performance counter before the function
QueryPerformanceCounter(&tBefore);
MyFunction() // Call the function for which the performace is to be calculated
QueryPerformanceCounter(&tAfter);
TimeElapsed = tAfter.QuadPart - tBefore.QuadPart;// finding elapsed time
TimeElapsed = TimeElapsed / iPerfFrequency.QuadPart;
cout<
|
|
|
|
|
Thank you nave!
I have tried your code, and it works cool! I have also referenced related MSDN document, and I think your method will print out the elapsed seconds, right?
regards,
George
|
|
|
|
|
|
|
I think better way would be try to find out the Time and space complexity for the function and then use the QueryPerformanceCounter().
Cheers
"Peace of mind through Technology"
|
|
|
|
|
I have tried the method, and the results are in LARGE_INTEGER structure. Do you know how to calculate the difference between two LARGE_INTEGER structure variable (the difference of begin time and complete time)? I have tried to use '-' sign, but there are compiling errors.
regards,
George
|
|
|
|
|
If you are happy to test function times in the IDE, use the profiler - much more convenient and more accurate than other methods.
Look for help on Profiler in MSDN - I have not used it for years, and I remember it can be a pain working out how to activate it. And I had one project where I could not turn it on, no matter what I tried.
|
|
|
|
|
Thank you normanS!
Can you provide a link to the Profiler tool? I have searched "Profiler", but all I can get is SQL related profiler.
regards,
George
|
|
|
|
|
What Visual Studio are you running?
If you say that you are using VS6, I will look on my home PC - I do not have a development environment at work!
(I see you have already received answers that do the job, but learning how to use profiler is worth it anyway!)
-- modified at 5:45 Thursday 15th June, 2006
|
|
|
|
|
Hi normanS,
I am using Visual Studio 2003 (Visual Studio.Net). Do you have any reference URLs for how to use profiler for this version?
regards,
George
|
|
|
|
|
Sorry for the slow reply - Friday was a holiday and I don't check email at home!
I can't help you with the profiler for VS2003. I have only used Visual Studio 6 (and even in VS6, I have difficulty finding the profiler!)
|
|
|
|
|
Thank you all the same man,
I appreciate your comments and ideas in the past.
regards,
George
|
|
|
|
|
If you are using VC++ v6, it's at the bottom of the Build menu. If it's disabled, you'll first need to rebuild the project with profiling information.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|