954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Windows Forms - Main Message Loop

Hi,

I recently wrote a program which allows you to load in an MD2 Model and view it in various different forms (wireframe, lighting, textured etc...) This was made as a standard Windows (Win32) Porject and heavily relied on the main message loop to update (Render) the model every frame.

I now want to enhance and re-make this program to make it user friendly. I planned to do this in a form (so I can have various buttons which the user can click on to change the drawtype etc.)

Below is an example of how the main message loop was used in the original program:

MyApp app(hWnd);
app.Init();
// Main message loop:
while (true)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
// test if this is a quit
if (msg.message == WM_QUIT)
break;
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
app.Update();
}
app.Shutdown();


As you can see I have used my "app" methods in and out of this message loop. (Update being the most prominent)

So... finally to my question! I can't seem to find anyway of seeing this main message loop for the form that I want to render my objects in. I know that the Application::Run(gcnew Form1()); method creates the form and a standard message loop but is there anyway I can see this loop code so I can put my lines of code I need here in this new forms application.

Thanks for your time.

mattyw87
Newbie Poster
1 post since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You