PercentDone callback counts as an AbortCheck

Question: “I’ve got the Chilkat C++ libs linked with my project, and am using the HTTP classes successfully. One thing is confusing me, though. I’ve derived a class from CkHttpProgress.h and overridden AbortCheck(…) to provide cancellation support. However, AbortCheck(…) never gets called. At first, I thought perhaps the HTTP retrieval was occurring too quickly, so I set the “HeartbeatMs” property to “1”, and it […]

Encryption Progress Monitoring

Question: Is there a way to encrypt a file with progress monitoring?  Huge files can take a while and it seems like the app is hanging. Answer: Yes, here is the sample VB6 code: Public WithEvents myCrypt As ChilkatCrypt2 ‘ …. Private Sub myCrypt_PercentDone(ByVal pctDone As Long) ProgressBar1.Value = pctDone End Sub Private Sub Command2_Click() Set myCrypt = New ChilkatCrypt2 […]

Aborting in C++

The technique for aborting any time-consuming Chilkat C++ method call follows this recipe: Declare your own class that derives from the appropriate Chilkat progress monitoring class.  For CkMailMan it is CkMailManProgress (as shown below).  For other Chilkat classes it is CkHttpProgress, CkFtpProgress, CkImapProgress, CkZipProgress, etc. Create an implementation for the AbortCheck method.  This will override the default implementation from the […]

HTTP Progress Monitoring in C++

This blog post shows how to monitor the progress of HTTP uploads and downloads in C++.  The first step is to create a C++ callback class that derives from the CkHttpProgress base class.  You’ll be overriding one or more of the callback methods.  For example: class MyHttpProgress : public CkHttpProgress { public: MyHttpProgress(void) { } virtual ~MyHttpProgress(void) { } void […]

SFTP Progress Monitoring and Abort (C#)

Here is an example for monitoring the progress of an SFTP file transfer: void sftp_OnPercentDone(object sender, Chilkat.PercentDoneEventArgs args) { progressBar1.Value = args.PercentDone; // To abort at any point, you may set args.Abort = true // args.Abort = true; } void sftp_OnAbortCheck(object sender, Chilkat.AbortCheckEventArgs args) { // See https://cknotes.com/?p=149 for more information about // using the AbortCheck event… } private void […]

SFTP Upload in VB6 with Progress Monitoring

The PercentDone event is called when the percentage completion increases by one or more points.  To use events in VB6, Dim the variable WithEvents.  Then name the event callback using the variable name.  (You should already understand how to use VB6 events in general prior to using the Chilkat objects.  A good VB6 book is “Programming Visual Basic 6.0” by […]

VB.NET HTTP Download with percent-done progress monitoring

Here is an example: Dim WithEvents http As Chilkat.Http Private Sub http_OnPercentDone(ByVal sender As Object, ByVal args As Chilkat.PercentDoneEventArgs) Handles http.OnPercentDone ProgressBar1.Value = args.PercentDone End Sub Private Sub HttpDownloadTest() http = New Chilkat.Http() Dim success As Boolean ‘ Any string unlocks the component for the 1st 30-days. success = http.UnlockComponent(“Anything for 30-day trial”) If (success True) Then MsgBox(http.LastErrorText) Exit Sub […]

AbortCheck Event in Chilkat .NET Components

The AbortCheck event is standard in Chilkat .NET classes that involve communications over sockets (FTP, POP3, SMTP, IMAP, HTTP, etc.) or time-consuming operations such as zipping/unzipping large files. There are three steps to using AbortCheck: 1. Enable event callbacks by setting the EnableEvents property = true. Chilkat.MailMan mailman = new Chilkat.MailMan(); mailman.EnableEvents = true; 2. Set the HeartbeatMs property. The […]

ActiveX Events IDL for (some but not all) Chilkat Components

SFtp: dispinterface _IChilkatSFtpEvents { properties: methods: [id(1), helpstring(“method PercentDone”)] HRESULT PercentDone([in] long pctDone); [id(2), helpstring(“method AbortCheck”)] HRESULT AbortCheck([out] long *abort); [id(3), helpstring(“method UploadRate”)] HRESULT UploadRate([in] long byteCount, [in] long bytesPerSec); [id(4), helpstring(“method DownloadRate”)] HRESULT DownloadRate([in] long byteCount, [in] long bytesPerSec); }; Zip: dispinterface _IChilkatZip2Events { properties: methods: HRESULT UnzipPercentDone([in] long percentDone, [out] long *abort); HRESULT WriteZipPercentDone([in] long percentDone, [out] long […]