CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Join Date
    Nov 2009
    Posts
    40

    Unhappy change the dilog title at runtime

    Hi, everyone

    I'm using visual c++ with many dialog classes. I want to change the dialog title at runtime. I used the SetWindowText() to do that but it changes also the main window title and I don't want that. Has anyone another idea?

  2. #2
    Join Date
    Nov 2009
    Posts
    40

    Re: change the dilog title at runtime

    Help!!!!!

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: change the dilog title at runtime

    SetWindowText is the right way, but you must call it for the appropriate window.

    Show us your call and maybe we can spot the problem.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: change the dilog title at runtime

    Quote Originally Posted by florivucu View Post
    Help!!!!!
    Don't be childish, have patience for people to answer. We are doing voluntary help here and you should keep that in mind. Don't expect that your questions are answered in 2 minutes.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    Nov 2009
    Posts
    40

    Re: change the dilog title at runtime

    I'm calling the SetWindowText in OnInitDialog() like that:
    if (litera == "E")
    {

    SetWindowText("Estimare");
    // somecode
    }
    else
    SetWindowText("Calcul TUI manual ");

  6. #6
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: change the dilog title at runtime

    Yes, that should change the title of the dialog on whose class you have that code.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  7. #7
    Join Date
    Nov 2009
    Posts
    40

    Re: change the dilog title at runtime

    Yes, but it changes also the main window dialog title. The main window caontains the menu and a map.

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: change the dilog title at runtime

    Quote Originally Posted by florivucu View Post
    I'm calling the SetWindowText in OnInitDialog() like that:
    Code:
                    if (litera == "E")
    That line seems wrong.
    What is litera? Is it a char? If yes - then you should use apostrophes:
    Code:
      if (litera == 'E')
    If it is char array (or char*) then use strcmp function
    Victor Nijegorodov

  9. #9
    Join Date
    Nov 2009
    Posts
    40

    Re: change the dilog title at runtime

    litera it's a char but seems to work ok because it changes the name the way I llike. What I don't like is that it changes the name of the main window, that with the menu.

  10. #10
    Join Date
    Aug 2008
    Posts
    373

    Re: change the dilog title at runtime

    Quote Originally Posted by florivucu View Post
    litera it's a char but seems to work ok because it changes the name the way I llike. What I don't like is that it changes the name of the main window, that with the menu.
    pass the windows handle of appropriate window.Like this
    Code:
    ::SetWindowText(hwnd,"Run Time change");

  11. #11
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: change the dilog title at runtime

    I'm quite confused. Is it possible that you post a screenshot of the window?
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  12. #12
    Join Date
    Nov 2009
    Posts
    40

    Re: change the dilog title at runtime

    I don't have a pointer hwnd for the dialog. I tried to use "this" but I've got a sintax error; using another pointer I've got " the dialog is already opened".
    My application works like that: I have a main window which remanins on top, with the menu. From the menu I'm calling the dialogs. In OnUpdateMyDialog () the dialog is opened and go on with the code. The SetWindowText changes the name of the dialog but it changes also the name of the main window. That's my problem.

  13. #13
    Join Date
    Nov 2009
    Posts
    40

    Re: change the dilog title at runtime

    how can I do that? to add a jpeg?

  14. #14
    Join Date
    Aug 2008
    Posts
    373

    Re: change the dilog title at runtime

    Quote Originally Posted by florivucu View Post
    I don't have a pointer hwnd for the dialog. I tried to use "this" but I've got a sintax error; using another pointer I've got " the dialog is already opened".
    My application works like that: I have a main window which remanins on top, with the menu. From the menu I'm calling the dialogs. In OnUpdateMyDialog () the dialog is opened and go on with the code. The SetWindowText changes the name of the dialog but it changes also the name of the main window. That's my problem.
    ok can you show here code?

  15. #15
    Join Date
    Nov 2009
    Posts
    40

    Re: change the dilog title at runtime

    what exactly do you want to see? the code is too large so....

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured