Thread: Radio Buttons in Visual C++ 6

  1. #16
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    It's a pointer to a pointer to the window. There is no "name." Remember that and you'll do fine.
    Away.

  2. #17
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>name of this hwnd
    (value of the HWND)

    When you created it with CreateDialog() CreateWindow() ect the HWND would be the return.

    In the callback function one of the params is the Dialogs HWND.
    OR
    When you get the msg that the button has been clicked, use the macro from windowsx.h to find the buttons HWND

    hWnd = GET_WM_COMMAND_HWND( wParam, lParam);


    If you know the title (the text written on the top of the dilaog) then use FindWindow()



    Are you using C based WIN32 or MFC (C++ wrapper for WIN32)?

    Why not post some code (zip it). It might be easier if I could see what you are trying to do.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #18
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Please learn C++ and then the WinAPI properly before using MFC. As you have learned now the MFC looks easy only on the surface. A good foundation in C++ is required and in the WinAPI very highly recommended for the use of MFC.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #19
    Registered User
    Join Date
    Apr 2003
    Posts
    52
    i understand cornedbee, i have given up on this MFC thing because as i've already stated, i need to be more proficient in C++ before i can attempt this other stuff, i do like to finish what i started and that is why i posted this last problem. Thanks for your help novacain, here is my project file zipped. Maybe that can help, blackrat was helping me out as well but we needed to find certain function prototypes which we couldn't. Anyways, the project file is attached. Thanks for all help of course. Edit: Here is the linked filehttp://spift.com/~ripper1/ComputerProgram.zip
    Last edited by Ripper1; 05-05-2003 at 04:33 PM.

  5. #20
    Registered User
    Join Date
    Apr 2003
    Posts
    52
    just curious if anyone looked at my project? thanks

  6. #21
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Sorry working hard here.

    OK, I see the problem. Here is a simple solution.

    For each radio button write a handler similar to this
    Code:
    //This function will turn off the controls not needed by this type of calculation.
    //in case some other controls were turned off it will try to turn them back on
    void CGasLawsCalcDlg::OnBoyle() 
    {
    	
    	//turn these off
    	GetDlgItem(IDC_TEMP1)->EnableWindow(FALSE);
    	GetDlgItem(IDC_TEMP2)->EnableWindow(FALSE);
    	GetDlgItem(IDC_MOLES1)->EnableWindow(FALSE);
    //	CGasLawsCalcDlg::GetDlgItem(IDC_MOLES2)->EnableWindow(FALSE);
    	//turn these back on (will do nothing if they are already on)
    	GetDlgItem(IDC_PRESSURE1)->EnableWindow(TRUE);
    	GetDlgItem(IDC_PRESSURE2)->EnableWindow(TRUE);
    	
    	GetDlgItem(IDC_VOLUME1)->EnableWindow(TRUE);
    	GetDlgItem(IDC_VOLUME2)->EnableWindow(TRUE);
    }
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #22
    Registered User
    Join Date
    Apr 2003
    Posts
    52
    THANK YOU NOVACAIN!!! you have been a tremendous help with this! thank you very much, it is now complete!

  8. #23
    Registered User
    Join Date
    Aug 2001
    Posts
    223

    project not available

    I tried to download the project but could not download it. It seems that you are doing everything correctly. The only thing that I can think of is that the buttons are not in the correct order. You could have entered other controls in between entering the radio buttons. You should try to display whatever output the value of m_RADIO1 is . You may be surprised at what the value is. If the value is not what you expect delete the radio buttons and place them again in the dialog.

    example

    Code:
    void CChemCalcDlg::OnCalculate()
    {
    	UpdateData(TRUE);
    	CString sRadioValue;
    
                    sRadioValue.Format("%d", m_RADIO1);
                    MessageBox( sRadioValue );
    }
    zMan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM