Windows Forms - Main Message Loop

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 1
Reputation: mattyw87 is an unknown quantity at this point 
Solved Threads: 0
mattyw87 mattyw87 is offline Offline
Newbie Poster

Windows Forms - Main Message Loop

 
0
  #1
Dec 28th, 2007
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:

  1. MyApp app(hWnd);
  2. app.Init();
  3. // Main message loop:
  4. while (true)
  5. {
  6. if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
  7. {
  8. // test if this is a quit
  9. if (msg.message == WM_QUIT)
  10. break;
  11. if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  12. {
  13. TranslateMessage(&msg);
  14. DispatchMessage(&msg);
  15. }
  16. }
  17. app.Update();
  18. }
  19. 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.
Last edited by ~s.o.s~; Dec 29th, 2007 at 3:40 am. Reason: Fixed code tags, learn to use them properly.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC