Is there a way to construct CFtpConnection object from a existed HINTERNET handle?
-
I don't want to pass the CFtpConnection* pointer to a thread proc because that may be dangerous. Although I can get the handle of the FTP connection from the (HINTERNET) operation, I cannot construct a CFtpConnection object from the handle I've got because there's no such function. What should I do? Please help me out. :( Thanks in advance. Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.
-
I don't want to pass the CFtpConnection* pointer to a thread proc because that may be dangerous. Although I can get the handle of the FTP connection from the (HINTERNET) operation, I cannot construct a CFtpConnection object from the handle I've got because there's no such function. What should I do? Please help me out. :( Thanks in advance. Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.
I don't know anything about these classes, but I've decided to look into your problem as it appears to be more of a C++ issue than anything else. The MFC header file for CFtpConnection shows that the class has a couple of constructors. The one you would probably use looks like this:
CFtpConnection(CInternetSession* pSession, HINTERNET hConnected, LPCTSTR pstrServer, DWORD dwContext);
Again, I don't know anything about these parameters but the second one looks like the one you'd be passing from the other thread. If this doesn't work I'd suggest you to derive a class from CFtpConnection. Since m_hConnection is protected in CInternetConnection, you'd have access to it in your derived class. Good luck! Alvaro
-
I don't know anything about these classes, but I've decided to look into your problem as it appears to be more of a C++ issue than anything else. The MFC header file for CFtpConnection shows that the class has a couple of constructors. The one you would probably use looks like this:
CFtpConnection(CInternetSession* pSession, HINTERNET hConnected, LPCTSTR pstrServer, DWORD dwContext);
Again, I don't know anything about these parameters but the second one looks like the one you'd be passing from the other thread. If this doesn't work I'd suggest you to derive a class from CFtpConnection. Since m_hConnection is protected in CInternetConnection, you'd have access to it in your derived class. Good luck! Alvaro
Thank you very much!:-D Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.