|
Isnt there some other function more precise than this one?
regards
hint_54
|
|
|
|
|
Not when what you are wanting to measure happens in just a few ms. You can increase the number of times the loop executes (e.g., 250,000) to verify that it is being timed.
To get a little more granularity, you can use the multimedia timers.
Also check out QueryPerformanceCounter() and its API.
Because Windows is not a RTOS, you'll do no better than about 10ms for a Windows NT-based machine.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
hint_54 wrote: I get an output of: "IT TOOL: 0". Know why!?
If you are building it in Release mode, I bet the compiler simply optimized away your loop.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
No. _Debug.
regards
hint_54
|
|
|
|
|
Use the QueryPerformanceCounter API's - look it up on MSDN/Google, and you'll should see tons of examples of how it's used. That's alot more accurate (I think) than GetTickCount().
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Hello hint_54
When I would like to know how much time it takes to execute a particulary piece of code and this piece of code is very short I read the CPU time stamp twice. (Assuming that you are running a pentium class processor) The CPU time stamp is a 64 bits counter that runs on the same frequency as your CPU does. So with this you ll be able to measure very short times very accurate.
Oke this function is written in asm for the Borland compiler.
//---------------------------------------------------------------------------
//Read CPU time stamp
//---------------------------------------------------------------------------
__int64 CWaveIn::CPUTimeStamp(void)
{
asm
{
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
cpuid
rdtsc
}
}
//---------------------------------------------------------------------------
The instruction rdtsc reads the CPU time stamp and returns its value in register eax and edx. So you could do the folowing
ULONGLONG qwStartTime;
ULONGLONG qwStopTime;
qwStartTime=CPUTimeStamp();
//Place code here...
qwStopTime=CPUTimeStamp();
//Time?
qwStopTime-qwStartTime;
Succes
|
|
|
|
|
hmmmm... I like that. Thanks
hint_54
|
|
|
|
|
Hi all, i want to lock a region of a file over the 32bits limit 2GB. With _locking i can't, because it only supports 32bits filesize. Does anyone know how to lock a file in a position greater than 4gb?
Thanks.
|
|
|
|
|
Hello,
Is your file already open? If not, you can open the file with a exclusive lock for the entire file using OF_SHARE_DENY_NONE . See the <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/openfile.asp" rel="nofollow">OpenFile</a>[<a target=_blank title='New Window' rel='nofollow' href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/openfile.asp">^</a>] API.
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
In Win32; LockFile()
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi,
Am new to VC++, and am developing a simple software with a dll, and an .exe accessing the functions of this dll.
Am statically loading the DLL into my application,and the log shows the library being loaded successfully. However when I try to execute(debug) the application(.exe), it crashes out by flashing a Developer Studio error message saying: "Could not execute:Path not found(win32 error 3)".
Any advice would be of great help!
Regards,
Adnan
|
|
|
|
|
Spykraft wrote: and an .exe accessing the functions of this dll.
What exactly your DLL do?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
HI,FRIENDS.
I M WORKING ON AN MDI APPLICATION IN WHICH A TOOLBAR HAVING COMBOBOX ON THE SELECTION OF THE ITEM OF COMBOBOX I WANT TO UPDATE DATA OF THE CHILDVIEW .
I TRIED TO CREATE THE OBJECT OF CHILDFRAME INTO CHILDDOC AND IN VIEW GETDOCUMENT FUNCTION CALLED BUT ITS GIVING ASSERTION ERROR.
I TRIED TO MAKE FIEND FUNCTION INTO CHILDFRANE IT DOESNT WORK.
I TRIED TO USE GETDLGITEMID ITS GIVING ASSERTION ERROR .
HELP ME
sourabh jain
patni computers system
|
|
|
|
|
sourabh272318 wrote: ...ON THE SELECTION OF THE ITEM OF COMBOBOX I WANT TO UPDATE DATA OF THE CHILDVIEW .
If I am reading you correctly, you should actually be updating the data in the document, and then let it notify the views that something has changed.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
sourabh272318 wrote: I TRIED TO MAKE FIEND FUNCTION INTO CHILDFRANE IT DOESNT WORK.
so, now the c++ standard defines evil functions ? :->
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Yes you access it using the "satan" keyword as opposed to "friend".
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
sourabh272318 wrote: I TRIED TO MAKE FIEND FUNCTION INTO CHILDFRANE IT DOESNT WORK
How about making Message Handdler in your View class and posting message to it when ever something changed
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi
sourabh jain
patni computers system
|
|
|
|
|
Use GetParentFrame() .
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hi,
I'm using VS .NET 2003 and CR 8.5 ...
My project type is MFC Dialog-based program and i should display a ADO Recordset query result in viewer activex ...
It's what i've done:
1- I made the Report with Crystal Report 8.5 and with connecting to .mdb database via OLEDB connection ... (it's ok)
2- Then i insert the Viewer Control in my project and also made the ado recordset object with a simple query like this: "select * from some_table where code=1"
3- i wrote below code:
m_RptApp.CreateInstance( "CrystalRuntime.Application" );<br />
m_RptReportInfo = m_RptApp->OpenReport( _bstr_t(_T("rpt\\CompanyInfo_FA.rpt")) );<br />
Line1: m_RptReportInfo->Database->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) );<br />
m_ReportViewer.put_ReportSource( m_RptReportInfo );<br />
m_ReportViewer.ViewReport();
I tried this code for Line1 too:
m_RptReportInfo->Database->Tables->GetItem( 1 )->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) );
The Problem:
the problem is the program shows ALL records ... and NOT the filtered recs !!
1- Can u tell me what's wrong with my code ?!
2- ( ADO Question ):
say i have two _RecordsetPtr objects ..
for example: _Rec1, _Rec2 ..
_Recs1 fills by some records (by Open() mehod)
Is there anyway to copy some records from _Rec1 to _Rec2 ?!
for example i want to copy Record (pos) number 3, 10, 16 to _Rec2
( sorry for my english .. )
Regards,
Hadi
|
|
|
|
|
YEP !!!
SOLVED !
|
|
|
|
|
I have a dialog box with id IDD_AGREE_FRAME_ABSTRACTION . This class's all cotrols are populated from the view class using one LoadDetails() function which is implemented inside the dialog class. I have added an edit box to this dialog. But when ever i am creating any variable of type:
1. CString and attaching it to the editbox through class wizard/manually. It's giving me a message "An unsupported operation was attempted". When i click that msg box the application is getting crashed.
2. CEdit then i am getting the message and the application is crashing.
When i am debugging the application the message box is coming in the DoDataExchange i for that particular entry for that editbox control.
I deleted the entry in the DoDataExchange for the control and just tried to set a its text by using GetDldItem(IDC_EDIT_BLDG_AGE)->SetWindowText("biswa") but again the application is crashing.
For all the cases when its crashing it's giving the error as "Unhandled exception in the app.exe(MFC42D.DLL):0x0000005: Access Violation."
I am really surprised why this is happening for this dialog where as for other dialog there is no problem when i do the same. Also when i am removing the the DDX_Text entry for the control causing the problem the whole application is running fine.
Please help me on this. This is really important for me. If you need any more information then just tell me i can give you the detail history for this.
|
|
|
|
|
|
When the dialog is created in the view class it calls the DoDataExchange function and when it excutes the line
DDX_Text(pDX,IDC_EDIT_BUILDING_AGE,m_BuildingAge) it crashes and when i remove the entry it works fine. Also as i said when directly try to access by it using GetDlgItem then also it crashes.
One more thing i want to say this class was not visible when opened the class wizard. So i deleted the .clw file and agained opened it. That class was then visible but when i selected that i got parsing error for one of entries of DoDataExchange function that is DDX_Dollar(.....). That is why i added entry for this control manually.
|
|
|
|
|
just try the follow this may be reason....
in resourse.h
IDC_EDIT_BUILDING_AGE is defined right. it has some value say 1234
check there should not any other defined with the same value 1234.
just check it. as a one of the reasons.
Regards
Anil
|
|
|
|