Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC progress bar
void combination::OnButton2()
{
// TODO: Add your control notification handler code here
  m_progress.SetPos(0);
  m_progress.SetRange(0,100);
 
combination a;
a.make_combinations(0);
}
void combination:: make_combinations(int lo_val)
{
  srand(time(0));
  m_progress.StepIt();
ofstream fout("combination.txt",ios::app);
ofstream fout2("time.txt",ios::app);
 
for(int i=0; i<theApp.no_of_process; i++)
{
    //m_progress.OffsetPos(100/4);
    //m_progress.SetStep(200);
    clock_t begin=clock();
    arr[lo_val] = i;
    if(lo_val==(theApp.no_of_tasks)-1)
    {
        for( int j=0; j<theApp.no_of_tasks; j++)
        {
            int number = arr[j];
            fout<<Matrix[j][number];
        }
 
        fout<<endl;
    }
    else
    {
        //Sleep(2);
        make_combinations(lo_val+1);
        clock_t end=clock();
    theApp.combination_time[i][0]=(diffclock(end,begin))/1000;
    fout2<<theApp.combination_time[i][0]<<endl;
    }
 
}
}
 
There is a dialog on mfc with a button behine that button am calling a recursive function. i placed a progress bar on the same dialog that should tell me the progress of recursion. but iam gettin an error on clicking the button. debug assertion failed. your program caused an assertion failure. i dnt know what is wrong with my code. please help!!
 
ISSUE NO 2: Iam making this project on MFC! it includes brute force capability. It also has file handling in it!! am stuck at another point! i have a couple of files with file writing! my project has multiple files .txt format! on the main MFC board i want to add an option for browsing those written files . they should open in the format they are written! any help how it can be done?? just like a browsing menu! help??
Posted 26-Apr-12 9:00am
Edited 26-Apr-12 9:15am
v3
Comments
Albert Holguin at 26-Apr-12 16:16pm
   
Where does the assertion occur? Trace the call stack to see what call in your code (not MFC) is leading to the assertion and see what the assertion is telling you. Need more information to be able to help you.
JackDingler at 26-Apr-12 16:22pm
   
What is the value of 'number'?
 
Is it being initialized?
Haris Riaz at 26-Apr-12 16:55pm
   
@albert: basically this line when added to my code causes this error. "m_progress.StepIt(); " ! without it program does not crash!
Haris Riaz at 26-Apr-12 16:56pm
   
@jack: number is just holding the value of a 2d matrix location element! 2d int type as well as number so i dnt think that is the problem!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 265
2 CPallini 235
3 Sergey Alexandrovich Kryukov 229
4 Maciej Los 190
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 26 Apr 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100