Archived Forum Post

Index of archived forum posts

Question:

Chilkat FoxPro Events (.prg event classes)

Sep 06 '16 at 13:30

I wrote some code to generate FoxPro .prg templates for the ActiveX events. They are available here: http://chilkatdownload.com/chilkat_foxpro_prg.zip

Note: This was updated for v9.5.0.58 on 7-Jul-2016. The TextData and BinaryData events are new and must be present. However, they are not yet called by anything in this version. These events are added to pave the way for future functionality..

An example of the Ftp2 events is shown here:

ftp2EventHandler = CREATEOBJECT("MyFtp2Events")
loFtp2 = CreateObject("Chilkat_9_5_0.Ftp2")
EVENTHANDLER(loFtp2,ftp2EventHandler)

DEFINE CLASS MyFtp2Events AS SESSION OLEPUBLIC IMPLEMENTS _IChilkatFtp2Events IN "Chilkat_9_5_0.Ftp2"

PROCEDURE _IChilkatFtp2Events_AbortCheck(abort As Number) ? "AbortCheck" ENDPROC

PROCEDURE _IChilkatFtp2Events_BeginDownloadFile(path As String, nSkip As Number) ? "BeginDownloadFile" ENDPROC

PROCEDURE _IChilkatFtp2Events_BeginUploadFile(path As String, nSkip As Number) ? "BeginUploadFile" ENDPROC

PROCEDURE _IChilkatFtp2Events_BinaryData(data As Variant) ? "BinaryData" ENDPROC

PROCEDURE _IChilkatFtp2Events_DownloadRate(byteCount As Number, bytesPerSec As Number) ? "DownloadRate" ENDPROC

PROCEDURE _IChilkatFtp2Events_EndDownloadFile(path As String, byteCount As Number) ? "EndDownloadFile" ENDPROC

PROCEDURE _IChilkatFtp2Events_EndUploadFile(path As String, byteCount As Number) ? "EndUploadFile" ENDPROC

PROCEDURE _IChilkatFtp2Events_PercentDone(pctDone As Number, abort As Number) ? "PercentDone" ENDPROC

PROCEDURE _IChilkatFtp2Events_ProgressInfo(name As String, value As String) ? "ProgressInfo" ENDPROC

PROCEDURE _IChilkatFtp2Events_TaskCompleted(task As Generic) ? "TaskCompleted" ENDPROC

PROCEDURE _IChilkatFtp2Events_TextData(data As String) ? "TextData" ENDPROC

PROCEDURE _IChilkatFtp2Events_UploadRate(byteCount As Number, bytesPerSec As Number) ? "UploadRate" ENDPROC

PROCEDURE _IChilkatFtp2Events_VerifyDeleteDir(path As String, nSkip As Number) ? "VerifyDeleteDir" ENDPROC

PROCEDURE _IChilkatFtp2Events_VerifyDeleteFile(path As String, nSkip As Number) ? "VerifyDeleteFile" ENDPROC

PROCEDURE _IChilkatFtp2Events_VerifyDownloadDir(path As String, nSkip As Number) ? "VerifyDownloadDir" ENDPROC

PROCEDURE _IChilkatFtp2Events_VerifyUploadDir(path As String, nSkip As Number) ? "VerifyUploadDir" ENDPROC

ENDDEFINE


Answer

Please post here if you find any mistakes or problems.


Answer

Thank you a lot, but i have your source originaly used and got error: Interface _CHILKATFTP2EVENTS not found

I tried IMPLEMENT as you: IMPLEMENTS _ChilkatFtp2Events IN "Chilkat_9_5_0.Ftp2" and IMPLEMENTS _ChilkatFtp2Events IN "E:VFPTOOLSChilkatAx-9.5.0-win32ChilkatAx-9.5.0-win32.dll" no success

The ChilkatActiveXCehck is ok: CLSID: {32BD32D3-66EA-4EE6-A684-20CE86F757C1} DLL path: E:VFPTOOLSChilkatAx-9.5.0-win32ChilkatAx-9.5.0-win32.dll Chilkatversion: 9.5.0.56

The key problem seems to be the IMPLEMENT, but I have absolut no idea where...

but.. thanx again for first help

Stefan


Answer

I'm sorry for the mistake -- it should be "_IChilkatFtp2Events". The "I" was missing. I'm going to regenerate all of the .prg files and re-upload. I'm also going to edit the original post here to include the "I".

Also.. most Chilkat classes only use the standard events: AbortCheck, PercentDone, ProgressInfo, TaskCompleted. In fact, all future Chilkat classes will only use standard events. The .prg files for the classes that use standard events also were in error. I'll post here when the new build is ready.


Answer

OK.. the .prg code generation was fixed and the new .prg files are uploaded to http://chilkatdownload.com/chilkat_foxpro_prg.zip


Answer

Thank you for posting this. I tried the HTTP events class doing a QuickGetStr call and ran into the following issues with Http being added to certain event names:

