Sign in to follow this  

Main loop in Winforms applications?

This topic is 4243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to call an update function on one of my objects repeatedly. How can I do this in a winforms application? VC++ 2005 Express created the following main function for me:
int main(array<System::String ^> ^args)
{
	// Enabling Windows XP visual effects before any controls are created
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 

	System::Windows::Forms::ApplicationContext ac;
	ac.MainForm = gcnew Form1();
	
	// Create the main window and run it
	Application::Run(%ac);
	return 0;
}
Basically, I want to get inside of whatever function Application::Run is calling so that I can do my own thing in between message polls. Thanks for any help~ Riley

Share this post


Link to post
Share on other sites
I just got around the problem with what feels like a hack: I added a timer control to fire every 100 ms that will call my update function. I don't need many updates, but if I did, this solution would not suffice.

I'd still like to know how to get into that main loop... there must be a way!

Share this post


Link to post
Share on other sites

This topic is 4243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this