Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi,

My question is simple, it just to make a simple chat program, via web instead of using server/clients. However, it could be using the following URL:

http://www.sbox.ws/sbox_ws.php?name=Name&website=&shoutid=1b867wq7jorwwf4u0qwk

I mean by this above, this site has button, named submit and the small text for entering the message then for submit the text as chat program exactly :

In c++, I got the following codes:
C++
#include "afxinet.h" 

BOOL DoSubmitURLText(const char *url, CString &errorMessage) { 
TCHAR szCause[255]; errorMessage = "OK"; 
TRY { 
CInternetSession session; 
session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 1000); session.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 3); 
session.OpenURL(url, 1 ,INTERNET_FLAG_TRANSFER_ASCII |INTERNET_FLAG_FORMS_SUBMIT); }
 CATCH_ALL(error)
 { 
error->GetErrorMessage(szCause,254,NULL); 
errorMessage.Format("%s",szCause); 
return FALSE; 
} END_CATCH_ALL; 
return TRUE; 
}


In OpenURL, has the function for open this URL, without open it in the browser.

I mean, by I would like to make this action, by sending also the message via that website(shoutbox above ) also to submit it.

Is there any codes in c++ for control this ? adding or modified something ?

Thank in advance!
Posted

1 solution

Instead of trawling the web for random code, start from the top. A simple chat program, via the web, is probably going to be in a browser. Therefore, you'd write it using a back end like ASP.NET, and with lots of javascript/AJAX to handle the chatting.
 
Share this answer
 
Comments
skonliner 3-Aug-12 18:59pm    
Yes, it could be. But I mean by using it in c++ program application, and it controls that web site. by using it as sub party. means what, using the codes are actually within c++ application. but non using by any server/clients applications. SO, the messages are reaching at short times easily instated of stupid messages for accepting and receiving messages for communication and perhaps, fails connections between the server and clients.
Christian Graus 3-Aug-12 19:02pm    
Basically you'd need to write code to send and receive pages the way a browser does, and then parse them in order to send and receive the data that the browser collects in the UI. This is obviously more complex than writing a web page, where half of it is done for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900