Click here to Skip to main content
14,450,692 members

C / C++ / MFC

 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz23-Jan-20 9:27
MemberErich Jarz23-Jan-20 9:27 
GeneralRe: DPI aware, I am confused Pin
leon de boer24-Jan-20 8:05
Memberleon de boer24-Jan-20 8:05 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz24-Jan-20 8:42
MemberErich Jarz24-Jan-20 8:42 
GeneralRe: DPI aware, I am confused Pin
leon de boer24-Jan-20 20:41
Memberleon de boer24-Jan-20 20:41 
GeneralRe: DPI aware, I am confused Pin
Erich Jarz26-Jan-20 21:22
MemberErich Jarz26-Jan-20 21:22 
GeneralRe: DPI aware, I am confused Pin
Gerry Schmitz24-Jan-20 9:27
mveGerry Schmitz24-Jan-20 9:27 
GeneralRe: DPI aware, I am confused Pin
Richard MacCutchan23-Jan-20 10:59
communityengineerRichard MacCutchan23-Jan-20 10:59 
Questionwin32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 7:53
Membercoco24319-Jan-20 7:53 
Hi,

I am covering a book tutorial about programming win32 and when I am compiling the code provided,
radio buttons doesn't show when are checked, instead the checkbox that is in the same dialog window
shows when it is checked.

I will attach the code if you can help me:

resource code:

TESTDIALOG DIALOG DISCARDABLE  20, 20, 180, 70
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test Dialog"
FONT 8, "MS Sans Serif"
BEGIN
    CHECKBOX        "Check box control.",IDC_CHECKBOX,9,7,70,10
    GROUPBOX        "Radio Buttons",-1,7,21,86,39
    RADIOBUTTON     "First", IDC_RADIO1,13,32,37,10,WS_GROUP | WS_TABSTOP
    RADIOBUTTON     "Second",IDC_RADIO2,13,45,39,10
    PUSHBUTTON      "Done",IDCANCEL,116,8,50,14,WS_GROUP
END


cpp code:

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case ID_FILE_TEST:                        // adaugat de mine
			// ShowWindow(hWnd,SW_SHOWMAXIMIZED);   // maximizeaza fereastra
		 if ( !hDlgModeless )
                           hDlgModeless = CreateDialog( hInst,  MAKEINTRESOURCE(32767), 
                                                hWnd, (DLGPROC)TestDlgProc );
			 break;
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		// TODO: Add any drawing code here...
		EndPaint(hWnd, &ps);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}

LRESULT CALLBACK TestDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  switch (uMsg)
  {
  // Initially set the check box
  // and radio button states.
  //...........................
  case WM_INITDIALOG:
	  CheckDlgButton(hDlg,IDC_CHECKBOX, bChecked ? MF_CHECKED : MF_UNCHECKED);
	  CheckRadioButton(hDlg,IDC_RADIO1,IDC_RADIO2,bRadio1 ? IDC_RADIO1 : IDC_RADIO2);
	  break;
  case WM_COMMAND:
	  switch( LOWORD(wParam))
	  {
	  case IDC_CHECKBOX:
		  bChecked=!IsDlgButtonChecked(hDlg,IDC_CHECKBOX);
		  CheckDlgButton(hDlg,IDC_CHECKBOX, bChecked ? MF_CHECKED : MF_UNCHECKED);
		  break;
	  case IDC_RADIO1:
		  bRadio1=TRUE;
		  CheckRadioButton(hDlg,IDC_RADIO1,IDC_RADIO2, IDC_RADIO1);
		  break;
	  case IDC_RADIO2:
		  bRadio1=FALSE;
		  CheckRadioButton(hDlg,IDC_RADIO1,IDC_RADIO2,IDC_RADIO2);
		  break;
	  case IDCANCEL:
		  DestroyWindow(hDlg);
		  break;
	  }//end switch
	  break;
  case WM_DESTROY:
	  hDlgModeless=NULL;
	  break;
  default: 
	  return (FALSE);
  }// end switch


	return (TRUE);
}



If it's need it I will put all the code.

Thank you in advance.
AnswerRe: win32 Radio button doesn't show when is checked Pin
Victor Nijegorodov19-Jan-20 8:32
MemberVictor Nijegorodov19-Jan-20 8:32 
GeneralRe: win32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 9:48
Membercoco24319-Jan-20 9:48 
GeneralRe: win32 Radio button doesn't show when is checked Pin
Victor Nijegorodov19-Jan-20 10:29
MemberVictor Nijegorodov19-Jan-20 10:29 
GeneralRe: win32 Radio button doesn't show when is checked Pin
coco24319-Jan-20 11:05
Membercoco24319-Jan-20 11:05 
GeneralRe: win32 Radio button doesn't show when is checked Pin
_Flaviu19-Jan-20 20:22
Member_Flaviu19-Jan-20 20:22 
GeneralRe: win32 Radio button doesn't show when is checked Pin
coco24320-Jan-20 7:50
Membercoco24320-Jan-20 7:50 
GeneralRe: win32 Radio button doesn't show when is checked Pin
_Flaviu20-Jan-20 20:41
Member_Flaviu20-Jan-20 20:41 
AnswerRe: win32 Radio button doesn't show when is checked Pin
Richard MacCutchan20-Jan-20 0:16
communityengineerRichard MacCutchan20-Jan-20 0:16 
AnswerRe: win32 Radio button doesn't show when is checked Pin
Stefan_Lang20-Jan-20 5:00
mveStefan_Lang20-Jan-20 5:00 
QuestionI cannot create a Release version. Pin
Member 1410515514-Jan-20 17:50
MemberMember 1410515514-Jan-20 17:50 
AnswerRe: I cannot create a Release version. Pin
Joe Woodbury14-Jan-20 21:10
professionalJoe Woodbury14-Jan-20 21:10 
SuggestionRe: I cannot create a Release version. Pin
Richard MacCutchan14-Jan-20 22:47
communityengineerRichard MacCutchan14-Jan-20 22:47 
GeneralRe: I cannot create a Release version. Pin
Member 1410515515-Jan-20 0:57
MemberMember 1410515515-Jan-20 0:57 
GeneralRe: I cannot create a Release version. Pin
Richard MacCutchan15-Jan-20 0:58
communityengineerRichard MacCutchan15-Jan-20 0:58 
QuestionSetWindowsHookEx failed Pin
Member 1410515513-Jan-20 10:54
MemberMember 1410515513-Jan-20 10:54 
AnswerRe: SetWindowsHookEx failed Pin
leon de boer13-Jan-20 12:49
Memberleon de boer13-Jan-20 12:49 
GeneralRe: SetWindowsHookEx failed Pin
Member 1410515513-Jan-20 16:51
MemberMember 1410515513-Jan-20 16:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.