Home Forums ActiveX components Xceed FTP for ActiveX Runtime Error when MFC app exits

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #42674 |

    Hi All,

    Im trying to use the XCeedFTP component in MFC. I have added the control from the Add To Project->Registered ActiveX. Ive Inserted it. two files xceedftp.cpp and xceedftp.h are created. Now im creating the control as follows

    CXceedFTP* pXceedFtp;
    pXceedFtp = new CXceedFTP;
    pXceedFtp->Create(“”,””,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),AfxGetMainWnd(),IDR_XCEEDFTP,NULL);

    pXceedFtp->License(“”);
    pXceedFtp->SetServerAddress(lpszServerAddress);
    pXceedFtp->SetUserName(lpszUserName);
    pXceedFtp->SetPassword(lpszPassword);
    pXceedFtp->SetServerPort(iPort);
    try
    {
    m_pXceedFtp->Connect();
    AfxMessageBox(m_pXceedFtp->GetCurrentFolder());
    m_pXceedFtp->Disconnect();
    }
    catch(…)
    {
    AfxMessageBox(“Error connecting to FTP Server.”);
    }

    ..

    Now when I try to exit the application crashes. Can anybody help me.

    Imported from legacy forums. Posted by Gaurav (had 5045 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello Gaurav.

    There is something strange in your code. You create a local variable “pXceedFtp”, but are using a member variable “m_pXceedFtp” to connect and disconnect. Are you mixing a locally created instance, and one dropped on a form?

    Imported from legacy forums. Posted by Martin (had 308 views)

    User (Old forums)
    Member
    Post count: 23064

    Yes Martin,

    the code which i stated is just a pseudo representation of my code… to be clear i have put

    the actual code … here it goes

    // Connection Handler is responsible to connect/disconnet and is a Generic MFC class
    // m_pXceedFtp component is member variable of ConnectionHandler

    CConnectionHandler::CConnectionHandler()
    {
    m_pXceedFtp = new CXceedFtp;
    }

    CConnectionHandler::~CConnectionHandler()
    {
    if(m_pXceedFtp)
    {
    m_pXceedFtp->DestroyWindow();
    delete m_pXceedFtp;
    }
    }

    CConnectionHandler::Connect(LPCSTR lpszServerAddress, LPCSTR lpszUserName, LPCSTR lpszPassword, int iPort)
    {
    m_pXceedFtp->Create(“XCeedFTP”,””,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),AfxGetMainWnd(),IDR_XCEEDFTP,NULL);
    m_pXceedFtp->License(“”);
    m_pXceedFtp->SetServerAddress(lpszServerAddress);
    m_pXceedFtp->SetUserName(lpszUserName);
    m_pXceedFtp->SetPassword(lpszPassword);
    m_pXceedFtp->SetServerPort(iPort);

    try
    {
    m_pXceedFtp->Connect();
    }

    catch(CException *e)
    {
    e->ReportError();
    e->Delete();
    }
    }

    CXceedFtp* CConnectionHandler::GetFTPCtrl()
    {
    return m_pXceedFtp;
    }

    BOOL CConnectionHandler::Disconnect()
    {
    try
    {
    m_pXceedFtp->Disconnect();
    }
    catch(CException *e)
    {
    e->ReportError();
    e->Delete();
    }
    }

    /// Here is the main function being called whenever I right-click on the Apps- View

    void CXCeedsampleView::OnRButtonDown(UINT nFlags, CPoint point)
    {
    // TODO: Add your message handler code here and/or call default
    CConnectionHandler* pConnection;
    pConnection = new CConnectionHandler;
    pConnection->Connect(“ftp.mydesk.net”,”justtry”,”tryit”);
    CXceedFtp* pXceedFTP = pConnection->GetFTPCtrl();

    AfxMessageBox(pXceedFTP->GetCurrentFolder());

    pConnection->Disconnect();
    delete pConnection;
    CView::OnRButtonDown(nFlags, point);
    }

    Everything works fine but when i exit my app crashes leaving an exception

    ” First-chance exception in XCeed sample.exe (NTDLL.DLL): 0xC0000008: Invalid Handle. “

    Debug Status:

    NTDLL! 77f7592b()
    7ffe0304()
    OSMIM! 10002986()
    WS2_32! 71ab1bc3()
    XCEEDFTP! 67990b52()

    If u try to understand my bad code …. I have created the component at runtime locally connected to FTP, executed GetCurrFolder and Disconnected.. finally deleted the objects….. So whats the prblm.

    Thanks for ur support !

    Imported from legacy forums. Posted by Gaurav (had 429 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello Gaurav.

    Can you send your application’s sources to <mail>support@xceedsoft.com</mail>, including the XCEEDFTP.DLL version number you are using, and a copy of your post? This will help us track where that first-chance exception is coming from.

    Thank you.

    Imported from legacy forums. Posted by Martin (had 4727 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.