Hello, my mfc application is performing a time consuming operation. Before this I want to prompt the user with an approximate estimate of the execution time. For this my idea was to execute some (eg 100) cycles, get the elapsed time and multiply this for the number of total needed executions. In MATLAB (for MATLAB users) it would be a simple tic - toc command. Is there something similar for VC++? Or do you have an idea for another approach? Thanks, Marco.
marcomars
Posts
-
stopwatch, timer.... -
File Dialog Issuethank you !!!!! :rolleyes: you sugestion was wery useful!!! Marco.
-
File Dialog IssueHello, I have a problem in my MFC project with a CFileDialog. I use it to open multiple files, just to get the files' size, and my code is something like this: CString str; POSITION pos; CFileDialog ldFile(TRUE,"avi", NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, "AVI Files (*.avi)|*.avi|All Files (*.*)|*.*||", this); int ret = ldFile.DoModal(); if(ret == IDOK) { pos = ldFile.GetStartPosition(); while(pos) { str = ldFile.GetNextPathName(pos); if (stat(str , &results) == 0) // The size of the file in bytes is in results.st_size files_size[files_count] = results.st_size; files_count++; } } What I observed is that I can open only a limited number of files (the number is smaller when files are larger): if I try anyway to load more files, no file is loaded and the function returns 2 instead of 1 as usual. Can anyone help me solve this issue? Thanks in advance, Marco.
-
ActiveX registrationHello, my MFC dialog based app uses a freeware activex I found on the net. To use it, the relative ocx file must be registered in the system. Is there a way to make the app do itself without the user having to run regsvr32 c:\..... ? I added the lines
STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); ZeroMemory( &pi, sizeof(pi) ); CreateProcess(NULL, // No module name (use command line). "regsvr32 MyOcx.ocx",// Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ); // Pointer to PROCESS_INFORMATION structure.*/
inside InitInstance(). It seems to partially work: with the ocx unregistered, the first time I execute the app it brings out the information message box saying "DllRegisterServer MyOcx..." From now on each time I execute the app first I see the box and finall the app. I'd love to skip the first dummy execution and to close automatically the system info box without having to hit OK. Any suggestion about this? Thanks for the precious help. Marco. -
ActiveX RegistrationHello, my MFC dialog based app uses a freeware activex I found on the net. To use it, the relative ocx file must be registered in the system. Is there a way to make the app do itself without the user having to run regsvr32 c:\..... ? i.e. to register at execution and unregister on close app? Thanks for the precious help. Marco.
-
Email linkHello, I'll try to explain what I'm trying to do: On the about dialog of some programs there is an email address (often underlined and typed in blue) that is not a static text, because if you click on it, a new outlook message -directed to the desired address- is automatically opened. How can this be done? Thankyou in advance, Marco.
-
Set button styleCan you suggest me a way to change dynamically the button style from bitmap to text and viceversa? I tried with
m_BUTT_25.SetButtonStyle(BS_TEXT); m_BUTT_25.RedrawWindow();
andm_BUTT_25.SetButtonStyle(BS_BITMAP); m_BUTT_25.RedrawWindow();
but nothing seems to happen... :( I can instead change the button caption withSetWindowText
: why is this? :confused: Thanks :), Marco. -
Dynamically resize dialogHello :), I have a dialog based application. On a menu command I need to hide sone controls (edit box and buttons) and I can do it (setting as not visible) Now I need to resize the main dialog, since there is an empty area. I tried with this (IDD_TEST_GUI_DIALOG is the ID of the main dialog window): CWnd* pWnd = GetDlgItem(IDD_TEST_GUI_DIALOG); RECT rc; pWnd->GetWindowRect(&rc); rc.right -= 100; ScreenToClient(&rc); pWnd->MoveWindow(&rc); but I get an error. If, instead of IDD_TEST_GUI_DIALOG, I put the ID of any other child element the function works. What did I do wrong? In debugging I find that, after GetDlgItem pWnd is 00000 Thanks in advance :) Marco.
-
Moving dialog windowHello I have a MFC dialog based app. I need the user to move it by dragging in any point. I tried with this code, but didn't work: UINT CMainMenu::OnNcHitTest(CPoint point) { CRect r; GetClientRect(&r); ClientToScreen(&r); if(r.PtInRect(point)) return HTCAPTION ; return CDialog::OnNcHitTest(point); } Any suggestion about? Thanks, Marco. by the way do you know why (only in release configuration) i get an error from the application when executing the line fscanf(fp,"%s",s); when the line in the file is 9 chars or longer ????? :confused: Thanks again :)
-
Select text inside edit box;);););););););););););););););) Thanks a lot !!!!!! Now it WORKS !!!!!! Marco. ;);););););););););););););););)
-
Select text inside edit boxAlready done, but it doesn't work... Any other suggestion? Thanks, Marco.
-
Select text inside edit boxHi, this is my problem. I have an MFC diaog based application with multiple edit boxes. What I need to do is to automatically select all the text inside a box when clicking on it. That's just what happens on Explorer address bar... I've tried writing inside each OnSetfocusEdit function m_edit.SetSel(0,-1); m_edit.SetFocus(); I also tried to write only the line m_edit.SetSel(0,-1); but it didn't work. If I put the same 2 lines in a button click the operation succeeds. Why is this? Can anyone help me? Thank you in advance,:) Marco.