Changing title after window is created

This is a discussion on Changing title after window is created within the Windows Programming forums, part of the Platform Specific Boards category; How do I change the title after my window has been created?...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    73

    Changing title after window is created

    How do I change the title after my window has been created?

  2. #2
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Code:
    SetWindowText(hwnd, szTitle);
    For instance here is a function example that performs the task I believe you are looking for.

    Code:
    void setWindowCaption(HWND hwnd, TCHAR* szTitle) {
    
          TCHAR * szCaption[MAX_PATH + 64]
      
           wsprintf(szCaption, TEXT("%s - %s"), TEXT("TextEditor"),
                         szTitle[0] ? szTitle : TEXT("Untitled"));
    
           SetWindowText(hwnd, szCaption);
    }
    happy coding!!!!
    Last edited by andyhunter; 01-02-2005 at 05:45 PM.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  2. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 09:23 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM

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