Archived Forum Post

Index of archived forum posts

Question:

task object creation fails - ActiveX async method

May 20 '16 at 11:47

I'm trying the vbscript codes like below.

Set task = sftp.UploadFileByNameAsync(targetpath, localpath)
rc = task.Run()
curPctDone = 0

Do While task.Finished <> 1 If (task.PercentDone <> curPctDone) Then curPctDone = task.PercentDone f.WriteLine(curPctDone & " % done") End If task.SleepMs 100 Loop

Set task = http.DownloadAsync(targetUrl, localPath) rc = task.Run() Do While task.Finished <> 1 count = task.PercentDone

Call progressBarDisp(count)
Wscript.Sleep 100

Loop

Although the vbscript code, the version of Chilkat ActiveX (9.5.0.55), and unlock code are identically the same, the above codes work on a PC (Windows 10), but not in others (Windows 10 and Windows 7). In the latter PCs, where http and sftp and other Chilkat ActiveX functions, at least excpet async methods, are working fine, task object creation (Set task = ...) fails.

I tried new version, 9.5.0.56, but the result was the same. What's the problem? What should I check?

sftp.LastErrorText reads,

ChilkatLog:
  ActiveXError:
    DllDate: Mar 11 2016
    ChilkatVersion: 9.5.0.56
    UnlockPrefix: 
    Username: 
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    Cannot get ActiveX Interface
  --ActiveXError
--ChilkatLog


Answer

Is it possible the Chilkat Active DLL is located on a non-local hard drive?

You might try re-registering the ActiveX DLL to see if that fixes it.

Internally,when an ActiveX method returns an instance of another object, that object is created in the internal C++ code via CoCreateInstance in a very standard/simple way:

    IChilkatTask *iObj = 0;

HRESULT hr = CoCreateInstance(CLSID_ChilkatTask,
    NULL,CLSCTX_INPROC_SERVER,
    IID_IChilkatTask,
    (void **)&iObj);

This is what failed. All Chilkat objects returned by a method,whether it be an XML object, Cert object, JSON object, etc. are created in this way.


Answer

If you are using using SxS registration with a manifest, it's possible that it has been improperly defined (missing class/object definitions perhaps?) which could cause problems with creating objects.


Answer

After I posted my question, I also thought re-registering DLL might fix the problem and tried it for one of the problem PCs.

It worked! Thans for your help.

I expect, taking your suggestion into account, other problem PCs can also be fixed in the same manner, because the ActiveX DLL in all of the PCs seems to have been installed before the ActiveX supports async methods. The activeX DLL file have been updeted since its initial instalation by simply overwriting the old by new version file.

So, on updating ActiveX DLL, it should be re-registered, right?