Results 1 to 9 of 9

Thread: Windows app crashing on Maximize (Windows XP)

  1. #1
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default Windows app crashing on Maximize (Windows XP)

    Any ideas why this is happening? My project is based on an earlier version of App.cpp so let me know if this has been fixed please. Looking into whether or not I can just disable the maximize button from the Win32 setup...

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    Strange.. do the demos from svn work ok? If so, I'd see if you can update to the latest shared main.cpp if you aren't already using it, the App.* part shouldn't really matter.

    It is pretty easy to disable the maximize button.

    In main.cpp change:

    Code:
    DWORD style = WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_SIZEBOX | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;
    to

    Code:
    DWORD style = WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_SIZEBOX | WS_MINIMIZEBOX;
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    Just confirmed that in Windows 7, the latest source does not crash when Maximizing/Minimizing.

    A humble Request: can we change the desired resolution and stretch to the screen when maximizing or resizing? Can this be changed while the app is running?

  4. #4
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    A humble Request: can we change the desired resolution and stretch to the screen when maximizing or resizing? Can this be changed while the app is running?
    To clarify, you want a true screen resolution change instead of just the scaling that is happening now? Just scaling and leaving the real native resolution at whatever it is seems to be the most compatible these days, but does have its own problems, such as being slower (more pixels to process, a waste if your game is actually 800X600 and the desktop is much larger), and creating aspect ratio problems. (We don't have an "automatic engine-wide" letterboxing option to fix aspect ratios yet)

    I did plan ahead to support "real" resolution changes though, only Main.cpp needs to be changed - internally, it's dropping all textures completely and reinitializing the hwnd and GL already, so the only thing to add is a rez change right before that happens.

    But probably not something I will get to adding until I have a project that needs it and I can properly test it.

    But to do it I think you'd just need to add a ChangeDisplaySettingsEx command in main.cpp's InitWindow function.

    After the old g_hWnd is destroyed, but before the new one is created.
    Seth A. Robinson
    Robinson Technologies

  5. #5
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    To clarify, I am using the "Windows Wide" setting as my primary screen size. Unfortunately not all laptops are exactly 800x1280, so I'd like to stretch the window to whatever native resolution is needed. I realize this runs the risk of getting horrible results, but I'm fine with that for now.

    So should I still look into ChangeDisplaySettingsEx?

    I saw you did have some code in WndProc that doesn't get executed. I tried removing the first break statement and I'm getting OpenGL errors.

    Code:
    	case WM_SIZE:
    		{
    			break;
    			
    			// Respond to the message:				
    			int Width = LOWORD( lParam );
    			int Height = HIWORD( lParam ); 
    			
    		
    			if (Width != GetPrimaryGLX() || Height != GetPrimaryGLY())
    			{
    				LogMsg("Got new size: %d, %d", Width, Height);
    					GetBaseApp()->KillOSMessagesByType(OSMessage::MESSAGE_SET_VIDEO_MODE);
    					GetBaseApp()->SetVideoMode(Width, Height, false, 0);
    
    				if (GetFakePrimaryScreenSizeX() != 0)
    				{
    					//we're stretching the screen to fit, so make this look a little better
    					//by drawing what we have during the drag operation.  Why does it only
    					//draw when dragging bigger, not smaller?  GL surface thing?  Hrm.
    
    					RECT rect;
    					if (GetUpdateRect(g_hWnd, &rect, FALSE))
    					{
    						PAINTSTRUCT paint;
    						BeginPaint(g_hWnd, &paint);
    	#ifdef C_GL_MODE
    						SwapBuffers(g_hDC);
    	#endif
    						EndPaint(g_hWnd, &paint);
    					}
    				}
    			}
    		}
    		
    		break;

  6. #6
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    FYI, this'll get/set resolution to the native desktop res (in Windows):

    Code:
    void InitVideoSize()
    {
    #ifdef RT_WEBOS_ARM
    	return;
    #endif
    
    	//the X/Y of the Windows setting is actually reversed.. it's confusing like this because most of the mobiles are "rotated" to landscape
    	//mode manually and it was just less changes to make to pretend we were rotating the Windows screen to play in "landscape" orientation
    	//to make testing consistent
    	AddVideoMode("Windows", 768, 1024, PLATFORM_ID_WINDOWS);
    	AddVideoMode("Windows Wide", 800, 1280, PLATFORM_ID_WINDOWS);
    	AddVideoMode("OSX", 768, 1024, PLATFORM_ID_OSX); //g_landScapeNoNeckHurtMode should be false when testing. Sort of buggy to emulate in Windows
    	AddVideoMode("OSX Wide", 800, 1280, PLATFORM_ID_OSX); 
    
    	// get native window size
    	HWND        hDesktopWnd = GetDesktopWindow();
    	HDC         hDesktopDC = GetDC(hDesktopWnd);
    	int nScreenX = GetDeviceCaps(hDesktopDC, HORZRES);
    	int nScreenY = GetDeviceCaps(hDesktopDC, VERTRES);
    	ReleaseDC(hDesktopWnd, hDesktopDC);
    
    	AddVideoMode("native", nScreenY, nScreenX, PLATFORM_ID_WINDOWS);
    	
    	AddVideoMode("iPhone", 320, 480, PLATFORM_ID_IOS);
    	AddVideoMode("iPad", 768, 1024, PLATFORM_ID_IOS);
    	AddVideoMode("iPad2", 768*2, 1024*2, PLATFORM_ID_IOS); //Note, you need a monitor bigger than 2048X1536 on Windows for this to work right,
    	//otherwise it clips the window size to the main monitor size.  I don't have one...
    	AddVideoMode("iPhone4", 640, 960, PLATFORM_ID_IOS);
    
    	AddVideoMode("Palm Pre Plus", 320, 480, PLATFORM_ID_WEBOS);
    	AddVideoMode("Pixi", 320, 400, PLATFORM_ID_WEBOS);
    	
    	AddVideoMode("G1", 320, 480, PLATFORM_ID_ANDROID);
    	AddVideoMode("G1 Landscape", 480, 320, PLATFORM_ID_ANDROID);
    	AddVideoMode("Nexus One", 480, 800, PLATFORM_ID_ANDROID);
    	AddVideoMode("Droid", 480, 854, PLATFORM_ID_ANDROID);
    	AddVideoMode("Droid Landscape", 854, 480, PLATFORM_ID_ANDROID); //g_landScapeNoNeckHurtMode should be false when testing
    	AddVideoMode("Nexus One Landscape", 800, 480, PLATFORM_ID_ANDROID); //g_landScapeNoNeckHurtMode should be false when testing
    
    	string desiredVideoMode = "native"; //name needs to match one of the ones defined below
        g_landScapeNoNeckHurtMode = true; //if true, will rotate the screen so we can play in landscape mode in windows without hurting ourselves
    
    	SetVideoModeByName(desiredVideoMode);
    
    	GetBaseApp()->OnPreInitVideo(); //gives the app level code a chance to override any of these parms if it wants to
    }
    Last edited by BigBMan; 03-17-2011 at 01:23 AM. Reason: AddVideoMode("native", nScreenY, nScreenX, PLATFORM_ID_WINDOWS);

  7. #7
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    Thanks. Ack, yeah that break; wasn't supposed to be there.. sloppy.

    Patch committed.. also added a "Windows Native" setting based on your code, thanks.
    Seth A. Robinson
    Robinson Technologies

  8. #8
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    May want to fix this:

    AddVideoMode("native", nScreenY, nScreenX, PLATFORM_ID_WINDOWS);

    was previously


    AddVideoMode("native", nScreenX, nScreenX, PLATFORM_ID_WINDOWS);

    Sorry, and Thank you!

  9. #9
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    Whups, fixed!
    Seth A. Robinson
    Robinson Technologies

Similar Threads

  1. ClanLib 2.0 and Windows 7?
    By Sir Smashy in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 09-12-2009, 09:47 AM
  2. Layered windows now available in the gui example
    By rombust in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 09-08-2009, 10:37 AM
  3. using clanlib on windows CE?
    By babyvegas in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 07-22-2008, 08:44 PM
  4. Windows Bug
    By Starclopsofish in forum Novashell Game Creation System
    Replies: 2
    Last Post: 04-25-2008, 05:00 AM
  5. More Windows fun
    By madmark in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 03-19-2008, 08:16 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •