Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Simple progress bar example
Simple progress bar example [message #49657] Thu, 22 March 2018 13:32
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi there,
I have a function that executes a process (an external program that works in background, so the user is not aware about what is happening). This process can take sometime to elaborate data, so I would like to add a progress for the user to know that the process is still running. I do not need to show the real progress, just showing the running bar. I would like also the ability for the user to interrupt the process in case it takes too much time (may happen that the external program has problems...). If possible, I would prefer to avoid multithreading. So far, I did this:

void Capture::Process()
{
	p("Processing data..."); //Progress p; is a global variable for the class
	p.Create();
	p.Canceled();
	DoProcess();
	p.Close();
	
}

void Capture::DoProcess()
{
	std::ofstream lockfile (imgjlock); //Create a lockfile, when the external program is done it deletes the lockfile
	lockfile.close();
		ShellExecute(NULL, NULL, batfile, NULL, NULL, SW_HIDE);
		while(true)
		{
			p.Step();
			if(!FileExists(imgjlock)) {
				p.Close();
	
		//Here some code to show the results
			
				break;
			}
		}
	} else {
		remove(imgjlock);
	}
}


...but it does not work.

It would be very useful if someone could point me to some example.
Regards,
gio
 
Read Message
Previous Topic: Taking a picture with a microscope
Next Topic: linking has failed
Goto Forum:
  


Current Time: Thu Mar 28 12:15:33 CET 2024

Total time taken to generate the page: 0.01049 seconds