visual c++ question

This is a discussion on visual c++ question within the Windows Programming forums, part of the Platform Specific Boards category; I've made a dialog based mfc application and was wondering how I could change the caption of the dialog window. ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    291

    visual c++ question

    I've made a dialog based mfc application and was wondering how I could change the caption of the dialog window.

    If I goto properties on the dialog window it has id = IDD_SOCKET_DIALOG

    Any help would be great

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    In the MSVC environment you can simply right click on the dialog and select properties then type the caption you want it to have in the 'caption' box on the 'general' tab of the 'dialog properties' dialog box.
    The other option is to do it programatically using the CWnd::SetWindowText() function.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Originally posted by LuckY
    The other option is to do it programatically using the CWnd::SetWindowText() function.
    Code:
    CString name = "hello";
    CWnd::SetWindowText(name);
    gives me "'CWnd::SetWindowTextA' : illegal call of non-static member function" What does that mean ?

  4. #4
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Sorry yo. That's not how you use it. By writing CWnd::SetWindowText() I was just showing you that the function is a member of the CWnd class.
    If you are calling the function from inside your dialog class (ie: class C...Dlg) you can just say:
    Code:
    SetWindowText("Title");
    To call it for another window, for example an edit box with id IDC_EDIT:
    Code:
    GetDlgItem(IDC_EDIT)->SetWindowText("Blah");
    For any window with a handle to it:
    Code:
    ::SetWindowText(hwnd, "Stuff");
    I'm sure this is too much information for you, but you seem very new to MSVC, and it will come into play eventually.

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Thanks for your help.

    Code:
      SetWindowText("Title");
    Did the trick and yes, I started using msvc a about a week ago so Im rather new at it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual Basic Question?
    By ob1cnobe in forum C++ Programming
    Replies: 2
    Last Post: 07-03-2002, 09:31 AM
  2. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM
  3. Curios Visual C++ .NET question.
    By Progmammer in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2002, 01:29 PM
  4. Visual Studio C Question
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 11-29-2001, 01:33 AM
  5. Question about visual C++
    By skyrabbit in forum C++ Programming
    Replies: 2
    Last Post: 11-27-2001, 12:10 PM

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