DialogBox trouble

This is a discussion on DialogBox trouble within the Windows Programming forums, part of the Platform Specific Boards category; Hi, my app uses Dialog boxes for new gamae, changing settings and etc. But the problem is that while they ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    8

    DialogBox trouble

    Hi, my app uses Dialog boxes for new gamae, changing settings and etc. But the problem is that while they work fine on my computer and on my friends(we all sue win 7) it doesn't work in school(they use win xp). It only works on 4 computers which aren't setup according to the schools settings. The app runs fine playing the game but when it comes to a part that uses a DialogBox the app froze(doesn't crash or anything no error mesages from windows). So what could the problem be?

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    What happens inside that Dialog Box?
    Devoted my life to programming...

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Sevko View Post
    Hi, my app uses Dialog boxes for new gamae, changing settings and etc. But the problem is that while they work fine on my computer and on my friends(we all sue win 7) it doesn't work in school(they use win xp). It only works on 4 computers which aren't setup according to the schools settings. The app runs fine playing the game but when it comes to a part that uses a DialogBox the app froze(doesn't crash or anything no error mesages from windows). So what could the problem be?
    Check your code... make sure there are no calls or controls in the dialog that are not supported on XP. (Win7 introduced some new stuff). Looking the items up in the SDK will tell you which versions are supported.

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    8

    None work

    I have alot of diffrent dialogs. But none have things that shouldn't be supported in XP. It worked on one computer which has XP OS. I added WS_VISIBLE to all and ShowWindow in the dialogs. If it still won't work I'll just disable win XP visual styles.

    .rc
    Code:
    IDD_NOVA_IGRA DIALOG 0, 0, 140, 40
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION "Nova igra"
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Želite začeti novo igro?", IDD_TEXT , 5, 5, 100, 100
        PUSHBUTTON "Da", IDD_DA, 10, 20, 50, 15
    	PUSHBUTTON "Ne", IDD_NE, 80, 20, 50, 15
    END
    
    IDD_REPLAY DIALOG 0, 0, 150, 40
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION "Replay"
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Želite vidite do sedaj storjene vaše poteze?", IDD_TEXT , 5, 5, 150, 100
    	DEFPUSHBUTTON "Ne", IDD_NE, 86, 20, 50, 15
        PUSHBUTTON "Da", IDD_DA, 16, 20, 50, 15
    END
    
    IDD_SPREMENI_VIDEZ DIALOG 0, 0, 140, 130
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION "Spremeni videz"
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Spremeni izgled figur", IDD_TEXT , 5, 5, 75, 10
        RADIOBUTTON "Mačke in miši", IDD_DEFAULT, 36, 35, 150, 10
    	RADIOBUTTON "Mario in gobe", IDD_MARIO, 36, 67, 150, 10
        RADIOBUTTON "Riko in kolesa", IDD_RIKOSTYLA, 36, 98, 150, 10
    	PUSHBUTTON "Vredu", IDD_VREDU, 10, 110, 50, 15
    	PUSHBUTTON "Prekliči", IDD_PREKLICI, 80, 110, 50, 15
    END
    
    IDD_TEZAVNOST DIALOG 0, 0, 140, 120
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION "Težavnost"
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Spremeni težavnost", IDD_TEXT , 5, 5, 100, 100
        RADIOBUTTON "Lahka                        (5 Mišk, 50 Ovir)", IDD_LAHKA, 5, 20, 150, 10
    	RADIOBUTTON "Srednja                    (10 Mišk, 10 Ovir)", IDD_SREDNJA, 5, 40, 150, 10
    	RADIOBUTTON "Težka                    (15 Mišk, 150 Ovir)", IDD_TEZKA, 5, 60, 150, 10
    	RADIOBUTTON "Zelo težka             (20 Mišk, 200 Ovir)", IDD_ZELO_TEZKA, 5, 80, 150, 10
    	PUSHBUTTON "Vredu", IDD_VREDU, 10, 100, 50, 15
    	PUSHBUTTON "Prekliči", IDD_PREKLICI, 80, 100, 50, 15
    END
    
    IDD_DLG DIALOG 0, 0, 140, 40
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION " "
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Sprememba", IDD_TEXT , 5, 5, 100, 100
    	PUSHBUTTON "Začni igro", IDD_ZACNI, 10, 20, 50, 15
    	PUSHBUTTON "Dokončaj igro", IDD_DOKONCAJ, 80, 20, 50, 15
    END
    
    IDD_IZHOD DIALOG 0, 0, 140, 40
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION "Izhod iz igre"
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Želite zapustiti igro?", IDD_TEXT , 5, 5, 100, 100
        PUSHBUTTON "Da", IDD_DA, 10, 20, 50, 15
    	PUSHBUTTON "Ne", IDD_NE, 80, 20, 50, 15
    END
    
    IDD_ZMAGA DIALOG 0, 0, 220, 40
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION "Igra je dobljena"
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Kako želite nadaljevati?", IDD_TEXT , 5, 5, 100, 100
        PUSHBUTTON "Začni novo igro", IDD_NOVA, 10, 20, 60, 15
    	PUSHBUTTON "Replay", IDD_REPLAY, 80, 20, 60, 15
    	PUSHBUTTON "Izhod", IDD_QUIT, 150, 20, 60, 15
    END
    
    IDD_PORAZ DIALOG 0, 0, 220, 40
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER | WS_VISIBLE
    CAPTION "Izgubili ste igro"
    FONT 8, "MS Shell Dlg"
    BEGIN
        LTEXT "Kako želite nadaljevati?", IDD_TEXT , 5, 5, 100, 100
        PUSHBUTTON "Izhod", IDD_QUIT, 150, 20, 60, 15
        PUSHBUTTON "Začni novo igro", IDD_NOVA, 10, 20, 60, 15
    	PUSHBUTTON "Replay", IDD_REPLAY, 80, 20, 60, 15
    END
    DialogBoxes
    Code:
    LRESULT CALLBACK DlgProc(HWND hwndDlg, UINT Msg, WPARAM wParam, LPARAM lParam){
    	switch(Msg){
    	    case WM_INITDIALOG:
    			ShowWindow(hwndDlg, SW_SHOW);
    		    return TRUE;
    	    case WM_COMMAND:
    			switch(wParam){
    			    case IDD_DA:
    			        EndDialog(hwndDlg, IDD_DA);
    					break;
    				case IDD_NE:
    					EndDialog(hwndDlg, NULL);
    					break;
    				case IDD_ZACNI:
    					EndDialog(hwndDlg, IDD_ZACNI);
    					break;
    				case IDD_DOKONCAJ:
    					EndDialog(hwndDlg, IDD_DOKONCAJ);
    					break;
    			}
    			return TRUE;
    		case WM_CLOSE:
    			EndDialog(hwndDlg, NULL);
    			break;
    	}
    	return FALSE;
    }
    LRESULT CALLBACK DlgProcSpremeniVidez(HWND hwndDlg, UINT Msg, WPARAM wParam, LPARAM lParam){
    	static int Paint=0;
    	switch(Msg){
    	    case WM_INITDIALOG:
    			ShowWindow(hwndDlg, SW_SHOW);
    			CheckRadioButton(hwndDlg, IDD_DEFAULT, IDD_RIKOSTYLA, Mode);
    		    return TRUE;
    	    case WM_PAINT:{
    				HDC hdc;
                    PAINTSTRUCT ps;
    				hdc = BeginPaint(hwndDlg, &ps);
    				LoadAndBlitDlg(hdc);
    				EndPaint(hwndDlg, &ps);
    			break;
    		}
    	    case WM_COMMAND:{
    			switch(wParam){
                    case IDD_DEFAULT:
    					CheckRadioButton(hwndDlg, IDD_DEFAULT, IDD_RIKOSTYLA, IDD_DEFAULT);
    					break;
    				case IDD_MARIO:
    					CheckRadioButton(hwndDlg, IDD_DEFAULT, IDD_RIKOSTYLA, IDD_MARIO);
    					break;
    				case IDD_RIKOSTYLA:
    					CheckRadioButton(hwndDlg, IDD_DEFAULT, IDD_RIKOSTYLA, IDD_RIKOSTYLA);
    					break;
    			    case IDD_VREDU:{
    					for(Mode = 0;;Mode++)
    				        if(BST_CHECKED == IsDlgButtonChecked(hwndDlg, Mode))
    					        break;
    					Redraw = 1;
    					EndDialog(hwndDlg, IDD_VREDU);
    					break;
    				    }
    				case IDD_PREKLICI:
    					EndDialog(hwndDlg, NULL);
    					break;
    			}
    			break;
    		}
    		case WM_CLOSE:
    			EndDialog(hwndDlg, NULL);
    			break;
    	}
    	return FALSE;
    }
    LRESULT CALLBACK DlgProcTezavnost(HWND hwndDlg, UINT Msg, WPARAM wParam, LPARAM lParam){
    	switch(Msg){
    	    case WM_INITDIALOG:
    			ShowWindow(hwndDlg, SW_SHOW);
    			CheckRadioButton(hwndDlg, IDD_LAHKA, IDD_ZELO_TEZKA, TezavnostSettings);
    		    return TRUE;
    	    case WM_COMMAND:{
    			switch(wParam){
                    case IDD_LAHKA:
    					CheckRadioButton(hwndDlg, IDD_LAHKA, IDD_ZELO_TEZKA, IDD_LAHKA);
    					break;
    				case IDD_SREDNJA:
    					CheckRadioButton(hwndDlg, IDD_LAHKA, IDD_ZELO_TEZKA, IDD_SREDNJA);
    					break;
    				case IDD_TEZKA:
    					CheckRadioButton(hwndDlg, IDD_LAHKA, IDD_ZELO_TEZKA, IDD_TEZKA);
    					break;
    				case IDD_ZELO_TEZKA:
    					CheckRadioButton(hwndDlg, IDD_LAHKA, IDD_ZELO_TEZKA, IDD_ZELO_TEZKA);
    					break;
    			    case IDD_VREDU:{
    					if(GameDevelopment == 1){
    					    for(TezavnostSettings=1;;TezavnostSettings++)
    				            if(BST_CHECKED == IsDlgButtonChecked(hwndDlg, TezavnostSettings))
    								break;
    						EndDialog(hwndDlg, NULL);
    					}
    					else if(GameDevelopment > 1){
    						int i = TezavnostSettings;
    							for(TezavnostSettings=1;;TezavnostSettings++)
    				                if(BST_CHECKED == IsDlgButtonChecked(hwndDlg, TezavnostSettings))
    								    break;
    						if(TezavnostSettings == i)
    							EndDialog(hwndDlg, NULL);
    						else if(DialogBox(ghInstance, MAKEINTRESOURCE(IDD_DLG), hwndDlg, (DLGPROC)DlgProc) == IDD_ZACNI)
    						    EndDialog(hwndDlg, RESTART);
    						else
    							EndDialog(hwndDlg, NULL);
    					}
    					break;
    				}
    				case IDD_PREKLICI:
    					EndDialog(hwndDlg, NULL);
    					break;
    			}
    			break;
    		}
    		return TRUE;
    		case WM_CLOSE:
    			EndDialog(hwndDlg, NULL);
    			break;
    	}
    	return FALSE;
    }
    LRESULT CALLBACK DlgProcIgra(HWND hwndDlg, UINT Msg, WPARAM wParam, LPARAM lParam){
    	switch(Msg){
    	    case WM_INITDIALOG:
    			ShowWindow(hwndDlg, SW_SHOW);
    		    return TRUE;
    	    case WM_COMMAND:
    			switch(wParam){
    			    case IDD_NOVA:
    			        EndDialog(hwndDlg, IDD_NOVA);
    					break;
    				case IDD_REPLAY:
    					EndDialog(hwndDlg, IDD_REPLAY);
    					break;
    				case IDD_QUIT:
    					EndDialog(hwndDlg, IDD_QUIT);
    					break;
    			}
    			return TRUE;
        	case WM_CLOSE:
    			EndDialog(hwndDlg, NULL);
    			break;
    	}
    	return FALSE;
    }

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ok the pushbuttons and radiobuttons should be a problem... but you might want to check the LTEXT against the SDK...

    Another way to test it is to run your program in XP compatibility mode on the win7 machines and see what messes up.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 01-03-2007, 03:02 PM
  2. Adding a Menu to a Dialogbox?
    By TCM in forum Windows Programming
    Replies: 2
    Last Post: 08-24-2004, 03:12 PM
  3. DialogBox and BITMAPS
    By ventolin in forum Windows Programming
    Replies: 3
    Last Post: 07-27-2004, 02:58 PM
  4. C++ program trouble
    By senrab in forum C++ Programming
    Replies: 7
    Last Post: 04-30-2003, 12:55 AM
  5. Proper way to end a dialogbox.
    By spoon_ in forum Windows Programming
    Replies: 2
    Last Post: 01-06-2003, 05:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21