Hello,

Im pretty convinced that I know the cause of my problem but wanted to clarify it with you guys and hope you could offer some advice as to a fix..

Im writing a little RPG based on a version I did console based a while back. Only this time its Windows Based so I could display charater stats, inventory, etc. Ive designed my dialog window and got everything working to display my window and when I click fight it runs through a standard RPG combat loop like "Blah hits you for 5 points of damage etc", these results are outputted into a Multi Line Edit Box which ive made read only.

My Problem is while this loop is going on, and even though the results are still appearing in my outbox box the whole window is frozen, you cannot press any of the other buttons in the window or type anything in another edit field until the combat is finished.

Now ive figured out this is because of my code is laid out like (cut down)

Code:
#include <windows.h>
#include "resource.h"

LRESULT CALLBACK ClientDlgProc(HWND DialogWindow, 
  UINT Message, WPARAM wParam, LPARAM lParam)
{
  switch(Message) {

    case WM_INITDIALOG:
      return FALSE;
    break;

    case WM_COMMAND:
      switch (wParam) {
        case ID_QUIT:
        EndDialog(DialogWindow, FALSE);
        break;

        case ID_COMBAT:
        do {
           combat loop();
        } while someone is still alive;
        break;

        default:
        break;
      }
       return FALSE;
    break;

    default:
       return FALSE;
    break;
  }
}

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE 
hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
  DialogBox((HINSTANCE) hInstance, MAKEINTRESOURCE
    (IDD_DIALOG), NULL, (DLGPROC) ClientDlgProc);
  return 0;
}
So while this loop is going on other messages are just getting queued up until it breaks out of the loop. (as once the combat is finished all the messages ive been sending like "window movement", "minimise", etc all come through at once)

So my question is pretty much is there anyway I can get around this by perhaps sending my loop into the background so I can still get the windows messages or I am experiencing this problem because im doing everything in a Dialog Box? Is it because ive not setup the callback correctly and so therefore queuing up the messages instead ?

If anyone could point out where im going wrong or what I need to read about to get around this id appreciate it.

Im using Visual C++ 6.0, Non-MFC, and using C.
Thank You

Mr Pickle.