Jump to content
  • Advertisement
Sign in to follow this  
Quan Chi2

Displaying server messages in text box?

This topic is 3768 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm making an IRC bot GUI and I want to display server messages I receive in a text box. How do I do this? I've already made a bot that recv()'d the messages and printed them in a console window(this was the console-based bot), but now I want to make those same messages display in the text box. Please help. I don't know Win32API well.
        do
        {
            recv(connection,buf,512,0);
            if (strncmp("PING", buf, 4) == 0)
            {
                printf("[-]Received PING... Sending PONG\n"); //This is what I want to be displayed in the text box...
                buf[1] = 'O';
                send(connection, buf, strlen(buf), 0);
            }
            if (strncmp("End of /MOTD command.", buf, sizeof(buf)))
            {
                send(connection,channel,strlen(channel),0);
                Sleep(1000);
            }
            printf("\n%s \n\n", buf, connection);  //This is what I want to be displayed in the text box...
        }while(1);
Thanks for the help.

Share this post


Link to post
Share on other sites
Advertisement
SetWindowText() (Or SetDlgItemText() if you're using dialogs) will set the text for a window - I.e. your text box child window.

EDIT:
If you want to append text, that's a little more involved - you can either buffer what you're sending, or insert text at the end of the control, by setting the selection to the end of the text with EM_SETSEL, then replacing it with your new text with EM_REPLACESEL

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
SetWindowText() (Or SetDlgItemText() if you're using dialogs) will set the text for a window - I.e. your text box child window.

EDIT:
If you want to append text, that's a little more involved - you can either buffer what you're sending, or insert text at the end of the control, by setting the selection to the end of the text with EM_SETSEL, then replacing it with your new text with EM_REPLACESEL


Thanks for the help, Steve. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!