Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:10:05+00:00 2026-05-31T06:10:05+00:00

In an OpenGL win32 program developed in Visual Studio C++ 2010, the debug version

  • 0

In an OpenGL win32 program developed in Visual Studio C++ 2010, the debug version works correctly no matter what, the release version works only if I insert a MessageBox() diagnostic message within a certain range of my code. Of course this is a problem because now I cannot debug my release version using MessageBox() which is what I usually do. Moreover, if I put the MessageBox() in another part of code (inside the offending Display loop), instead of making the program work correctly it will make the cursor spaz into hourglass/non-hourglass and it will not display a MessageBox(), almost as if the MessageBox() code is being called every display frame but is not doing anything right.

Insight as to what might be causing the bug, if MessageBox() fixes it magically in some places.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:10:07+00:00Added an answer on May 31, 2026 at 6:10 am

    MessageBox() has a windows message pump cycle built into it to service window messages.

    Somewhere in your application at a very low level within your design, you need a windows message loop to service messages for the window hosting your openGL content. This should run from within the thread that created the window. The ill effects you are seeing in other places could easily be caused by contention side-effects when MessageBox() is invoked from a different thread.

    Here is an intro to the operation of window messages at MSDN.

    Using Messages and Message Queues @ MSDN

    Very simply put (via a code sample from wikipedia), you need a standing loop akin to the following:

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
        MSG msg;
        while(GetMessage(&msg, NULL, 0, 0) > 0)
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        return msg.wParam;
    }
    

    Depending on how you have handled updating the window, if you are using paint messages (WM_PAINT), you need to ensure these are dispatched as quickly as possible, or you may need to suppress them entirely if you are drawing direct to the the device DC. I’m mentioning this because you may find additional bugs once a message loop is properly setup.

    WM_PAINT message @ MSDN

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Visual Studio Express 2010 to write an openGL program, so
I'm creating a kinect project in Visual Studio 2008 using OpenNi, NITE and OpenGL.
I have created a sample c++ project under Visual Studio 2010 with following files.
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
In my simple OpenGL program I get the following error about exit redefinition: 1>c:\program
I'm making a Win32 application with OpenGL in the main window (not using GLUT).
While resizing win32 window, with OpenGL context, it just shows black on the newly
I'm trying to port a program/game that was developed in linux/g++ so that it
I'm trying to write an OpenGL program to manipulate the camera. However the code
I know how to open a window with openGL (using Win32 or other toolkits).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.