|
You must use of CProgressCtrl::SetStep on the timer when you want to copy files you can get count number of files and set progesss bar to it for example(100 files) and then set timer on the timer you must increase step of progress bar.
|
|
|
|
|
Create a modeless dialog box in your OnInitDialog and show the progress of the copy in that modeless box.
Judy
|
|
|
|
|
You can either utilize JudyL_FL's suggestion, or do the file copying in a separate thread that posts "status messages" back to the main UI thread.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
when I click button A want it to display a dialog;
so I fire this button with click event,
ON_BN_CLICKED(IDC_A, OnClickedA)
void CMainDlg::OnClickedA(void)
{
<BREAK1> COtherDlg dlg(this);
dlg.DoModal();
}
BOOL COtherDlg::OnInitDialog()
{
<BREAK2> CDialog::OnInitDialog();
return TRUE;
}
Above are the important areas of my codes, <BREAK> means I set breakpoint there, But when I press F5 to debug, vs stop at <BREAK1> but don't enter <BREAK2> at all, I am so confused, it is so simple a program, and other button to show dialog works fine.
And when I check the COtherDlg class, enum {IDD = IDD_OTHERDLG}; IDD_OTHERDLG is the same as I set in the dialog editor, I cannot find where it is wrong, is there any aspect I don't think about? DO HELP ME!
|
|
|
|
|
|
Sorry for forgetting to tell you, no compile and run errors.
Just did not work.
|
|
|
|
|
Do you have any specific code on the constructor?
|
|
|
|
|
Did you delete any commented part which was generated by wizard?
if u did so that might be the problem because, VC compiler uses commented
part to goto any specific statement.
|
|
|
|
|
I don't think I delete any coments.
|
|
|
|
|
Try it without passing this pointer.
Replace these two lines with
// COtherDlg dlg(this);
// dlg.DoModal();
this,
COtherDlg dlg;
dlg.DoModal();
OR
COtherDlg* dlg = new COtherDlg ;
dlg ->DoModal();
delete dlg ;
dlg = NULL;
|
|
|
|
|
abhijit bhopale wrote: COtherDlg* dlg = new COtherDlg ;
dlg ->DoModal();
delete dlg ;
dlg = NULL;
In what way is using the heap instead of the stack supposed to address the problem?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for reply
I did not get you, can you explain i brief ?
|
|
|
|
|
Your suggestion to fantasy1215's problem was to use a heap-based variable (i.e., pointer) rather than a stack-based one. Exactly how does that help?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I didn't fully understand your question. What is the problem ? You have a button and when you press it, it should display an other modal dialog box and nothing appears, is that your problem ?
What controls are you using on this dialog ? Any non-registered ActiveX controls maybe ? That could be a possible problem.
|
|
|
|
|
to Cedric Moonen
What you describe is actually the problem I have, and I've found what the problem is.
I have a RichEdit control on my COtherDlg, when I delete delete the RichEdit control, it works fine. While when I add the RichEdit control again, it fails.
But a RichEdit control is not a ActiveX control, right?Help me.
|
|
|
|
|
There is this caution in the documentation of CRichEditCtrl. Have you done what it says?
Caution
If you are using a rich edit control in a dialog box (regardless whether your application is SDI, MDI, or dialog-based), you must call AfxInitRichEdit once before the dialog box is displayed. A typical place to call this function is in your program's InitInstance member function. You do not need to call it for each time you display the dialog box, only the first time. You do not have to call AfxInitRichEdit if you are working with CRichEditView.
Judy
|
|
|
|
|
Your answer works, thx very much.
|
|
|
|
|
Hi all,
I have a MFC application which writes some values to a SQL database. It is done iteratively, may be around 5000 times or more. I used a for loop for it, but when it is write around 1000 lines the MFC application(actually the GUI) going to stuck. I have to stop the application to exit it.
I think my question is clear for you.
What should I do to avoid this. Any sufficient way to do this?
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi..
here i am sending code for that
I had created a table in access
with 3 fields ID1,Nmae,id wher ID is auto number.
Than created DSN name and added a class to application CDB with this new dsn
//CDB m_db;
m_db.Open();
// m_db.MoveLast();
for(int i=1;i<=5000;i++)
{
UpdateData();
CString str;
str.Format("%d",i);
m_db.m_name=str;
m_db.m_id=i;
CString str1;
str1.Format("insert into Table1(name,id) values('%s',%d)",
str,i);
m_db.m_pDatabase->ExecuteSQL(str1);
}
m_db.Close();
}
|
|
|
|
|
Thanks,
I'm not much clever, but how about the use of thread here. I found it from one of the article.
And also I found one mistake I've done. Do the SQL connection create and open on that loop. That mean all the time write values to the database, connection is crated and open it. Obviously it is bad.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi,
I have some application that i wrote -
I using Visual 2005 to compile it.
When i running it on some machine i getting Error message and i need to install Microsoft Visual C++ Redistributable to run it without Error message.
Do i need to change something in my project setting ? Or compile in some other way ?
What to do ?
Thanks.
|
|
|
|
|
Can you more explain about your program?
|
|
|
|
|
Just ordinary C++ project that i wrote - with some simple UI ( MFC ).
I really don't see any special issues in my project so i don't know what to explain.
|
|
|
|
|
Yanshof wrote: Just ordinary C++ project that i wrote - with some simple UI ( MFC ).
I really don't see any special issues in my project so i don't know what to explain.
Actually the VS2005 changed the way executable is created for MFC Application. now they also required Manifest file for running of executable. so you need the VC++ redist to be installed on installed computer. or if could research more you could embed that manifest file in the executable and you could deploy your project on target computer without needing to install the VC++ redist, but still you may require the dot net 2.0 enviornment.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Change your project settings to statically link to the MFC DLL
Judy
|
|
|
|