|
dear all
how to calculate time during processing using Time class, anyone has such code? thanks a lot.
gentleguy
|
|
|
|
|
Are you talking about GetTickCount() ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i just would like to know how to calculate time from start to end processing, which function i can use it? when i used start clock() and end clock(), and CLOCK_PER_SEC, after compiling, output showed didn't declare CLOCK_PER_SEC.
but the time is very small after calculate, how to calculate? any road is ok for me. thanks
gentleguy
|
|
|
|
|
Hi,
Please refer below pseudocode,
long ltime = GetTickCount();
CallYourTimeTakingFunction();
TRACE("Time took = %li\n", GetTickCount() - ltime);
Or,
CTime startTime = CTime::GetCurrentTime();
CallYourTimeTakingFunction();
CTime endTime = CTime::GetCurrentTime();
CTimeSpan elapsedTime = endTime - startTime;
Hope this will server your purpose.
Regards,
Paresh.
|
|
|
|
|
#include <time.h>
clock_t ckStart,ckEnd,duration =0.0;
char buff[1000];
ckStart=clock();
....
.....
ckEnd=clock();
float fDuration=(float)(ckEnd-ckStart)/CLOCK_PER_SEC;
sprintf(buff,"speed=%d ms",fAveduration);
Message Box (buff,"Time");
what is wrong with these code?
output showed no declare CLOCK_PER_SEC.
what is problem. thanks
gentleguy
|
|
|
|
|
gentleguy wrote: float fDuration=(float)(ckEnd-ckStart)/CLOCK_PER_SEC;
Should be,
float fDuration=(float)(ckEnd-ckStart)/CLOCKS_PER_SEC;
Change CLOCK_PER_SEC to CLOCK<big>S</big>_PER_SEC .
Regards,
Paresh.
modified on Friday, May 16, 2008 6:55 AM
|
|
|
|
|
|
What about fc.exe?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Armond Sarkisian wrote: how can I parse and get the information I need? does fc.exe create a log file?
You can easily capture its output.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Armond Sarkisian wrote: ...how do I capture the output of FC.exe?
See here and here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Armond Sarkisian wrote: bool CompareFiles( file1, file2);
do you want to implement this function in c/c++ or are you looking for a ready made function?
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
so, what exactly is the problem to implement it?
did you try
1.opening the two files,
2.reading byte by byte
3.comparing them and generating a report
any problem in implementing the above?
good luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
|
Hey Friends
I need to supply a proxy server to Microsoft Internet Explorer Active X Control.
This should be irrespective of Internet Explorer Settings.
Any idea how we can supply proxy to Microsoft Internet Explorer Active X Control?
Regards
|
|
|
|
|
Application can use different proxy settings for InternetOpen instance (HINTERNET) using InternetSetOption.
[
BOOL InternetSetOption(
__in HINTERNET hInternet,
__in DWORD dwOption,
__in LPVOID lpBuffer,
__in DWORD dwBufferLength
);
^]
where hInternet, InternetOpen instance, if it is NULL, the scope of the settings is global and is default option settings for Internet Explorer. So it changes the settings for WebBrowser control as well as all instance if IE.
If you want to specify proxy settings for your application alone with out changing the default settings, I don't know any interface exposed by WebBrowser control.
But with some effort you can achieve that, you may open an HINTERNET , InternetOpen instance for your application with proxy settings, and download the URL file using [wininet APIs^]and display the html source in WebBrowser control. That is WebBrowser control is used for only rendering HTML and getting UI events, connection is handled by your program.
And if you find any other way, post it.
|
|
|
|
|
thanks buddy
downloading html & displaying seems to be a messy task as there will be images etc and might be messy
will post if i find anything else
|
|
|
|
|
Hi all,
My application uses QT to render its interface but I recently encountered a big problem: my application loads a modeless dialog from an external mfc dll; because of mfc architecture PreTranslateMessage isn't called for my modeless dialog, so I thought forwarding the modeless dialog's messages would be the only solution, but now my problem rises:
QT don't support PreTranslateMessage.
I really need a great idea to solve this problem. Please help me.
---
|
|
|
|
|
You can emulate if you have access to the message pump. I don't know QT so I'm not sure what the deal is in this respect.
Steve
|
|
|
|
|
hi
i have this function:
Public Function GetFile(Filename As String)<br />
Dim path As String<br />
Dim Fnum As Integer<br />
<br />
'---read file in one pass!<br />
Fnum = FreeFile<br />
Open Filename For Input As #Fnum<br />
GetFile = Input(LOF(Fnum), Fnum)<br />
Close Fnum<br />
<br />
Exit Function<br />
<br />
ErrorHandler:<br />
Err.Description = "GetFile: " & Err.Description & " -> " & File<br />
Err.Raise Err.Number<br />
<br />
<br />
End Function
AND
Private Sub Form_Load()<br />
Dim path As String<br />
<br />
On Error GoTo nofile<br />
<br />
If Command$ Empty Then<br />
Form1.Print<br />
Form1.Print<br />
Form1.Print<br />
Form1.Print<br />
<br />
Form1.Print "Command Line Parameter passed: " + Command$<br />
If Left$(Command$, 1) = Chr$(34) And Right$(Command$, 1) = Chr$(34) Then<br />
path = Mid(Command$, 2, (Len(Command$) - 2))<br />
Else<br />
path = Command$<br />
End If<br />
'MsgBox (path)<br />
Form1.Print "Path of File passed: " + path<br />
Form1.Print<br />
Form1.Print "File contents: " + vbCrLf<br />
<br />
Form1.Print GetFile(path)<br />
<br />
Else<br />
'MsgBox ("No Parameters passed!")<br />
End If<br />
<br />
Exit Sub<br />
nofile:<br />
MsgBox ("ERROR: No valid text file!")<br />
<br />
End Sub
but as u can see..they are written in VB
i need the same thing but in Vc++/MFC
so, is there any equivalent functions for them
if not....could someone pleeease help me with this
reeealy ..any kind of help would be appriciated
thank u in advance
|
|
|
|
|
If you are using MFC, check out the CFile class. If not, use CreateFile() and ReadFile() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi
iam using MFC
i tried the CFile open and read but it didnot work with me
it has something to do with the file
can u please help me out with this
thank u
|
|
|
|