|
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
|
|
|
|
|
Thank you DavidCrow!
I am using Visual Studio 2003 (Visual Studio.Net). I have checked that in the Build menu of IDE, there is no items called profiler or something similar.
Do you have any reference materials about how to use profiler in Visual Studio 2003?
regards,
George
|
|
|
|
|
George_George wrote: Do you have any reference materials about how to use profiler in Visual Studio 2003?
No, I do not use that version.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I need to change the text in wizard button of PropertySheet following the language of PropertyPage. I've tried to use PSH_USEPAGELANG(set PSH_USEPAGELANG for dwFlags) but it did not work. Could anyone give me a solution?
Thanks a lot.
adfafafa
|
|
|
|
|
If you have a handle to the button, just use SetWindowText() .
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Dear VC-masters;
A simple problem need your help.
a treeview built in a toolbar in mutil-doc project. while right key happen on the tree notes,I want to creat a pop-menu to operate the treeview, such as add note or del note in the tree.
void CMainFrame::OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult)
{
CMenu dMenu;
if(!dMenu.LoadMenu(IDR_TREERKEY))
{
AfxThrowResourceException();
}
CMenu *pPopupMenu = dMenu.GetSubMenu(0);
ASSERT(pPopupMenu != NULL);
CPoint point;
ScreenToClient(&point) ;
pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON,point.x,point.y,AfxGetMainWnd());
}
1>how can I get current mouse position?
2>the add and del note command?
|
|
|
|
|
zeus_master wrote: 1>how can I get current mouse position?
::GetCursorPos(LPPOINT) The cursor position is always specified in screen coordinates so use ScreenToClient to convert to client coordinates.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
zeus_master wrote: 1>how can I get current mouse position?
use GetCurrentMessage() funtion. it will return a structure of MSG. The MSG contains a member that holds the point in which the last message occured.
U can also GetCursorPos() to get mouse the position. But I prefer the first one. Also I think there is no need to call ScreenToClient(&point) .
zeus_master wrote: 2>the add and del note command?
I didn't understand this
nave
|
|
|
|
|
|
suppose u have right clicked the mouse while the mouse is moving fast. By the u call time GetCursorPos() the mouse might have moved to some another location or even over some other window. So showing popup at that point make no sense.
do u agree?
nave
|
|
|
|
|
Naveen R wrote: do u agree?
Yeah I do. I see that with tray applications. Click on the tray icon and move your mouse. The menu comes up where your mouse pointer is.
But since I am lazy :-> I like this. It saves me the time and effort to move down and click on the menu there.;)
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Million thanks!
2> I mean how to add or delete the tree notes?
|
|
|
|
|
so what i understood is, u want to show some popup menu will item Add and Delete.
When u click Delete button u and u want to delete the selected item..
1) call GetSelectedItem( ); -> it will return and handle to the selected item
2) the call the DeleteItem(); with the handle returned by the GetSelectedItem()
now to add a child node under the seleted node
3. Call
InsertItem( LPCTSTR lpszItem, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter );
with hParent as the handle returned by GetSelectedItem();
nave
|
|
|
|
|
I'v tried them, thank you.
but there still a problem while insert Items.
+ROOT1
|
-ROOT2
|_child1
|_child2
|_child3
first, LClick set sel on child1; then move mouse to child2,RClick child2, Pop-menu appears on child2,it is normal/OK.
1>but the focus still at stay at child1, whill click pop-menu add note command , a new child note will be created under child1 ,but not the position RClick occurs and not the position pop-menu on( should be child2).
void CMainFrame::OnInsertItem()
{
// TODO: Add your command handler code here
m_Tree.InsertItem("new node",m_Tree.GetSelectedItem(),TVI_LAST);
m_wndTree.UpdateWindow(); // it seems useless
}
2>and the new child note will be not visible/enable at once, I need LClick the ROOT2 or other notes, the new created note can be visible.
if I insert the items based on ROOT note, it can be refresh and can be seen right away .
void CMainFrame::OnInsertROOTItem()
{
// TODO: Add your command handler code here
m_Tree.InsertItem("New note",TVI_ROOT);
}
-- modified at 3:50 Thursday 15th June, 2006
|
|
|
|