示例#1
0
文件: Main.cpp 项目: m1h4/Xetrix
INT WINAPI WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpCmdLine*/,INT /*nCmdShow*/)
{
	SetUnhandledExceptionFilter(Debug::DumpException);

	srand(GetTickCount());

	InitCommonControls();

	if(!InitializeWindow(800,600))
		return 0;

	MSG	msg = {0};

	while(msg.message != WM_QUIT)
	{
		if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		
		if(!Update())
			PostQuitMessage(0);
		else if(!Draw())
			PostQuitMessage(0);
		else if(!SwapBuffers(mainDC))
			TRACE(TEXT("Failed to swap buffers.\n"));
	}

	KillGame();
	KillTimer();
	KillWindow();

	return msg.wParam;
}
示例#2
0
static void
Key(unsigned char key, int x, int y)
{
   struct window *w = CurrentWindow();
   (void) x;
   (void) y;

   switch (key) {
   case 'd':
      w->showBuffer = GL_DEPTH;
      glutPostRedisplay();
      break;
   case 's':
      w->showBuffer = GL_STENCIL;
      glutPostRedisplay();
      break;
   case 'a':
      w->showBuffer = GL_ALPHA;
      glutPostRedisplay();
      break;
   case 'c':
      w->showBuffer = GL_NONE;
      glutPostRedisplay();
      break;
   case 'f':
      if (w->drawBuffer == GL_FRONT)
         w->drawBuffer = GL_BACK;
      else
         w->drawBuffer = GL_FRONT;
      glutPostRedisplay();
      break;
   case '0':
      w->drawBuffer = GL_NONE;
      glutPostRedisplay();
      break;
   case ' ':
      w->anim = !w->anim;
      w->t0 = -1;
      UpdateIdleFunc();
      glutPostRedisplay();
      break;
   case 'n':
      CreateWindow();
      UpdateIdleFunc();
      break;
   case 'k':
      KillWindow(w);
      if (FirstWindow == NULL)
         exit(0);
      break;
   case 27:
      KillAllWindows();
      exit(0);
      break;
   default:
      ;
   }
}
示例#3
0
void CInviteChatDlg::OnCancel() 
{
	if(Handle&&pMessenger->ConnectEnable())
	{
		pSession->CancelOperation(Handle);
	}
	else
		KillWindow();
}
示例#4
0
void CAddUserRequest::OnCancel() 
{
	if(Handle&&pMessenger->ConnectEnable())
	{
		pSession->CancelOperation(Handle);
	}
	else
		KillWindow();
}
示例#5
0
GameSystem::~GameSystem(void) {
    if (graphics) {
        delete graphics;
        graphics = NULL;
    }

    if (input) {
        delete input;
        input = NULL;
    }

    KillWindow();
}
示例#6
0
Win32Dialog::~Win32Dialog()
{
	if( m_hWnd )
		KillWindow( );

	if(m_appName)
	{
		free(m_appName);
		m_appName=NULL;
	}

	m_ModalHold = false;
}
示例#7
0
CBiotopDisplayGL::~CBiotopDisplayGL()
{
  for (int i=m_tAnimatedSprite.GetSize()-1; i>=0; i--) 
  {
    if (m_tAnimatedSprite.GetAt(i) != NULL)
    {  
      delete (m_tAnimatedSprite.GetAt(i)); 
    }

    m_tAnimatedSprite.RemoveAt(i);
  }

	KillWindow();	// Shutdown
}
示例#8
0
///////////////////////////////////////////////////////////////////////////////
// Main program function, called on startup
// First setup the window and OGL state, then enter rendering loop
int main(int argc, char* argv[])
{
    if(SetupWindow(800, 600))
    {
        SetupRC();
        ChangeSize(800, 600);
        while (g_ContinueRendering)
        {   
            mainLoop();
            Sleep(0);
        }
    }
    KillWindow();
	return 0;
}
示例#9
0
dlgWndPinpadInfo::~dlgWndPinpadInfo()
{
	KillWindow( );

	if(m_szHeader)
	{
		free(m_szHeader);
		m_szHeader=NULL;
	}
	if(m_szMessage)
	{
		free(m_szMessage);
		m_szMessage=NULL;
	}
}
示例#10
0
/*************************************************************************
 WinMain()

 Windows entry point
*************************************************************************/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
  SetupWindow();

  MSG msg;
  int exitCode;
  CTimer timer;

  timer.Init();

  while (true)
  {
    if(PeekMessage(&msg, g_hwnd, NULL, NULL, PM_REMOVE))
    {
      if (msg.message == WM_QUIT)   // do we receive a WM_QUIT message?
      {
        exitCode = msg.wParam;
        break;              // if so, time to quit the application
      }
      else
      {
        TranslateMessage(&msg);     // translate and dispatch to event queue
        DispatchMessage(&msg);
      }
    }


    // don't update the scene if the app is minimized
    if (g_isActive)
    {
      // update the scene every time through the loop
      GameMain(timer.GetElapsedSeconds());

      DisplayFPS(&timer);

      // switch the front and back buffers to display the updated scene
      SwapBuffers(g_hdc);
    }
    else
    {
      timer.GetElapsedSeconds();
    }
  }

  KillWindow();

  return exitCode;
}
示例#11
0
void CInviteChatDlg::OnAuthorizationRequest() 
{
	DHTMLE_ADDCONTACT_Container *pData = new DHTMLE_ADDCONTACT_Container;
	
	pData->email        = m_User.m_strEMail;
	pData->first_name   = m_User.m_strFirstName;
	pData->last_name    = m_User.m_strLastName;
	pData->nick_name    = m_User.m_strLogin;
	pData->role_id      = m_User.m_RoleID;
	pData->role_name    = m_User.m_strType;
	pData->user_id      = m_User.GlobalID;
	
	pMessenger->SendMessage(WM_DHTML_EVENT,(WPARAM)DHTMLE_ADDCONTACT,(LPARAM)pData);

	KillWindow();
}
示例#12
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
				   LPSTR lpCmdLine, int nShowCmd)
{
	MSG msg;							// message
	bool done;							// flag for when app is done

	// create our window and set up OpenGL
  SetupWindow("CS447-Textures", 800, 600, 32, FALSE);

	done = false;                    // init for loop

	// main message loop.     note to use PeekMessage not GetMessage
	while (!done)
	{
		// use Peek because GetMessage halts app
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))	    // check for a message
    {
		  if (msg.message == WM_QUIT)
		  {
			  done = true;             // if receive quit then quit
		  }
		  else
		  {
		    TranslateMessage(&msg);				// translate to event queue
		    DispatchMessage(&msg);				// dispatch to event queue
      }
		}
    else
    {
      DisplayScene();                       // render current scene
      SwapBuffers(g_HDC);					// bring back buffer to front
    }
	}
	KillWindow();                               // cleanup

	return msg.wParam;

} 
示例#13
0
void set_mode(int mode) {
    if (mode == current_graphics_mode) {
        // Bring graphics window to front whenever user presses "Show graphics"
        if (mode == MODE_WINDOW) {
#ifdef __APPLE__
            BringAppToFront();
#else
            if (glut_is_freeglut && FREEGLUT_IS_INITIALIZED && (GLUT_HAVE_WINDOW > 0)) {
//              glutPopWindow();
       	        glutShowWindow();
            }
#endif 
       }
        return;
    }

    if (debug) fprintf(stderr, "set_mode(%d): current_mode = %d.\n", mode, current_graphics_mode);
    if (glut_is_initialized) {
        if (debug) fprintf(stderr, "Calling KillWindow(): win = %d\n", win);
        KillWindow();
        if (debug) fprintf(stderr, "KillWindow() survived.\n");
    }
    
    if (mode != MODE_HIDE_GRAPHICS) {
        if (debug) fprintf(stderr, "set_mode(): Calling make_new_window(%d)\n", mode); 
        make_new_window(mode);
        if (debug) fprintf(stderr, "make_new_window() survived.\n");
    }
#ifdef __APPLE__
    else
        HideThisApp();
#endif

    current_graphics_mode = mode;

    return;
}
示例#14
0
glWindow::~glWindow () {
    Hide ();

    // Destroy window contexts, handles e.t.c
    KillWindow ();
/*    if (m_HGLRC)
	{
		wglMakeCurrent(NULL,NULL);
		wglDeleteContext(m_HGLRC);
	}

	if (m_HDC)
        ReleaseDC(m_HWnd,m_HDC);

	if (m_HWnd)
        DestroyWindow(m_HWnd);*/

	UnregisterClass("gbOpenGL",m_HInstance);

	//added to Destruct the Joystick
//#ifndef _NO_SDL
//	Free_Joystick();
//#endif
}
示例#15
0
void glWindow::RecreateWindow (
    bool fullScreen,
    bool border,
    int width,
    int height,
    int bpp,
    bool stencil,
    std::string title,
    bool allowResizing,
    bool fitToWorkArea) {

    // Save window settings
    m_fullScreen    = fullScreen;
    m_border        = border;
    m_width         = width;
    m_height        = height;
    m_bpp           = bpp;
    m_title         = title;
    m_allowResizing = allowResizing;
    m_fitToWorkArea = fitToWorkArea;
    m_stencil       = stencil;

    // Delete existing window
    KillWindow ();

    // Create new one
	GLuint		PixelFormat;			// Holds The Results After Searching For A Match
	DWORD		dwExStyle;				// Window Extended Style
	DWORD		dwStyle;				// Window Style
	RECT		WindowRect;				// Grabs Rectangle Upper Left / Lower Right Values
	WindowRect.left     =(long)0;			// Set Left Value To 0
	WindowRect.right    =(long)m_width;		// Set Right Value To Requested Width
	WindowRect.top      =(long)0;			// Set Top Value To 0
	WindowRect.bottom   =(long)m_height;	// Set Bottom Value To Requested Height

	if (m_fullScreen)												// Attempt Fullscreen Mode?
	{
		memset(&m_screenSettings,0,sizeof(m_screenSettings));	// Makes Sure Memory's Cleared
		m_screenSettings.dmSize=sizeof(m_screenSettings);		// Size Of The Devmode Structure
		m_screenSettings.dmPelsWidth	= m_width;				// Selected Screen Width
		m_screenSettings.dmPelsHeight	= m_height;				// Selected Screen Height
		m_screenSettings.dmBitsPerPel	= m_bpp;				// Selected Bits Per Pixel
  		m_screenSettings.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT;
        if (m_bpp)
            m_screenSettings.dmFields |= DM_BITSPERPEL;
	}

	if (m_fullScreen || !m_border)									// Are We Still In Fullscreen Mode?
	{
        // Borderless window
		dwExStyle=WS_EX_APPWINDOW;
		dwStyle=WS_POPUP;
	}
	else {
        // Standard window
        dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;			        // Window Extended Style
        if (allowResizing)
            dwStyle = WS_OVERLAPPEDWINDOW;
        else
            dwStyle = WS_OVERLAPPEDWINDOW & ~(WS_SIZEBOX | WS_MAXIMIZEBOX);	    // Windows Style
        if (m_fitToWorkArea)
            dwStyle |= WS_MAXIMIZE;
	}

    if (!m_fullScreen && !m_fitToWorkArea) {

        // Get the screen resolution
        HWND desktop = GetDesktopWindow ();
        RECT desktopRect;
        GetWindowRect (desktop, &desktopRect);
        int xoffs, yoffs;
        if (WindowRect.right > desktopRect.right)
            xoffs = -WindowRect.left;
        else
            xoffs = (desktopRect.right  - WindowRect.right)  / 2;
        if (WindowRect.bottom > desktopRect.bottom)
            yoffs = -WindowRect.top;
        else
            yoffs = (desktopRect.bottom - WindowRect.bottom) / 2;
        WindowRect.left     += xoffs;
        WindowRect.right    += xoffs;
        WindowRect.top      += yoffs;
        WindowRect.bottom   += yoffs;

        // Adjust window size to allow for border
        if (m_border)
            AdjustWindowRectEx(&WindowRect, dwStyle, false, dwExStyle);
    }

    // Fitting to work area?
    if (m_fitToWorkArea) {
        SystemParametersInfo(SPI_GETWORKAREA, 0, &WindowRect, 0);    // Gets the desktop work area
        m_width = WindowRect.right - WindowRect.left;
        m_height = WindowRect.bottom - WindowRect.top;
    }

	// Create The Window
	if (!(m_HWnd=CreateWindowEx(	dwExStyle,				    		// Extended Style For The Window
								    "gbOpenGL",			    			// Class Name
    								m_title.c_str (),   				// Window Title
	    							dwStyle |							// Defined Window Style
		    						WS_CLIPSIBLINGS |					// Required Window Style
			    					WS_CLIPCHILDREN,					// Required Window Style
				    				WindowRect.left, WindowRect.top,	// Window Position
					    			WindowRect.right-WindowRect.left,	// Calculate Window Width
						    		WindowRect.bottom-WindowRect.top,	// Calculate Window Height
							    	NULL,								// No Parent Window
								    NULL,								// No Menu
								    m_HInstance,						// Instance
								    NULL)))								// Dont Pass Anything To WM_CREATE
	{
        SetError ("Window creation error");
        return;
	}

    // Register window (for window procedure)
    glWindows [m_HWnd] = this;

    // Stencil buffer depth
    GLint stencilBits = m_stencil ? 8 : 0;

	static	PIXELFORMATDESCRIPTOR pfd=				// pfd Tells Windows How We Want Things To Be
	{
		sizeof(PIXELFORMATDESCRIPTOR),				// Size Of This Pixel Format Descriptor
		1,											// Version Number
		PFD_DRAW_TO_WINDOW |						// Format Must Support Window
		PFD_SUPPORT_OPENGL |						// Format Must Support OpenGL
		PFD_DOUBLEBUFFER,
		PFD_TYPE_RGBA,								// Request An RGBA Format
		m_bpp,										// Select Our Color Depth
		0, 0, 0, 0, 0, 0,							// Color Bits Ignored
		0,											// No Alpha Buffer
		0,											// Shift Bit Ignored
		0,											// No Accumulation Buffer
		0, 0, 0, 0,									// Accumulation Bits Ignored
		16,											// 16Bit Z-Buffer (Depth Buffer)
		stencilBits, 								// No Stencil Buffer
		0,											// No Auxiliary Buffer
		PFD_MAIN_PLANE,								// Main Drawing Layer
		0,											// Reserved
		0, 0, 0										// Layer Masks Ignored
	};

	if (!(m_HDC=GetDC(m_HWnd)))					 	// Did We Get A Device Context?
	{
        SetError ("Failed to get window device context");
        return;
	}

	if (!(PixelFormat=ChoosePixelFormat(m_HDC,&pfd)))	// Did Windows Find A Matching Pixel Format?
	{
        SetError ("Could not find a suitable pixel format");
        return;
	}

	// Determine whether pixel format will be hardware accellerated.

	PIXELFORMATDESCRIPTOR pfd_new;
    DescribePixelFormat (m_HDC, PixelFormat, sizeof (PIXELFORMATDESCRIPTOR), &pfd_new);

	if ((pfd_new.dwFlags & PFD_GENERIC_FORMAT) != 0					// Generic
	&&  (pfd_new.dwFlags & PFD_GENERIC_ACCELERATED) == 0) {			// Non accellerated

		// Warn user that OpenGL will proceed in software mode!
		if (MessageBox(NULL, "Hardware 3D acceleration is not available for this display mode.\nProceed in software mode?","Warning",MB_YESNO|MB_ICONEXCLAMATION)==IDNO) {
			SetError ("Aborted");
            return;
		}
	}

	if(!SetPixelFormat(m_HDC,PixelFormat,&pfd))		// Are We Able To Set The Pixel Format?
	{
        SetError ("Set pixel format failed");
        return;
	}

    // Setup OpenGL
    RecreateGLContext ();
}
示例#16
0
文件: resize.c 项目: skoneka/screen
int
ChangeWindowSize(struct win *p, int wi, int he, int hi)
{
  struct mline *mlf = 0, *mlt = 0, *ml, *nmlines, *nhlines;
  int fy, ty, l, lx, lf, lt, yy, oty, addone;
  int ncx, ncy, naka, t;
  int y, shift;

  if (wi <= 0 || he <= 0)
    wi = he = hi = 0;

  if (p->w_type == W_TYPE_GROUP)
    return 0;

  if (wi > 1000)
    {
      Msg(0, "Window width too large. Truncated to 1000.");
      wi = 1000;
    }

  if (he > 1000)
    {
      Msg(0, "Window height too large. Truncated to 1000.");
      he = 1000;
    }

  if (p->w_width == wi && p->w_height == he && p->w_histheight == hi)
    {
      debug("ChangeWindowSize: No change.\n");
      return 0;
    }

  CheckMaxSize(wi);

  debug("ChangeWindowSize");
  debug3(" from (%d,%d)+%d", p->w_width, p->w_height, p->w_histheight);
  debug3(" to(%d,%d)+%d\n", wi, he, hi);

  fy = p->w_histheight + p->w_height - 1;
  ty = hi + he - 1;

  nmlines = nhlines = 0;
  ncx = 0;
  ncy = 0;
  naka = 0;

  if (wi)
    {
      if (wi != p->w_width || he != p->w_height)
	{
	  if ((nmlines = (struct mline *)calloc(he, sizeof(struct mline))) == 0)
	    {
	      KillWindow(p);
	      Msg(0, "%s", strnomem);
	      return -1;
	    }
	}
      else
	{
	  debug1("image stays the same: %d lines\n", he);
	  nmlines = p->w_mlines;
	  fy -= he;
	  ty -= he;
	  ncx = p->w_x;
	  ncy = p->w_y;
	  naka = p->w_autoaka;
	}
    }
  if (hi)
    {
      if ((nhlines = (struct mline *)calloc(hi, sizeof(struct mline))) == 0)
	{
	  Msg(0, "No memory for history buffer - turned off");
	  hi = 0;
	  ty = he - 1;
	}
    }

  /* special case: cursor is at magic margin position */
  addone = 0;
  if (p->w_width && p->w_x == p->w_width)
    {
      debug2("Special addone case: %d %d\n", p->w_x, p->w_y);
      addone = 1;
      p->w_x--;
    }

  /* handle the cursor and autoaka lines now if the widths are equal */
  if (p->w_width == wi)
    {
      ncx = p->w_x + addone;
      ncy = p->w_y + he - p->w_height;
      /* never lose sight of the line with the cursor on it */
      shift = -ncy;
      for (yy = p->w_y + p->w_histheight - 1; yy >= 0 && ncy + shift < he; yy--)
	{
	  ml = OLDWIN(yy);
	  if (ml->image[p->w_width] == ' ')
	    break;
	  shift++;
	}
      if (shift < 0)
	shift = 0;
      else
	debug1("resize: cursor out of bounds, shifting %d\n", shift);
      ncy += shift;
      if (p->w_autoaka > 0)
	{
	  naka = p->w_autoaka + he - p->w_height + shift;
	  if (naka < 1 || naka > he)
	    naka = 0;
	}
      while (shift-- > 0)
	{
	  ml = OLDWIN(fy);
	  FreeMline(ml);
	  fy--;
	}
    }
  debug2("fy %d ty %d\n", fy, ty);
  if (fy >= 0)
    mlf = OLDWIN(fy);
  if (ty >= 0)
    mlt = NEWWIN(ty);

  while (fy >= 0 && ty >= 0)
    {
      if (p->w_width == wi)
	{
	  /* here is a simple shortcut: just copy over */
	  *mlt = *mlf;
          *mlf = mline_zero;
	  if (--fy >= 0)
	    mlf = OLDWIN(fy);
	  if (--ty >= 0)
	    mlt = NEWWIN(ty);
	  continue;
	}

      /* calculate lenght */
      for (l = p->w_width - 1; l > 0; l--)
	if (mlf->image[l] != ' ' || mlf->attr[l])
	  break;
      if (fy == p->w_y + p->w_histheight && l < p->w_x)
	l = p->w_x;	/* cursor is non blank */
      l++;
      lf = l;

      /* add wrapped lines to length */
      for (yy = fy - 1; yy >= 0; yy--)
	{
	  ml = OLDWIN(yy);
	  if (ml->image[p->w_width] == ' ')
	    break;
	  l += p->w_width;
	}

      /* rewrap lines */
      lt = (l - 1) % wi + 1;	/* lf is set above */
      oty = ty;
      while (l > 0 && fy >= 0 && ty >= 0)
	{
	  lx = lt > lf ? lf : lt;
	  if (mlt->image == 0)
	    {
	      if (AllocMline(mlt, wi + 1))
		goto nomem;
    	      MakeBlankLine(mlt->image + lt, wi - lt);
	      mlt->image[wi] = ((oty == ty) ? ' ' : 0);
	    }
	  if (BcopyMline(mlf, lf - lx, mlt, lt - lx, lx, wi + 1))
	    goto nomem;

	  /* did we copy the cursor ? */
	  if (fy == p->w_y + p->w_histheight && lf - lx <= p->w_x && lf > p->w_x)
	    {
	      ncx = p->w_x + lt - lf + addone;
	      ncy = ty - hi;
	      shift = wi ? -ncy + (l - lx) / wi : 0;
	      if (ty + shift > hi + he - 1)
		shift = hi + he - 1 - ty;
	      if (shift > 0)
		{
	          debug3("resize: cursor out of bounds, shifting %d [%d/%d]\n", shift, lt - lx, wi);
		  for (y = hi + he - 1; y >= ty; y--)
		    {
		      mlt = NEWWIN(y);
		      FreeMline(mlt);
		      if (y - shift < ty)
			continue;
		      ml  = NEWWIN(y - shift);
		      *mlt = *ml;
		      *ml = mline_zero;
		    }
		  ncy += shift;
		  ty += shift;
		  mlt = NEWWIN(ty);
		  if (naka > 0)
		    naka = naka + shift > he ? 0 : naka + shift;
		}
	      ASSERT(ncy >= 0);
	    }
	  /* did we copy autoaka line ? */
	  if (p->w_autoaka > 0 && fy == p->w_autoaka - 1 + p->w_histheight && lf - lx <= 0)
	    naka = ty - hi >= 0 ? 1 + ty - hi : 0;

	  lf -= lx;
	  lt -= lx;
	  l  -= lx;
	  if (lf == 0)
	    {
	      FreeMline(mlf);
	      lf = p->w_width;
	      if (--fy >= 0)
	        mlf = OLDWIN(fy);
	    }
	  if (lt == 0)
	    {
	      lt = wi;
	      if (--ty >= 0)
	        mlt = NEWWIN(ty);
	    }
	}
      ASSERT(l != 0 || fy == yy);
    }
  while (fy >= 0)
    {
      FreeMline(mlf);
      if (--fy >= 0)
	mlf = OLDWIN(fy);
    }
  while (ty >= 0)
    {
      if (AllocMline(mlt, wi + 1))
	goto nomem;
      MakeBlankLine(mlt->image, wi + 1);
      if (--ty >= 0)
	mlt = NEWWIN(ty);
    }

#ifdef DEBUG
  if (nmlines != p->w_mlines)
    for (fy = 0; fy < p->w_height + p->w_histheight; fy++)
      {
	ml = OLDWIN(fy);
	ASSERT(ml->image == 0);
      }
#endif

  if (p->w_mlines && p->w_mlines != nmlines)
    free((char *)p->w_mlines);
  p->w_mlines = nmlines;
  if (p->w_hlines && p->w_hlines != nhlines)
    free((char *)p->w_hlines);
  p->w_hlines = nhlines;
  nmlines = nhlines = 0;

  /* change tabs */
  if (p->w_width != wi)
    {
      if (wi)
	{
	  t = p->w_tabs ? p->w_width : 0;
	  p->w_tabs = xrealloc(p->w_tabs, wi + 1);
	  if (p->w_tabs == 0)
	    {
	    nomem:
	      if (nmlines)
		{
		  for (ty = he + hi - 1; ty >= 0; ty--)
		    {
		      mlt = NEWWIN(ty);
		      FreeMline(mlt);
		    }
		  if (nmlines && p->w_mlines != nmlines)
		    free((char *)nmlines);
		  if (nhlines && p->w_hlines != nhlines)
		    free((char *)nhlines);
		}
	      KillWindow(p);
	      Msg(0, "%s", strnomem);
	      return -1;
	    }
	  for (; t < wi; t++)
	    p->w_tabs[t] = t && !(t & 7) ? 1 : 0; 
	  p->w_tabs[wi] = 0; 
	}
      else
	{
	  if (p->w_tabs)
	    free(p->w_tabs);
	  p->w_tabs = 0;
	}
    }

  /* Change w_saved.y - this is only an estimate... */
  p->w_saved.y += ncy - p->w_y;

  p->w_x = ncx;
  p->w_y = ncy;
  if (p->w_autoaka > 0)
    p->w_autoaka = naka;

  /* do sanity checks */
  if (p->w_x > wi)
    p->w_x = wi;
  if (p->w_y >= he)
    p->w_y = he - 1;
  if (p->w_saved.x > wi)
    p->w_saved.x = wi;
  if (p->w_saved.y < 0)
    p->w_saved.y = 0;
  if (p->w_saved.y >= he)
    p->w_saved.y = he - 1;
  if (p->w_alt.cursor.x > wi)
    p->w_alt.cursor.x = wi;
  if (p->w_alt.cursor.y >= he)
    p->w_alt.cursor.y = he - 1;

  /* reset scrolling region */
  p->w_top = 0;
  p->w_bot = he - 1;

  /* signal new size to window */
#ifdef TIOCSWINSZ
  if (wi && (p->w_width != wi || p->w_height != he)
      && p->w_width != 0 && p->w_height != 0 && p->w_ptyfd >= 0 && p->w_pid)
    {
      glwz.ws_col = wi;
      glwz.ws_row = he;
      debug("Setting pty winsize.\n");
      if (ioctl(p->w_ptyfd, TIOCSWINSZ, (char *)&glwz))
	debug2("SetPtySize: errno %d (fd:%d)\n", errno, p->w_ptyfd);
    }
#endif /* TIOCSWINSZ */

  /* store new size */
  p->w_width = wi;
  p->w_height = he;
  p->w_histidx = 0;
  p->w_histheight = hi;

#ifdef DEBUG
  /* Test if everything was ok */
  for (fy = 0; fy < p->w_height + p->w_histheight; fy++)
    {
      ml = OLDWIN(fy);
      ASSERT(ml->image);
      if (p->w_encoding == UTF8)
	{
	  for (l = 0; l < p->w_width; l++)
	    ASSERT(ml->image[l] >= ' ' || ml->font[l]);
	}
      else
        for (l = 0; l < p->w_width; l++)
          ASSERT(ml->image[l] >= ' ');
    }
#endif
  return 0;
}
示例#17
0
static void
KillAllWindows(void)
{
   while (FirstWindow)
      KillWindow(FirstWindow);
}
示例#18
0
文件: resize.c 项目: amade/screen
int ChangeWindowSize(Window *p, int wi, int he, int hi)
{
    struct mline *mlf = 0, *mlt = 0, *ml, *nmlines, *nhlines;
    int fy, ty, l, lx, lf, lt, yy, oty, addone;
    int ncx, ncy, naka, t;
    int y, shift;

    if (wi <= 0 || he <= 0)
        wi = he = hi = 0;

    if (p->w_type == W_TYPE_GROUP)
        return 0;

    if (wi > MAXWIDTH) {
        Msg(0, "Window width too large. Truncated to %d.", MAXWIDTH);
        wi = MAXWIDTH;
    }

    if (he > MAXWIDTH) {
        Msg(0, "Window height too large. Truncated to %d.", MAXWIDTH);
        he = MAXWIDTH;
    }

    if (p->w_width == wi && p->w_height == he && p->w_histheight == hi) {
        return 0;
    }

    CheckMaxSize(wi);

    fy = p->w_histheight + p->w_height - 1;
    ty = hi + he - 1;

    nmlines = nhlines = 0;
    ncx = 0;
    ncy = 0;
    naka = 0;

    if (wi) {
        if (wi != p->w_width || he != p->w_height) {
            if ((nmlines = calloc(he, sizeof(struct mline))) == 0) {
                KillWindow(p);
                Msg(0, "%s", strnomem);
                return -1;
            }
        } else {
            nmlines = p->w_mlines;
            fy -= he;
            ty -= he;
            ncx = p->w_x;
            ncy = p->w_y;
            naka = p->w_autoaka;
        }
    }
    if (hi) {
        if ((nhlines = calloc(hi, sizeof(struct mline))) == 0) {
            Msg(0, "No memory for history buffer - turned off");
            hi = 0;
            ty = he - 1;
        }
    }

    /* special case: cursor is at magic margin position */
    addone = 0;
    if (p->w_width && p->w_x == p->w_width) {
        addone = 1;
        p->w_x--;
    }

    /* handle the cursor and autoaka lines now if the widths are equal */
    if (p->w_width == wi) {
        ncx = p->w_x + addone;
        ncy = p->w_y + he - p->w_height;
        /* never lose sight of the line with the cursor on it */
        shift = -ncy;
        for (yy = p->w_y + p->w_histheight - 1; yy >= 0 && ncy + shift < he; yy--) {
            ml = OLDWIN(yy);
            if (!ml->image)
                break;
            if (ml->image[p->w_width] == ' ')
                break;
            shift++;
        }
        if (shift < 0)
            shift = 0;
        ncy += shift;
        if (p->w_autoaka > 0) {
            naka = p->w_autoaka + he - p->w_height + shift;
            if (naka < 1 || naka > he)
                naka = 0;
        }
        while (shift-- > 0) {
            ml = OLDWIN(fy);
            FreeMline(ml);
            fy--;
        }
    }
    if (fy >= 0)
        mlf = OLDWIN(fy);
    if (ty >= 0)
        mlt = NEWWIN(ty);

    while (fy >= 0 && ty >= 0) {
        if (p->w_width == wi) {
            /* here is a simple shortcut: just copy over */
            *mlt = *mlf;
            *mlf = mline_zero;
            if (--fy >= 0)
                mlf = OLDWIN(fy);
            if (--ty >= 0)
                mlt = NEWWIN(ty);
            continue;
        }

        /* calculate lenght */
        for (l = p->w_width - 1; l > 0; l--)
            if (mlf->image[l] != ' ' || mlf->attr[l])
                break;
        if (fy == p->w_y + p->w_histheight && l < p->w_x)
            l = p->w_x;	/* cursor is non blank */
        l++;
        lf = l;

        /* add wrapped lines to length */
        for (yy = fy - 1; yy >= 0; yy--) {
            ml = OLDWIN(yy);
            if (ml->image[p->w_width] == ' ')
                break;
            l += p->w_width;
        }

        /* rewrap lines */
        lt = (l - 1) % wi + 1;	/* lf is set above */
        oty = ty;
        while (l > 0 && fy >= 0 && ty >= 0) {
            lx = lt > lf ? lf : lt;
            if (mlt->image == 0) {
                if (AllocMline(mlt, wi + 1))
                    goto nomem;
                MakeBlankLine(mlt->image + lt, wi - lt);
                mlt->image[wi] = ((oty == ty) ? ' ' : 0);
            }
            if (BcopyMline(mlf, lf - lx, mlt, lt - lx, lx, wi + 1))
                goto nomem;

            /* did we copy the cursor ? */
            if (fy == p->w_y + p->w_histheight && lf - lx <= p->w_x && lf > p->w_x) {
                ncx = p->w_x + lt - lf + addone;
                ncy = ty - hi;
                shift = wi ? -ncy + (l - lx) / wi : 0;
                if (ty + shift > hi + he - 1)
                    shift = hi + he - 1 - ty;
                if (shift > 0) {
                    for (y = hi + he - 1; y >= ty; y--) {
                        mlt = NEWWIN(y);
                        FreeMline(mlt);
                        if (y - shift < ty)
                            continue;
                        ml = NEWWIN(y - shift);
                        *mlt = *ml;
                        *ml = mline_zero;
                    }
                    ncy += shift;
                    ty += shift;
                    mlt = NEWWIN(ty);
                    if (naka > 0)
                        naka = naka + shift > he ? 0 : naka + shift;
                }
            }
            /* did we copy autoaka line ? */
            if (p->w_autoaka > 0 && fy == p->w_autoaka - 1 + p->w_histheight && lf - lx <= 0)
                naka = ty - hi >= 0 ? 1 + ty - hi : 0;

            lf -= lx;
            lt -= lx;
            l -= lx;
            if (lf == 0) {
                FreeMline(mlf);
                lf = p->w_width;
                if (--fy >= 0)
                    mlf = OLDWIN(fy);
            }
            if (lt == 0) {
                lt = wi;
                if (--ty >= 0)
                    mlt = NEWWIN(ty);
            }
        }
    }
    while (fy >= 0) {
        FreeMline(mlf);
        if (--fy >= 0)
            mlf = OLDWIN(fy);
    }
    while (ty >= 0) {
        if (AllocMline(mlt, wi + 1))
            goto nomem;
        MakeBlankLine(mlt->image, wi + 1);
        if (--ty >= 0)
            mlt = NEWWIN(ty);
    }

    if (p->w_mlines && p->w_mlines != nmlines)
        free((char *)p->w_mlines);
    p->w_mlines = nmlines;
    if (p->w_hlines && p->w_hlines != nhlines)
        free((char *)p->w_hlines);
    p->w_hlines = nhlines;

    /* change tabs */
    if (p->w_width != wi) {
        if (wi) {
            t = p->w_tabs ? p->w_width : 0;
            p->w_tabs = xrealloc(p->w_tabs, (wi + 1) * 4);
            if (p->w_tabs == 0) {
nomem:
                if (nmlines) {
                    for (ty = he + hi - 1; ty >= 0; ty--) {
                        mlt = NEWWIN(ty);
                        FreeMline(mlt);
                    }
                    if (nmlines && p->w_mlines != nmlines)
                        free((char *)nmlines);
                    if (nhlines && p->w_hlines != nhlines)
                        free((char *)nhlines);
                }
                KillWindow(p);
                Msg(0, "%s", strnomem);
                if (nmlines)
                    free(nmlines);
                if (nhlines)
                    free(nhlines);
                return -1;
            }
            for (; t < wi; t++)
                p->w_tabs[t] = t && !(t & 7) ? 1 : 0;
            p->w_tabs[wi] = 0;
        } else {
            if (p->w_tabs)
                free(p->w_tabs);
            p->w_tabs = 0;
        }
    }

    /* Change w_saved.y - this is only an estimate... */
    p->w_saved.y += ncy - p->w_y;

    p->w_x = ncx;
    p->w_y = ncy;
    if (p->w_autoaka > 0)
        p->w_autoaka = naka;

    /* do sanity checks */
    if (p->w_x > wi)
        p->w_x = wi;
    if (p->w_y >= he)
        p->w_y = he - 1;
    if (p->w_saved.x > wi)
        p->w_saved.x = wi;
    if (p->w_saved.y >= he)
        p->w_saved.y = he - 1;
    if (p->w_saved.y < 0)
        p->w_saved.y = 0;
    if (p->w_alt.cursor.x > wi)
        p->w_alt.cursor.x = wi;
    if (p->w_alt.cursor.y >= he)
        p->w_alt.cursor.y = he - 1;
    if (p->w_alt.cursor.y < 0)
        p->w_alt.cursor.y = 0;

    /* reset scrolling region */
    p->w_top = 0;
    p->w_bot = he - 1;

    /* signal new size to window */
    if (wi && (p->w_width != wi || p->w_height != he)
            && p->w_width != 0 && p->w_height != 0 && p->w_ptyfd >= 0 && p->w_pid) {
        glwz.ws_col = wi;
        glwz.ws_row = he;
        ioctl(p->w_ptyfd, TIOCSWINSZ, (char *)&glwz);
    }

    /* store new size */
    p->w_width = wi;
    p->w_height = he;
    p->w_histidx = 0;
    p->w_histheight = hi;

#ifdef ENABLE_TELNET
    if (p->w_type == W_TYPE_TELNET)
        TelWindowSize(p);
#endif

    return 0;
}
示例#19
0
dlgWndBadPIN::~dlgWndBadPIN()
{
	KillWindow( );
}
示例#20
0
bool CBiotopDisplayGL::Initialize(CScrollView* pView) 
{
	if (true)
	{
    m_pView = pView;
    m_tAnimatedSprite.SetSize(0);
    m_hDC  = GetDC ( pView->m_hWnd );

		GLuint	PixelFormat;												// Holds The Results After Searching For A Match
		static	PIXELFORMATDESCRIPTOR pfd=									// pfd Tells Windows How We Want Things To Be
		{																		
			sizeof(PIXELFORMATDESCRIPTOR),									// Size Of This Pixel Format Descriptor
			1,																// Version Number
			PFD_DRAW_TO_WINDOW |											// Format Must Support Window
			PFD_SUPPORT_OPENGL |											// Format Must Support OpenGL
			PFD_DOUBLEBUFFER,												// Must Support Double Buffering
			PFD_TYPE_RGBA,													// Request An RGBA Format
			16,														// Select Our Color Depth
			0, 0, 0, 0, 0, 0,												// Color Bits Ignored
			0,																// No Alpha Buffer
			0,																// Shift Bit Ignored
			0,																// No Accumulation Buffer
			0, 0, 0, 0,														// Accumulation Bits Ignored
			16,																// 16Bit Z-Buffer (Depth Buffer)  
			0,																// No Stencil Buffer
			0,																// No Auxiliary Buffer
			PFD_MAIN_PLANE,													// Main Drawing Layer
			0,																// Reserved
			0, 0, 0															// Layer Masks Ignored
		};																		
	
		if ( m_hDC == NULL )	{							// Did We Get A Device Context?																	
			KillWindow ();													// Reset The Display
			AfxMessageBox ( "Can't Create A GL Device Context.", MB_OK | MB_ICONEXCLAMATION );
			return FALSE;												
		}
																			
		if ( !( PixelFormat = ChoosePixelFormat ( m_hDC, &pfd ) ) )	{		// Did Windows Find A Matching Pixel Format?																		
			KillWindow ();												// Reset The Display
			AfxMessageBox ( "Can't Find A Suitable PixelFormat.", MB_OK | MB_ICONEXCLAMATION );
			return FALSE;												
		}
																			
		if ( !SetPixelFormat ( m_hDC, PixelFormat, &pfd ) ){				// Are We Able To Set The Pixel Format?																		
			KillWindow ();												// Reset The Display
			AfxMessageBox ( "Can't Set The PixelFormat.", MB_OK | MB_ICONEXCLAMATION );
			return FALSE;												
		}
																			
		if ( !( m_hRC = wglCreateContext ( m_hDC ) ) ) {					// Are We Able To Get A Rendering Context?																	
			KillWindow ();												// Reset The Display
			AfxMessageBox( " Can't Create A GL Rendering Context.", MB_OK | MB_ICONEXCLAMATION );
			return FALSE;													
		}
																			
		if ( !wglMakeCurrent ( m_hDC, m_hRC ) )	{							// Try To Activate The Rendering Context																		
			KillWindow ();												// Reset The Display
			AfxMessageBox ( "Can't Activate The GL Rendering Context.", MB_OK | MB_ICONEXCLAMATION );
			return FALSE;													
		}

		if ( !LoadData () ) {													// Initialize Our Newly Created GL Window																		
			KillWindow ();												// Reset The Display
			AfxMessageBox ( "Initialization Failed.", MB_OK | MB_ICONEXCLAMATION );
			return FALSE;													
		}

		m_bAppIsActive = TRUE;
	}

	return true;
}
示例#21
0
BOOL CreateGLWindow(LPCTSTR title, int width, int height,
					  int bits, BOOL fullscreenflag)
{
	GLuint  PixelFormat;
	DWORD   dwExStyle;
	DWORD   dwStyle;
    RECT    wndRect;
	WNDCLASSEX   wndclassex = {0};

	g_hInst = GetModuleHandle(NULL);
	wndclassex.cbSize        = sizeof(WNDCLASSEX);
	wndclassex.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wndclassex.lpfnWndProc   = WndProc;
	wndclassex.cbClsExtra    = 0;
	wndclassex.cbWndExtra    = 0;
	wndclassex.hInstance     = g_hInst;
	wndclassex.hIcon         = LoadIcon (NULL, IDI_APPLICATION);
	wndclassex.hCursor       = LoadCursor (NULL, IDC_ARROW);
	wndclassex.hbrBackground = NULL;
	wndclassex.lpszMenuName  = NULL;
	wndclassex.lpszClassName = g_strClassName;
	wndclassex.hIconSm       = wndclassex.hIcon;

	wndRect.left = 0;
	wndRect.top = 0;
	wndRect.right = width;
	wndRect.bottom = height;

	g_bFullscreen = fullscreenflag;


	if (!RegisterClassEx (&wndclassex))
	{
		MessageBox (NULL, TEXT ("RegisterClassEx failed!"), title, MB_ICONERROR);
		return FALSE;
	}
	if (g_bFullscreen)
	{
		DEVMODE  dv;
		ZeroMemory(&dv,sizeof(dv));
		dv.dmSize = sizeof(DEVMODE);
		dv.dmPelsWidth = width;
		dv.dmPelsHeight = height;
		dv.dmBitsPerPel = bits;
		dv.dmDisplayFrequency = 60;
		dv.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT|DM_DISPLAYFREQUENCY;
		if (ChangeDisplaySettings(&dv,CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
		{
			if (::MessageBox(NULL,TEXT("È«ÆÁÉèÖÃʧ°Ü,ÊÇ·ñʹÓô°¿Úģʽ"),
				TEXT("OpenGL"),MB_YESNO | MB_ICONEXCLAMATION)==IDYES)
			{
				g_bFullscreen = FALSE;
			}
			else
			{
				::MessageBox(NULL,TEXT("³ÌÐò¹Ø±Õ"),TEXT("Error"),MB_OK);
				return FALSE;
			}
		}
	}

	if (g_bFullscreen)
	{
		dwExStyle = WS_EX_APPWINDOW;
        dwStyle   = WS_POPUP;
		ShowCursor(FALSE);
	}
	else
	{
		dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
		dwStyle   = WS_OVERLAPPEDWINDOW; 
	}

	AdjustWindowRectEx(&wndRect,dwStyle,FALSE,dwExStyle);

	g_hMainWnd = CreateWindowEx (dwExStyle, 
		g_strClassName, 
		title,
		WS_CLIPCHILDREN|
		WS_CLIPSIBLINGS|
		dwStyle,
		0, 0, 
		wndRect.right - wndRect.left, 
		wndRect.bottom- wndRect.top, 
		NULL, 
		NULL, 
		g_hInst,
		NULL); 
	if (!g_hMainWnd)
	{
		MessageBox(NULL,TEXT("´´½¨´°¿Úʧ°Ü"),TEXT("Error"),MB_OK | MB_ICONERROR);
		KillWindow();
		return FALSE;
	}

	static PIXELFORMATDESCRIPTOR pfd =
	{
		sizeof(PIXELFORMATDESCRIPTOR),					// ÉÏÊö¸ñʽÃèÊö·ûµÄ´óС
		1,								                // °æ±¾ºÅ
		PFD_DRAW_TO_WINDOW |				     		// ¸ñʽ֧³Ö´°¿Ú
		PFD_SUPPORT_OPENGL |			     			// ¸ñʽ±ØÐëÖ§³ÖOpenGL
		PFD_DOUBLEBUFFER,				        		// ±ØÐëÖ§³ÖË«»º³å
		PFD_TYPE_RGBA,						        	// ÉêÇë RGBA ¸ñʽ
		bits,						            		// Ñ¡¶¨É«²ÊÉî¶È
		0, 0, 0, 0, 0, 0,						        // ºöÂÔµÄÉ«²Êλ
		0,							                 	// ÎÞAlpha»º´æ
		0,							                	// ºöÂÔShift Bit
		0,							                	// ÎÞÀÛ¼Ó»º´æ
		0, 0, 0, 0,					             		// ºöÂÔ¾Û¼¯Î»
		16,							                 	// 16λ Z-»º´æ (Éî¶È»º´æ)
		0,						                		// ÎÞÃɰ建´æ
		0,						                		// ÎÞ¸¨Öú»º´æ
		PFD_MAIN_PLANE,			          				// Ö÷»æͼ²ã
		0,							                	// Reserved
		0, 0, 0					             			// ºöÂÔ²ãÕÚÕÖ

	};

	if ((g_hdc = GetDC(g_hMainWnd)) == NULL)
	{
		MessageBox(NULL,TEXT("GetDC ´íÎó"),TEXT("Error"),MB_OK | MB_ICONERROR);
		KillWindow();
		return FALSE;
	}
	if (!(PixelFormat =ChoosePixelFormat(g_hdc,&pfd)))
	{
		MessageBox(NULL,TEXT("ChoosePixelFormat ´íÎó"),TEXT("Error"),MB_OK | MB_ICONERROR	);
		KillWindow();
		return FALSE;
	}
	if (! SetPixelFormat(g_hdc,PixelFormat,&pfd))
	{
		MessageBox(NULL,TEXT("SetPixelFormat ´íÎó"),TEXT("Error"),MB_OK | MB_ICONERROR	);
		KillWindow();
		return FALSE;
	}
	if (!(g_hGlrc = wglCreateContext(g_hdc)))
	{
		MessageBox(NULL,TEXT("´´½¨OpenGLÉÏÏÂÎÄ´íÎó"),TEXT("Error"),MB_OK | MB_ICONERROR	);
		KillWindow();
		return FALSE;
	}
	if(! wglMakeCurrent(g_hdc,g_hGlrc))
	{
		MessageBox(NULL,TEXT("wglMakeCurrent´íÎó"),TEXT("Error"),MB_OK | MB_ICONERROR	);
		KillWindow();
		return FALSE;
	}

	SetForegroundWindow(g_hMainWnd);
	SetFocus(g_hMainWnd);
	ShowWindow (g_hMainWnd, SW_SHOW);
	ResizeFunc(width,height);

	return InitOpenGL();
	//UpdateWindow (g_hMainWnd);
}
示例#22
0
// switch to the given graphics mode.  This is called:
// - on initialization
// - when get mode change msg (via shared mem)
// - when in SS mode and get user input
//
static void set_mode(int mode) {
    int new_mode = mode;
    GRAPHICS_MSG current_desktop;

    if (mode == current_graphics_mode) return;
    if (current_graphics_mode != MODE_FULLSCREEN) {
        if (IsIconic(hWnd) || IsZoomed(hWnd)){
            // If graphics window is minimized or maximized
            // then set default values of window size
            rect.left = 50;
            rect.top = 50;
            rect.right = 50+640;
            rect.bottom = 50+480;
        }
        else GetWindowRect(hWnd, &rect); // else get current values
    }

    KillWindow();

    // Detect our current desktop and window station.
    memset(current_desktop.window_station, 0, sizeof(current_desktop.window_station)/sizeof(char));
    memset(current_desktop.desktop, 0, sizeof(current_desktop.desktop)/sizeof(char));

    if (!is_windows_9x) {
        GetUserObjectInformation(
            GetProcessWindowStation(), 
            UOI_NAME, 
            current_desktop.window_station,
            (sizeof(current_desktop.window_station) / sizeof(char)),
            NULL
        );
        GetUserObjectInformation(
            GetThreadDesktop(GetCurrentThreadId()), 
            UOI_NAME, 
            current_desktop.desktop,
            (sizeof(current_desktop.desktop) / sizeof(char)),
            NULL
        );
    }

    if (!is_windows_9x &&
        !boinc_is_standalone() && 
        strlen(graphics_msg.window_station) > 0 &&
        strlen(graphics_msg.desktop) > 0 &&
        (strcmp(current_desktop.window_station, graphics_msg.window_station) ||
        strcmp(current_desktop.desktop, graphics_msg.desktop))) {

        BOINCINFO("Checking Desktop and Window Station Parameters\n");
        GetDesktopWindow();

        if (NULL == hOriginalWindowStation) {
            hOriginalWindowStation = GetProcessWindowStation();
            if (NULL == hOriginalWindowStation) {
                BOINCINFO("Failed to retrieve the orginal window station\n");
            }
        }

        if (NULL == hOriginalDesktop) {
            hOriginalDesktop = GetThreadDesktop(GetCurrentThreadId());
            if (NULL == hOriginalDesktop) {
                BOINCINFO("Failed to retrieve the orginal desktop\n");
            }
        }

        hInteractiveWindowStation = OpenWindowStation( graphics_msg.window_station, FALSE, GENERIC_READ );
        if (NULL == hInteractiveWindowStation) {
            BOINCINFO("Failed to retrieve the required window station\n");
            new_mode = MODE_UNSUPPORTED;
        } else {
            BOINCINFO("Retrieved the required window station\n");
            if (!SetProcessWindowStation(hInteractiveWindowStation)) {
                BOINCINFO("Failed to SetProcessWindowStation (GLE: '%d')\n", GetLastError());
            }
            hInteractiveDesktop = OpenDesktop(
                graphics_msg.desktop, (DWORD)NULL, FALSE,
                GENERIC_READ | DESKTOP_CREATEWINDOW | DESKTOP_CREATEMENU
            );
            if (NULL == hInteractiveDesktop) {
                BOINCINFO("Failed to retrieve the required desktop\n");
                new_mode = MODE_UNSUPPORTED;
            } else {
                BOINCINFO("Retrieved the required desktop\n");
                if (!SetThreadDesktop(hInteractiveDesktop)) {
                    BOINCINFO("Failed to SetThreadDesktop (GLE: '%d')\n", GetLastError());
                }
            }
        }
    }
   
    current_graphics_mode = new_mode;
    if (new_mode != MODE_HIDE_GRAPHICS && new_mode != MODE_UNSUPPORTED) {
        make_new_window();
    }

}
示例#23
0
LRESULT CAddUserRequest::OnNetEvent(WPARAM w,LPARAM l)
{
	NLT_Container *pItem = (NLT_Container *)w;
	ASSERT(pItem!=NULL);
	
	
	UnBlock();
	switch(pItem->EventType)
	{
	case NLT_EDetails:
		{
			IUser    *pUser    = NULL;
			HRESULT hr = AutoUnMarchaling(pItem,(LPUNKNOWN*)&pUser);
			
			if(SUCCEEDED(hr))
			{
				theNet2.LockTranslator();
				theNet2.RemoveFromTranslator(Handle);
				try
				{
					CUser InfoUser(pUser);
					m_User = InfoUser;
					m_Nick.SetText(m_User.GetShowName());

					UpdateData(FALSE);
				}
				catch(...)
				{
					ASSERT(FALSE);
				}
				theNet2.UnlockTranslator();
				pUser->Release();
			}
		}
		break;
	case NLT_ECommandOK:
		theNet2.LockTranslator();
		theNet2.RemoveFromTranslator(Handle);
		theNet2.UnlockTranslator();
		if(m_bAddUserCommand&&!pMessenger->CheckUserInContactList(m_User))
		{
			//GetDlgItem(IDOK)->ShowWindow(SW_HIDE);
			//GetDlgItem(ID_DANY)->ShowWindow(SW_HIDE);
			m_Accept.ShowWindow(SW_HIDE);
			m_Deny.ShowWindow(SW_HIDE);
			m_AddToContact.ShowWindow(SW_SHOWNORMAL);
			//GetDlgItem(ID_AUTHORIZATION_REQUEST)->ShowWindow(SW_SHOWNORMAL);
		}
		else
			KillWindow();
		break;
	case NLT_ECommandError:
		theNet2.LockTranslator();
		theNet2.RemoveFromTranslator(Handle);
		theNet2.UnlockTranslator();
		if(pItem->Long1==etSERVER)
		{
			switch(pItem->Long2)
			{
			case ERR_UNABLE_CREATE_CONN:
				_SHOW_IBN_ERROR_DLG_OK(IDS_SERVICENOTAVAILABLE);
				break;
			}
		}
		MessageBox(GetString(IDS_ADD_USER_ERROR),GetString(IDS_ERROR_TITLE),MB_OK|MB_ICONSTOP);
		break;
	}
	
	delete pItem;
    return 0;
}
示例#24
0
文件: Main.cpp 项目: m1h4/Xetrix
bool InitializeWindow(ULONG width,ULONG height)
{
	PIXELFORMATDESCRIPTOR pfd =
	{
		sizeof(PIXELFORMATDESCRIPTOR),
		1,
		PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER,
		PFD_TYPE_RGBA,
		32,	// Color Buffer Size
		0,0,0,0,0,0,
		0,
		0,
		0,
		0,0,0,0,
		24,	// Depth Buffer Size
		0,
		0,
		PFD_MAIN_PLANE,
		0,
		0,0,0
	};

	UINT		pixelFormat;
	WNDCLASS	wc = {0};
	DWORD		dwExStyle = 0;
	DWORD		dwStyle = WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_SIZEBOX|WS_MAXIMIZEBOX;
	RECT		windowRect = {0,0,width,height};

	wc.style			= CS_CLASSDC;
	wc.lpfnWndProc		= WinProcedure;
	wc.hInstance		= GetModuleHandle(NULL);
	wc.hIcon			= LoadIcon(NULL,IDI_WINLOGO);
	wc.hCursor			= LoadCursor(NULL,IDC_ARROW);
	wc.lpszClassName	= mainClassName;

	if(!RegisterClass(&wc))
	{
		MessageBox(NULL,TEXT("Could not register the window class."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);

		return false;
	}

	AdjustWindowRectEx(&windowRect,dwStyle,FALSE,dwExStyle);

	mainWnd = CreateWindowEx(dwExStyle,
								mainClassName,
								mainWindowName,
								dwStyle,
								CW_USEDEFAULT,CW_USEDEFAULT,
								windowRect.right-windowRect.left,
								windowRect.bottom-windowRect.top,
								NULL,
								NULL,
								GetModuleHandle(NULL),
								NULL);
	if(!mainWnd)
	{
		KillWindow();
		MessageBox(NULL,TEXT("Window creation error."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}
	
	mainDC = GetDC(mainWnd);
	if(!mainDC)
	{
		KillWindow();
		MessageBox(NULL,TEXT("Could not create a device context."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	pixelFormat = ChoosePixelFormat(mainDC,&pfd);
	if(!pixelFormat)
	{
		KillWindow();
		MessageBox(NULL,TEXT("Could not find a suitable pixel format."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	if(!SetPixelFormat(mainDC,pixelFormat,&pfd))
	{
		KillWindow();
		MessageBox(NULL,TEXT("Could not set the pixel format."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	mainRC = wglCreateContext(mainDC);
	if(!mainRC)
	{
		KillWindow();
		MessageBox(NULL,TEXT("Could not create a rendering context."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	if(!wglMakeCurrent(mainDC,mainRC))
	{
		KillWindow();
		MessageBox(NULL,TEXT("Could not activate the rendering context."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	ShowWindow(mainWnd,SW_SHOW);
	SetForegroundWindow(mainWnd);
	SetFocus(mainWnd);
	ReSizeScene(width,height);

	if(!InitializeGraphics())
	{
		KillWindow();
		MessageBox(NULL,TEXT("Graphics initialization failed."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	if(!InitializeGame())
	{
		KillWindow();
		MessageBox(NULL,TEXT("Game initialization failed."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	if(!InitializeTimer())
	{
		KillWindow();
		MessageBox(NULL,TEXT("Timer initialization failed."),TEXT("Error"),MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	TRACE(TEXT("OpenGL %S\n"), glGetString(GL_VERSION));

	return true;
}
示例#25
0
LRESULT CInviteChatDlg::OnNetEvent(WPARAM w,LPARAM l)
{
	NLT_Container *pItem = (NLT_Container *)w;
	ASSERT(pItem!=NULL);
	
	UnBlock();
	switch(pItem->EventType)
	{
	case NLT_EDetails:
		{
			IUser    *pUser    = NULL;
			HRESULT hr = AutoUnMarchaling(pItem,(LPUNKNOWN*)&pUser);
			
			if(SUCCEEDED(hr))
			{
				theNet2.LockTranslator();
				theNet2.RemoveFromTranslator(Handle);
				try
				{
					CUser InfoUser(pUser);
					m_User = InfoUser;

					CString strNickText;
					strNickText.Format(GetString(IDS_INVITE_CHAT_NICK_NAME),m_User.GetShowName());
					m_Nick.SetWindowText(strNickText);
					
					UpdateData(FALSE);
				}
				catch(...)
				{
					ASSERT(FALSE);
				}
				theNet2.UnlockTranslator();
				pUser->Release();
			}
		}
		break;
	case NLT_EChatCreate:
		{
			IChat *pChat	=	NULL;
			HRESULT hr = AutoUnMarchaling(pItem,(LPUNKNOWN*)&pChat);
			if(hr==S_OK)
			{
				// Step 1. Add new Chat to ChatsCollections [8/9/2002]
				pMessenger->AddNewChat(pChat,SC_INACTIVE);
				// Step 2. Connect to Chat [9/7/2002]
				CChat Chat(pChat);
				pMessenger->SetChatStatus(Chat.GetId(),SC_ACTIVE,CMainDlg::HCI_OPEN_CHAT_WINDOW);
				// Step 2. Free Interface [8/9/2002]
				pChat->Release();
			}
			// Step 3. Close the Window
			KillWindow();
		}
		break;
	case NLT_ECommandOK:
		theNet2.LockTranslator();
		theNet2.RemoveFromTranslator(Handle);
		theNet2.UnlockTranslator();
		KillWindow();
		break;
	case NLT_ECommandError:
		theNet2.LockTranslator();
		theNet2.RemoveFromTranslator(Handle);
		theNet2.UnlockTranslator();
		if(pItem->Long1==etSERVER)
		{
			switch(pItem->Long2)
			{
			case ERR_UNABLE_CREATE_CONN:
				_SHOW_IBN_ERROR_DLG_OK(IDS_SERVICENOTAVAILABLE);
				break;
			}
		}
		MessageBox(GetString(IDS_INVITECHAT_ERROR),GetString(IDS_ERROR_TITLE),MB_OK|MB_ICONSTOP);
		break;
	}
	
	delete pItem;
    return 0;
}
示例#26
0
dlgWndAskPIN::~dlgWndAskPIN()
{
	KillWindow( );
}
示例#27
0
/****************************************************************************
 SetupWindow()

 Creates a window and the device and rendering contexts for it.
*****************************************************************************/
BOOL SetupWindow(char *title, int width, int height, int bits, bool isFullscreen)
{
  // set the global flag
  g_isFullScreen = isFullscreen;

  // get our instance handle
  g_hInstance	= GetModuleHandle(NULL);

  WNDCLASSEX  wc;    // window class

  // fill out the window class structure
  wc.cbSize         = sizeof(WNDCLASSEX);
  wc.style          = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
  wc.lpfnWndProc    = WndProc;
  wc.cbClsExtra     = 0;
  wc.cbWndExtra     = 0;
  wc.hInstance      = g_hInstance;
  wc.hIcon          = LoadIcon(NULL, IDI_APPLICATION);	// default icon
  wc.hIconSm        = LoadIcon(NULL, IDI_WINLOGO);		  // windows logo small icon
  wc.hCursor        = LoadCursor(NULL, IDC_ARROW);		  // default arrow
  wc.hbrBackground  = NULL; //(HBRUSH) GetStockObject(BLACK_BRUSH);   // black background
  wc.lpszMenuName   = NULL;     // no menu
  wc.lpszClassName  = WND_CLASS_NAME;
  
  // register the windows class
  if (!RegisterClassEx(&wc))
  {
    MessageBox(NULL,"Unable to register the window class", "Error", MB_OK | MB_ICONEXCLAMATION);
    return FALSE;							// Exit And Return FALSE
  }

  // if we're in fullscreen mode, set the display up for it
  if (g_isFullScreen)
  {
    // set up the device mode structure
    DEVMODE screenSettings;
    memset(&screenSettings,0,sizeof(screenSettings));

    screenSettings.dmSize       = sizeof(screenSettings);	
    screenSettings.dmPelsWidth  = width;			// screen width
    screenSettings.dmPelsHeight = height;			// screen height
    screenSettings.dmBitsPerPel = bits;				// bits per pixel
    screenSettings.dmFields     = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

    // attempt to switch to the resolution and bit depth we've selected
    if (ChangeDisplaySettings(&screenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
    { 
        g_isFullScreen = FALSE;	
    }
  }

  DWORD dwExStyle;
  DWORD dwStyle;

  // if we're still in fullscreen mode, set the window style appropriately
  if (g_isFullScreen)
  {
		dwExStyle = WS_EX_APPWINDOW;
		dwStyle = WS_POPUP;			  // simple window with no borders or title bar
		ShowCursor(FALSE);            // hide the cursor for now
  }
  else
  {
		dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
		dwStyle = WS_OVERLAPPEDWINDOW;
  }

  // set up the window we're rendering to so that the top left corner is at (0,0)
  // and the bottom right corner is (height,width)
  RECT  windowRect;
  windowRect.left = 0;
  windowRect.right = (LONG) width;
  windowRect.top = 0;
  windowRect.bottom = (LONG) height;

  // change the size of the rect to account for borders, etc. set by the style
  AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);

  // class registered, so now create our window
  g_hwnd = CreateWindowEx(dwExStyle,          // extended style
                          WND_CLASS_NAME,     // class name
                          title,              // app name
                          dwStyle |           // window style
                          WS_CLIPCHILDREN |   // required for
                          WS_CLIPSIBLINGS,    // using OpenGL
                          0, 0,               // x,y coordinate
                          windowRect.right - windowRect.left, // width
                          windowRect.bottom - windowRect.top, // height
                          NULL,               // handle to parent
                          NULL,               // handle to menu
                          g_hInstance,        // application instance
                          NULL);              // no extra params

  // see if our window handle is valid
  if (!g_hwnd)
	{
    // reset the display
		KillWindow();
		MessageBox(NULL, "Unable to create window", "Error", MB_OK | MB_ICONEXCLAMATION);
		return FALSE;
	}

  // get a device context
	if (!(g_HDC = GetDC(g_hwnd)))
	{
    // reset the display
		KillWindow();
		MessageBox(NULL,"Unable to create device context", "Error", MB_OK | MB_ICONEXCLAMATION);
		return FALSE;
	}

  // set the pixel format we want (p55)
  PIXELFORMATDESCRIPTOR pfd = {
    sizeof(PIXELFORMATDESCRIPTOR),	// size of structure
    1,                              // default version
    PFD_DRAW_TO_WINDOW |            // window drawing support
    PFD_SUPPORT_OPENGL |            // OpenGL support
    PFD_DOUBLEBUFFER,               // double buffering support
    PFD_TYPE_RGBA,                  // RGBA color mode
    bits,                           // 32 bit color mode
    0, 0, 0, 0, 0, 0,               // ignore color bits, non-palettized mode
    0,                              // no alpha buffer
    0,                              // ignore shift bit
    0,                              // no accumulation buffer
    0, 0, 0, 0,                     // ignore accumulation bits
    16,                             // 16 bit z-buffer size
    0,                              // no stencil buffer
    0,                              // no auxiliary buffer
    PFD_MAIN_PLANE,                 // main drawing plane
    0,                              // reserved
    0, 0, 0 };                      // layer masks ignored
      
	GLuint  pixelFormat;

	// choose best matching pixel format
	if (!(pixelFormat = ChoosePixelFormat(g_HDC, &pfd)))
	{
    // reset the display
		KillWindow();
		MessageBox(NULL, "Can't find an appropriate pixel format", "Error", MB_OK | MB_ICONEXCLAMATION);
		return FALSE;
	}

	// set pixel format to device context
  if(!SetPixelFormat(g_HDC, pixelFormat,&pfd))
	{
    // reset the display
		KillWindow();
		MessageBox(NULL, "Unable to set pixel format", "Error", MB_OK | MB_ICONEXCLAMATION);
		return FALSE;
  }

  // create the OpenGL rendering context
  if (!(g_HRC = wglCreateContext(g_HDC)))
	{
    // reset the display
		KillWindow();
		MessageBox(NULL, "Unable to create OpenGL rendering context", "Error",MB_OK | MB_ICONEXCLAMATION);
		return FALSE;
	}

  // now make the rendering context the active one
  if(!wglMakeCurrent(g_HDC, g_HRC))
	{
    // reset the display
		KillWindow();
		MessageBox(NULL,"Unable to activate OpenGL rendering context", "ERROR", MB_OK | MB_ICONEXCLAMATION);
		return FALSE;
	}

  // show the window in the forground, and set the keyboard focus to it
  ShowWindow(g_hwnd, SW_SHOW);
  SetForegroundWindow(g_hwnd);
  SetFocus(g_hwnd);

  // set up the perspective for the current screen size
  ResizeScene(width, height);

  // do one-time initialization
  
  if (!InitializeScene())
  {
    // reset the display
	  KillWindow();
	  MessageBox(NULL, "Initialization failed", "Error", MB_OK | MB_ICONEXCLAMATION);
	  return FALSE;
  }
  
  return TRUE;
} // end SetupWindow()
示例#28
0
int WINAPI WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
{
	startup_time = GetTickCount();
	previous_time = 0;
	frames = 0;
	fps = 1;
#ifdef _DEBUG_TIMINGS
	drawtime = 0;
	drawtime_prv = 0;
	drawtime_med = 1;
	cleartime = 0;
	cleartime_prv = 0;
	cleartime_med = 1;
	mainlooptime = 0;
	mainlooptime_prv = 0;
	mainlooptime_med = 1;
	fliptime = 0;
	fliptime_prv = 0;
	fliptime_med = 1;
#endif
	current_state = GAME_MAINMENU;
	difficulty_pick = 0;
	size_pick = 0;
	race_pick = 0;
	opponents_pick = 0;
	mouseX = 0;
	mouseY = 0;
	mouse[0] = false;
	mouse[1] = false;
	mouse[2] = false;
	tex_count = 0;
	font_count = 0;
	srand((unsigned)time(NULL));

	LogToFile("Log started");
	InitWindow(hInstance);
	InitPaths();
	InitTextures();
	InitFonts();
	InitStorages();
	InitDefinitions();
	InitGUI();
	InitOGLSettings();
	ResizeScene(cfg.scr_width, cfg.scr_height);
	LogPaths();

	//Load_v_03("test.txt");
	Load_v_04("test.txt");
	while(current_state != GAME_EXITING)
	{
		MainLoop();
		ClearScene();
		DrawScene();
		Flip(&hDC);
	}

	// Now terminating all
	KillWindow(hInstance);

	LogToFile("Finished logging");




}
示例#29
0
int WINAPI WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
{
	LogToFile(DEFAULT_LOG_NAME, "Log started");

	InitWindow(hInstance);
	startup_time = GetTickCount();
	previous_time = 0;
	frames = 0;
	fps = 1;

#ifdef _DEBUG_TIMINGS

	drawtime = 0;
	drawtime_prv = 0;
	drawtime_med = 1;
	cleartime = 0;
	cleartime_prv = 0;
	cleartime_med = 1;
	mainlooptime = 0;
	mainlooptime_prv = 0;
	mainlooptime_med = 1;
	fliptime = 0;
	fliptime_prv = 0;
	fliptime_med = 1;

#endif

	current_state = GAME_MAINMENU;
	mouseX = 0;
	mouseY = 0;
	mouse[0] = false;
	mouse[1] = false;
	mouse[2] = false;
	tex_count = 0;
	font_count = 0;

	InitPaths();
	LogPaths();

	
	LoadTexturesFromFolder(path_textures, textures);

	InitFonts();
	InitGUI();

	

	

	InitOGLSettings();
	ResizeScene(cfg.scr_width, cfg.scr_height);
		
	while(current_state != GAME_EXITING)
	{
		MainLoop();
		ClearScene();
		DrawScene();
		Flip(hDC);
	}

	// Now terminating all
	KillWindow(hInstance);

	LogToFile(DEFAULT_LOG_NAME, "Finished logging");




}
示例#30
0
bool Win32Dialog::CreateWnd( const wchar_t* title, int width, int height, int Icon, HWND Parent )
{
	if( m_hWnd )
		return false;

	MWLOG(LEV_DEBUG, MOD_DLG, L"  --> Win32Dialog::CreateWnd (Parent=%X)",Parent);

	DWORD		dwExStyle;				// Window Extended Style
	DWORD		dwStyle;				// Window Style
	RECT		WindowRect;				// Grabs Rectangle Upper Left / Lower Right Values
	RECT		DeskRect;

	WindowRect.left = (long)0;			// Set Left Value To 0
	WindowRect.right = (long)width;		// Set Right Value To Requested Width
	WindowRect.top = (long)0;			// Set Top Value To 0
	WindowRect.bottom = (long)height;	// Set Bottom Value To Requested Height
	GetClientRect( GetDesktopWindow(), &DeskRect );

	WNDCLASS	wc;						// Windows Class Structure
	HICON hIco;
	if( Icon == 0 )
		hIco = LoadIcon( NULL, IDI_WINLOGO );
	else
		hIco = LoadIcon( m_hInstance, MAKEINTRESOURCE(Icon) );

	wc.style			= CS_HREDRAW | CS_VREDRAW; // | CS_OWNDC;	// Redraw On Size, And Own DC For Window.
	wc.lpfnWndProc		= (WNDPROC)WndProc;							// WndProc Handles Messages
	wc.cbClsExtra		= 0;										// No Extra Window Data
	wc.cbWndExtra		= 0; //DLGWINDOWEXTRA;							// No Extra Window Data
	wc.hInstance		= m_hInstance;								// Set The Instance
	wc.hIcon			= hIco;			// Load The Default Icon
	wc.hCursor			= LoadCursor( NULL, IDC_ARROW );			// Load The Arrow Pointer
	wc.hbrBackground	= (HBRUSH)GetSysColorBrush( COLOR_3DFACE );	// What Color we want in our background
	wc.lpszMenuName		= NULL;										// We Don't Want A Menu
	wc.lpszClassName	= m_appName;								// Set The Class Name

	if( !RegisterClass( &wc ) )									// Attempt To Register The Window Class
	{
		unsigned long err = GetLastError();
		MWLOG(LEV_WARN, MOD_DLG, L"  --> Win32Dialog::CreateWnd - Failed To Register The Window Class - Error=%ld",err);
		return false;											// Return FALSE
	}

	dwStyle = WS_CAPTION | WS_VISIBLE |  WS_SYSMENU | WS_OVERLAPPED;
	dwExStyle = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_WINDOWEDGE | WS_EX_TOPMOST;
	if( m_ModalHold )
	{
		dwStyle |= WS_POPUP;
		dwExStyle |= WS_EX_DLGMODALFRAME;
	}

	AdjustWindowRectEx( &WindowRect, dwStyle, FALSE, dwExStyle );	// Adjust Window To True Requested Size

	Active_lpWnd = this;
	// Create The Window
	if( !( m_hWnd = Active_hWnd = CreateWindowEx(	dwExStyle,			// Extended Style For The Window
								m_appName,							// Class Name
								title,								// Window Title
								dwStyle,							// Defined Window Style
								DeskRect.right/2 - (WindowRect.right-WindowRect.left)/2,
								DeskRect.bottom/2 - (WindowRect.bottom-WindowRect.top)/2,
								//CW_USEDEFAULT, CW_USEDEFAULT,		// Window Position
								WindowRect.right-WindowRect.left,	// Calculate Window Width
								WindowRect.bottom-WindowRect.top,	// Calculate Window Height
								Parent,								// No Parent Window
								NULL,								// No Menu
								m_hInstance,							// Instance
								(LPVOID)Active_lpWnd)))								// Dont Pass Anything To WM_CREATE
	{
		unsigned long err = GetLastError();
		KillWindow( );								// Reset The Display
		MWLOG(LEV_WARN, MOD_DLG, L"  --> Win32Dialog::CreateWnd - Window Creation Error - Error=%ld",err);
		return false;								// Return FALSE
	}
	MWLOG(LEV_DEBUG, MOD_DLG, L"  --> Win32Dialog::CreateWnd - CreateWindowEx (m_hWnd=%X)",m_hWnd);

	WndMap.insert( TD_WNDPAIR( m_hWnd, this ) );

	return true;
}