|
Hi,
I am using a CTreeCtrl control in my application with a Single root node and having severla item.
I want when the CTreeCtrl is displayed the root should be intially be already expanded.
Please tell how to achieve it.
Thanks In Advance.
Dhiraj
|
|
|
|
|
|
Hi! I am asked to code an asynchronous non-blocking echo server in C++ that compiles in both Windows and Unix platforms. Having no background in networking, I don't know where to start. Any help would be appreciated. Thank you.
|
|
|
|
|
Does this[^] help?
Regards,
Sandip.
|
|
|
|
|
Thanks! I have background in C++ but don't have any background in network programming. Can I ask for a tutorial on how to begin coding my project? Any help would be appreciated. Thanks!
modified on Monday, October 20, 2008 10:37 AM
|
|
|
|
|
gamzi wrote: Can I ask for a tutorial
The link page previously provided to you has a "Tutorials" link too!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
Hi! I found this code under the boost c++ libraries. I also read that it is platform independent. Here's the code:
#include < cstdlib>
#include < iostream>
#include < boost/bind.hpp>
#include < boost/asio.hpp>
using boost::asio::ip::tcp;
class session
{
public:
session(boost::asio::io_service& io_service)
: socket_(io_service)
{
}
tcp::socket& socket()
{
return socket_;
}
void start()
{
socket_.async_read_some(boost::asio::buffer(data_, max_length),
boost::bind(&session::handle_read, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
}
void handle_read(const boost::system::error_code& error,
size_t bytes_transferred)
{
if (!error)
{
boost::asio::async_write(socket_,
boost::asio::buffer(data_, bytes_transferred),
boost::bind(&session::handle_write, this,
boost::asio::placeholders::error));
}
else
{
delete this;
}
}
void handle_write(const boost::system::error_code& error)
{
if (!error)
{
socket_.async_read_some(boost::asio::buffer(data_, max_length),
boost::bind(&session::handle_read, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
}
else
{
delete this;
}
}
private:
tcp::socket socket_;
enum { max_length = 1024 };
char data_[max_length];
};
class server
{
public:
server(boost::asio::io_service& io_service, short port)
: io_service_(io_service),
acceptor_(io_service, tcp::endpoint(tcp::v4(), port))
{
session* new_session = new session(io_service_);
acceptor_.async_accept(new_session->socket(),
boost::bind(&server::handle_accept, this, new_session,
boost::asio::placeholders::error));
}
void handle_accept(session* new_session,
const boost::system::error_code& error)
{
if (!error)
{
new_session->start();
new_session = new session(io_service_);
acceptor_.async_accept(new_session->socket(),
boost::bind(&server::handle_accept, this, new_session,
boost::asio::placeholders::error));
}
else
{
delete new_session;
}
}
private:
boost::asio::io_service& io_service_;
tcp::acceptor acceptor_;
};
int main(int argc, char* argv[])
{
try
{
if (argc != 2)
{
std::cerr << "Usage: async_tcp_echo_server <port>\n";
return 1;
}
boost::asio::io_service io_service;
using namespace std; // For atoi.
server s(io_service, atoi(argv[1]));
io_service.run();
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}
I'm having a hard time understanding this code. Can someone familiar with this code help me out in understanding how the code works? Really sorry because I'm not really familiar with network programming. Thank you.
|
|
|
|
|
I am not clear as to whether you always need to declare a session class to be able to use asynchronous read and write functions? And also I'm not really that clear about the flow of the program. Thank you and any help would be appreciated.
|
|
|
|
|
|
Hi All!
I'm creating a project and i'd like someone to tell me a way to change multiple controls properties
(ie: Enable, Display, Change texts ...) whenever i click on different tree items.
Is it ok to use EnumChildWindows?
Or is there any other method?
Thanks for any reply!
|
|
|
|
|
Dennis L wrote: Is it ok to use EnumChildWindows?
It depends on your requirement.
If you want to modify less number of controls you can add the control variables for these controls and use them.
EnumChildWindows will enumerate all the child controls which might not be efficient if your dialog has huge number of controls and you need to alter only 4-5.
BTW: Use some relevant title for your post.. "Hi All" does not relate to your query in anyway.
Regards,
Sandip.
|
|
|
|
|
Hello everyone,
I am learning how to use WinHttp to do .Net Passport based authentication. I read a couple of documents, like this,
http://msdn.microsoft.com/en-us/library/aa384067.aspx[^]
my question is I want to find some external web site to do more testing, i.e. to request to access some Url, and if supply with the correct .Net Passport credential, the authentication will pass, if not the authentication will not pass. My confusion is I tried some ones, but seems are all Http Forms based authentication.
Could anyone suggest some web sites?
thanks in advance,
George
|
|
|
|
|
I need to have a dialog and a doc/view and be able to communicate between both. I've started this by creating a project with both the doc/view & dialog in it, and then including the headers of the doc/view in the dialog project. I've loaded a dialog from a dialog as shown below:
PortFrm Dlg(CWnd::FromHandle(m_hWnd));
Dlg.DoModal();
I need to do the same with a document/view project. The furthest I've gotten is to call the exe file of the document/view, but that makes inter-communication difficult. Any suggestions are welcome. Thank you in Advance!
|
|
|
|
|
Mark Gilson wrote: I need to do the same with a document/view project.
If you have an SDI or MDI project, you can do the same.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Well, obviously not exactly the same due to the fact that it's a doc/view instead of a dialog. Care to be a bit more detailed...I do agree that I should be able to do the same thing with a doc/view, but my question was how.
|
|
|
|
|
Mark Gilson wrote: Care to be a bit more detailed...I do agree that I should be able to do the same thing with a doc/view, but my question was how.
By using the same two lines of code you showed. Where you put those depends on when you want the dialog to be displayed (e.g., in response to a button click, or menu selection).
Use AppWizard to create an SDI project with an About box. Look at the code generated to see how that modal dialog is displayed.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Document/View....not a dialog. I can't use the same code as shown above...because the second window I want to call is a document/view. Am I missing something? Last I checked Dlg is not CView? Should I change Dlg to CView?
|
|
|
|
|
Creating an SDI or MDI project and adding a dialog to it is way easier than creating a dialog project and adding doc/view to it. Have you considered switching?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
It would be a last resort. I can use the code posted previously to open the dialog (main application) from the doc/view (secondary app), but what happens when the user closes the doc/view window and wants to re-open it? I try not to force a design around a handicap if I don't have to, so for now, lets just say that I'd still like to learn how to open Doc/View from Dialog. I appreciate your suggestions so far.
|
|
|
|
|
Mark Gilson wrote: ...but what happens when the user closes the doc/view window and wants to re-open it?
Isn't that how apps work already?
Mark Gilson wrote: I try not to force a design around a handicap...
What handicap?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Alright, so your suggestion is to use the doc/view to open the dialog. I then stated that this is not what I would like to do (as suggested by the subject). If you have an answer to my question "how do you open a doc/view window from a dialog", I'm all ears.
|
|
|
|
|
|
This is why MFC is disappointing. I guess I'll call the dialog from the doc/view.
|
|
|
|
|
Hi all,
I m using a DateTimePicker, and use CDateTimeCtrl and COleDateTime type varible for this.
i want to increase a date by one day,is it possible.
If yes please tell me .
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|