# Main loop in Winforms applications?

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

## 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 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!