Thread: MessageBox, changing text.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    What you have done there is correct so far, but it will only change the title of the message box , and the problem is that your program state is paused until the ok button is pressed on the created message box. This is why all of your findwindow() e.t.c code will have to go in a seperate thread i think, i would give you some code for the thread but i cant rembmer how to do them properly. But heres some code for how you would change the main meassage rather than the title.

    Code:
    HWND h_msgbox;
    HWND h_msgbox_text;
    
    h_msgbox = FindWindow(0, "Test Title");
    
    if(h_msgbox != NULL)
    {
    // window found now get the static text handle to change.
    
    // Im not sure as i dont have a compiler but you probably have to use the SetParent() function here, so it searchs the parent HWND for the child HWND.
    
    h_msgbox_text = FindWindow(0, "Message Box Text");
    
    if(h_msgbox_text != NULL)
    {
    SetWindowText(h_msgbox_text, "New Text");    
    }
    
    else
    {
    // child error
    }
    
    
    }
    
    else
    {
    // error
    }
    I think thats correct, but you will need to put the code after the message box creation in a seperate thread. Hope thats some help.
    Last edited by (TNT); 01-16-2006 at 08:58 AM.
    TNT
    You Can Stop Me, But You Cant Stop Us All

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  2. Replies: 3
    Last Post: 05-25-2005, 01:50 PM
  3. Read word from text file (It is an essay)
    By forfor in forum C Programming
    Replies: 7
    Last Post: 05-08-2003, 11:45 AM
  4. Changing the Console text back to black
    By Unregistered in forum C++ Programming
    Replies: 11
    Last Post: 07-12-2002, 08:11 AM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM