Login  
Search All Forums
Dart Home | PowerTCP FTP for ActiveX | Custom Development Reply | PowerTCP FTP for ActiveX Topics | Forums   
AuthorForum: PowerTCP FTP for ActiveX
Topic: Run Time Problems in C++
noostven
nicko@hpmarketing.com

From: Surrey, BC Canada
Posts: 3
Member Since: 05/24/02
posted May 24, 2002 2:07 PM

I am currently developing an application is Visual C++ using the Ftp tool and have run into a run time problem which has me stumped. In this application I have all of the Ftp functionality in a CConnection class, and have a seperate CDownloadDlg containing current download status, etc. The dialog class is automatically created in CConnection's consturctor and is given a pointer back to the CConnection object.

I have successfully gotten the dialog to display all current progress, but have run into a wall when attempting to implement a cancel button in the CDownloadDlg class. Basically, the cancel button only needs to call the pFtp->Abort() function, which I have encapsulated in an identically named function in CConnection.

The problem is that as soon as I try to do this I get a run time memory access error. My first thought was that the pointer was not valid, however I can use it to call any function in the CConnection class as long as it does not make any calls to pFtp. As soon as I use the pointer to call function which contains a reference to pFtp the application crashes, even though these functions work without problems when called from other classes.

I was even able to successfully call the Abort function from the class which actually creates the CConnection object through the various pointers and it worked just fine. ie. LiveSite.m_pDownDlg->m_pConnection->Abort(); where m_pConnection is pointing to LiveSite.

The only time that I seem to get errors is when calling functions which access IFtp, and then it's only when calling them through the CDownloadDlg class. Additionally the specific error message I get depends on when during the download process I press the cancel button.

Any help would be greatly appreciated.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted May 24, 2002 2:29 PM

Hi,
Well first, are you sure you even want to call Abort? You indicate this is during a download. If you are looking to cancel a file transfer, you should use AbortCommand, not Abort. Does this work for you?
Thanks,
-ken
noostven
nicko@hpmarketing.com

From: Surrey, BC Canada
Posts: 3
Member Since: 05/24/02
posted May 24, 2002 2:47 PM

Hi Ken,

I called Abort() because I was initially using the GetSite example for reference, and the Abort button in this case calls Abort. I tried AbortCommand, which I now realize is the proper function to use, however I am still getting run time errors.

I should also point out that I get run time errors when trying to use a function which calls ANY functions through pFtp. I even tried changing the handler for the dialogs "Cancel" button to simply connect to and disconnect from the server but this also resulted in a run time error.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted May 24, 2002 3:16 PM

Hi,
I'm afraid this is too advanced a problem for me to help you with on the forum. 

I recommend considering one of our paid support options. With Priority Support, we can better help you by providing access to an experienced VC++ developer, as well as examination of your code. Please contact us at support@dart.com.
Thanks,
-ken
noostven
nicko@hpmarketing.com

From: Surrey, BC Canada
Posts: 3
Member Since: 05/24/02
posted May 24, 2002 7:03 PM

Hi Ken,

I believe that I've found a work-around for the problem I was facing so I thought I'd post it here in case anyone else has similar troubles. Even so, I'm still not quite sure if it was originally a logic error on my part, or if it's a problem with the control which was causing the crashes.

I discovered that changing the application's structure so that the Connection class was a member of the Dialog class (with a pointer in the Connection class back to the Dialog) works. Previously I had it set up the other way around. Nothing else in my code changed, but this allowed the pFtp functions to execute without crashing the application.
Reply | PowerTCP FTP for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX