Thread: Yet Another Question but this envolves code not opinion

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    66

    Yet Another Question but this envolves code not opinion

    Ok two questions When I try to uncheck the boxes for these it brings up an error in MFC42.dll. I also wanna know if I am getting this correct. Alright the GetDlgItem is selecting the Item the ShowWindow function is telling if it should show the window or not show it. What does this operator -> (if it is called that) do?
    And void Cday22Dlg::OnCkshwmsg() is a function in the class Cday22Dlg?? Thanks
    void CDay22Dlg::OnCkshwmsg()
    {


    UpdateData(TRUE);

    if (m_bEnableMsg == TRUE)
    {

    GetDlgItem(IDC_MSG)->ShowWindow(TRUE);
    GetDlgItem(IDC_SHWMSG)->ShowWindow(TRUE);
    GetDlgItem(IDC_DFLTMSG)->ShowWindow(TRUE);
    GetDlgItem(IDC_CLRMSG)->ShowWindow(TRUE);
    GetDlgItem(IDC_STATIC)->ShowWindow(TRUE);
    }

    else
    {
    GetDlgItem(IDC_MSG)->ShowWindow(FALSE);
    GetDlgItem(IDC_SHWMSG)->ShowWindow(FALSE);
    GetDlgItem(IDC_DFLTMSG)->ShowWindow(FALSE);
    GetDlgItem(IDC_CLRMSG)->ShowWindow(FALSE);
    GetDlgItem(IDC_STATIC)->ShowWindow(FALSE);
    }

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    The code looks ok, so I think your problem is elsewhere.

    What does this operator -> (if it is called that) do?
    It accesses members of a class or struct through a pointer. GetDlgItem() will return a pointer to a CWnd object and ShowWindow is a member of CWnd. The code used is shorthand for doing -

    CWnd* wnd = GetDlgItem(IDC_MSG);
    wnd->ShowWindow(TRUE);

    If you want to learn MFC, you should be familiar with C++ first.
    zen

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    66
    Thanks.

    I do know some C++ but I am having a hard time understanding Classes. I know it makes its own data type and you access it outside the class. But Now that you mention -> accessing it through a pointer I remember reading it. Pointer to Member sorry for wasting time.

    Ryan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I need help to compile this code...
    By wise_ron in forum C Programming
    Replies: 17
    Last Post: 05-07-2006, 12:22 PM
  2. My First If Code, Question? :P
    By dimirpaw in forum C++ Programming
    Replies: 3
    Last Post: 11-29-2005, 08:49 PM
  3. End of Code Loop Question
    By JuanSverige in forum C++ Programming
    Replies: 1
    Last Post: 04-08-2003, 10:35 AM
  4. Replies: 0
    Last Post: 02-21-2002, 06:05 PM
  5. question about my code
    By killerasp in forum C++ Programming
    Replies: 7
    Last Post: 02-18-2002, 08:05 PM