There are other events that have HTTP in front of them, but they did not error out for me - might want to double-check.

Also

Thanks, Andy


Answer

Here is what I came up with for HTTP. All this seems to work fine. Again, I didn't know the BeginSend parameters so I added these as X and Y:

DEFINE CLASS MyHttpEvents AS SESSION OLEPUBLIC
IMPLEMENTS _IChilkatHttpEvents IN "Chilkat_9_5_0.Http"

PROCEDURE _IChilkatHttpEvents_AbortCheck(abort AS Number) AS VOID
    ? "AbortCheck"
ENDPROC

PROCEDURE _IChilkatHttpEvents_PercentDone(percent AS Number, abort AS Number) AS VOID
    ? "PercentDone"
ENDPROC

PROCEDURE _IChilkatHttpEvents_ProgressInfo(name AS STRING, value AS STRING) AS VOID
    ? "ProgressInfo"
ENDPROC

PROCEDURE _IChilkatHttpEvents_BeginReceive() AS VOID
    ? "BeginReceive"
ENDPROC

PROCEDURE _IChilkatHttpEvents_EndSend(success AS Number) AS VOID
    ? "EndSend"
ENDPROC

PROCEDURE _IChilkatHttpEvents_EndReceive(success AS Number) AS VOID
    ? "EndReceive"
ENDPROC

PROCEDURE _IChilkatHttpEvents_HttpChunked() AS VOID
    ? "HttpChunked"
ENDPROC

PROCEDURE _IChilkatHttpEvents_HttpRedirect(originalUrl AS STRING, newUrl AS STRING, abort AS Number) AS VOID
    ? "HttpRedirect"
ENDPROC

PROCEDURE _IChilkatHttpEvents_BeginSend(x AS Number, y AS Number) AS VOID
    ? "BeginSend"
ENDPROC

PROCEDURE _IChilkatHttpEvents_ReceiveRate(byteCount AS Number, bytesPerSec AS Number) AS VOID
    ? "ReceiveRate"
ENDPROC

PROCEDURE _IChilkatHttpEvents_TaskCompleted(task AS VARIANT) AS VOID
    ? "TaskCompleted"
ENDPROC

ENDDEFINE

Answer

Thanks! I'm sorting this out and will fix and re-upload the .zip containing the .prg files.

One note: The standard Chilkat events are: AbortCheck, PercentDone, ProgressInfo, and TaskCompleted. All future Chilkat classes will only use the standard events. (Perhaps in the future, more standard events will be added, and if so, they would apply across-the-board to all classes.) Eventually, the non-standard events will be replaced by standard events. For example, instead of a custom BeginReceive event, it will be a ProgressInfo event w/ the name "BeginReceive". There will be a period of time where this is noted in the documentation, and also where the BeginReceive is fired both as a ProgressInfo and as the custom event.


Answer

Thank you. I don't have an immediate need for implementing these events - just exploring for now. I appreciate the continued support for Foxpro!

Andy


Answer

I made the fix and re-uploaded the .zip containing the .prg files.

I did not find that the BeginSend should have 2 args. According to everything I see, it should be 0 args. (I know it's possible I'm incorrect, but I just haven't discovered how yet..)

Here's what the IDL for the HTTP events looks like:

    // _IChilkatHttpEvents
    [
        uuid(A02D931E-49CC-4D6F-85F5-2D74AB061990),
        helpstring("_IChilkatHttpEvents Interface v9.5.0")
    ]
    dispinterface _IChilkatHttpEvents
    {
        properties:
        methods:
            [id(1), helpstring("method AbortCheck")] HRESULT AbortCheck([out] long* abort);
            [id(2), helpstring("method PercentDone")] HRESULT PercentDone([in] long percent, [out] long* abort);
            [id(3), helpstring("method ProgressInfo")] HRESULT ProgressInfo([in] BSTR name, [in] BSTR value);
        [id(4), helpstring("method BeginReceive")] HRESULT BeginReceive();
        [id(5), helpstring("method EndSend")] HRESULT EndSend([in] long success);
        [id(6), helpstring("method EndReceive")] HRESULT EndReceive([in] long success);
        [id(7), helpstring("method HttpChunked")] HRESULT HttpChunked();
        [id(8), helpstring("method HttpRedirect")] HRESULT HttpRedirect([in] BSTR originalUrl, [in] BSTR newUrl, [out] long *abort);
        [id(9), helpstring("method BeginSend")] HRESULT BeginSend();
        [id(10), helpstring("method ReceiveRate")] HRESULT ReceiveRate([in] long byteCount, [in] long bytesPerSec);
            [id(20), helpstring("method TaskCompleted")] HRESULT TaskCompleted([in] IChilkatTask *task);
    };

Answer

Right. I don't see anything supporting the args either, but when I implement the events with HTTP.QuickGetStr I get the error "No Parameter Statement is Found" when the BeginSend fires. And when I add the two args there is no error.

Andy