Using the Chilkat ActiveX in Visual FoxPro

create Chilkat objects with CREATEOBJECT and call them like any other COM object

Windows · Visual FoxPro 6 through 9 (always 32-bit) · Chilkat ActiveX v11

Visual FoxPro has built-in COM support, so your code can create Chilkat objects such as Chilkat.Http, Chilkat.JsonObject, or Chilkat.Crypt2 with CREATEOBJECT and call their methods and properties. That gives a FoxPro application HTTP/REST, email, FTP/SFTP, SSH, Zip, PDF, encryption, digital signatures, JSON, XML, and the rest of the Chilkat API.

The 60-second version

  1. Install the 32-bit Chilkat ActiveX, even on 64-bit Windows. Visual FoxPro is always 32-bit.
  2. Paste the first program into a .prg file and run it.
  3. When you distribute your application, install and register the 32-bit Chilkat ActiveX on each computer.

On this page: Install First program JSON into a cursor FoxPro tips Unicode text Deploying Troubleshooting

Setup

1

Install the 32-bit Chilkat ActiveX

Visual FoxPro and the applications it builds run as 32-bit processes, so they can only load the 32-bit Chilkat ActiveX. The 64-bit ActiveX is invisible to VFP, even on 64-bit Windows. (Third-party 64-bit VFP-compatible runtimes need the 64-bit ActiveX instead.)

v11.6.1 • 08-Sep-2026 • sha256: 49402b7f5dfe0b39ee28fede63963bbc826c65693737f490c53afffa2c4bbbc5
Chilkat 32-bit Per-Machine ActiveX MSI Installer

v11.6.1 • 08-Sep-2026 • sha256: 429f0e944f68780c9ba406202d9b8f35ab7f41d57c3528dcac244db24fb4eb0e
Chilkat 32-bit Per-User ActiveX MSI Installer

InstallerUse it when
Per-machineRecommended. Registers Chilkat for every user of the computer, including VFP run as administrator, services, and scheduled tasks. Requires administrator rights to install.
Per-userRegisters Chilkat only for the current Windows user and normally needs no administrator rights. Works when VFP runs as that user without elevation.

The ActiveX download page also has ZIP downloads with a register.bat script that registers the DLL with regsvr32. Keep the DLL on a local drive, not a network share. The downloads are the full version and are fully functional for a 30-day evaluation.

Examples

Your first program: unlock Chilkat and fetch a URL

Chilkat must be unlocked once per process with UnlockBundle, so call it once when your application starts (for example, in the main program). During the 30-day trial any string works; after purchase, use your license code.

LOCAL loGlob, loHttp, lcText

loGlob = CREATEOBJECT("Chilkat.Global")
IF loGlob.UnlockBundle("Anything for 30-day trial") <> 1
    ? loGlob.LastErrorText
    RETURN
ENDIF

loHttp = CREATEOBJECT("Chilkat.Http")
lcText = loHttp.QuickGetStr("https://www.chilkatsoft.com/helloworld.txt")
IF loHttp.LastMethodSuccess <> 1
    ? loHttp.LastErrorText
    RETURN
ENDIF

MESSAGEBOX(lcText)

A message box shows Hello World!. The ProgID is Chilkat. plus the class name, for example Chilkat.JsonObject or Chilkat.Crypt2.

Load JSON from a web request into a cursor

This program downloads a small JSON document, parses it with Chilkat.JsonObject, inserts each member into a cursor, and browses it. The same pattern works for any REST API: send the request with Chilkat.Http or Chilkat.Rest, then read the fields with StringOf, IntOf, and SizeOfArray.

LOCAL loHttp, loJson, lcJson, i

* {"apple":"red", "lime":"green", "banana":"yellow", ...}
loHttp = CREATEOBJECT("Chilkat.Http")
lcJson = loHttp.QuickGetStr("https://www.chilkatsoft.com/exampledata/sample.json")
IF loHttp.LastMethodSuccess <> 1
    ? loHttp.LastErrorText
    RETURN
ENDIF

loJson = CREATEOBJECT("Chilkat.JsonObject")
IF loJson.Load(lcJson) <> 1
    ? loJson.LastErrorText
    RETURN
ENDIF

CREATE CURSOR fruit (name C(30), color C(30))
FOR i = 0 TO loJson.Size - 1
    INSERT INTO fruit (name, color) VALUES (loJson.NameAt(i), loJson.StringAt(i))
ENDFOR

GO TOP
BROWSE

Things to know when calling Chilkat from FoxPro

Chilkat returns the number 1 or 0, not .T. or .F. Chilkat ActiveX methods that report success, and properties such as LastMethodSuccess, return a numeric value: 1 for success and 0 for failure. Compare with a number:

  • Correct: IF lnSuccess <> 1 … or IF lnSuccess = 0 …
  • Wrong: IF lnSuccess = .T. or IF NOT lnSuccess fail with Operator/operand type mismatch, because a number isn't a logical value.
TopicWhat to do
ErrorsChilkat doesn't raise FoxPro errors for ordinary failures. Check the return value (or LastMethodSuccess for methods that return a string or object) and show LastErrorText, which explains exactly what went wrong.
Object lifetimeObjects are released when the variable goes out of scope. Use RELEASE loSsh or loSsh = .NULL. to release one earlier, for example a connection you are finished with.
Binary filesDon't load binary files such as PDFs or images with FILETOSTR() and pass them to Chilkat as strings. Use Chilkat's own file methods or Chilkat.BinData (LoadFile, WriteFile). See Why FileToStr() on a binary file is a mistake.
Long operationsThe FoxPro UI doesn't repaint while a Chilkat call runs. Set timeouts such as ConnectTimeout and ReadTimeout where a class has them, and use the Async methods with a DOEVENTS loop for long operations. See Chilkat SSH QuickCommand freezes the FoxPro UI.
Chilkat v9.5 codev11 ProgIDs are Chilkat.Http, Chilkat.Global, and so on. Older v9.5 code uses Chilkat_9_5_0.Http. Both versions can be installed side by side; see Chilkat ActiveX v11 and v9.5 on the same computer.

Unicode text

Chilkat works with Unicode strings; FoxPro strings are in a single code page. By default, VFP converts each string it receives from a COM object to the Windows (ANSI) code page, so characters that code page can't represent become ?. If your data includes such characters (for example, Chinese text on an English Windows system), VFP 9 can switch its COM string translation to UTF-8:

SYS(3101, 65001)   && strings to and from COM objects are now UTF-8

The setting applies to the current data session, so a form with a private data session must set it too (for example, in its Load event). After this, strings from Chilkat arrive as UTF-8 bytes, and strings you pass to Chilkat must also be UTF-8. Use STRCONV() to convert between UTF-8 and the code page your forms and tables use. Text that Chilkat reads from or writes to files, with an explicit charset such as "utf-8", isn't affected by this setting.

Deploying a FoxPro application

Your EXE doesn't contain Chilkat; it finds the Chilkat ActiveX through the Windows registry. On each computer where the application runs:

  • Install and register the 32-bit Chilkat ActiveX. The simplest way is to run Chilkat's 32-bit per-machine MSI from your setup, or to have your installer copy the DLL and register it.
  • If you register the DLL yourself on 64-bit Windows, use the 32-bit regsvr32: C:\Windows\SysWOW64\regsvr32.exe. The ActiveX DLL Registration Tutorial explains the 32-bit and 64-bit registries.
  • Install the DLL to a local folder and don't move it after registering, because the registry records its path.

Troubleshooting

MessageCause and fix
Class definition CHILKAT.HTTP is not found. The 32-bit Chilkat ActiveX isn't registered on this computer, or it's registered per-user and VFP runs elevated or as another account. Install the 32-bit per-machine MSI, and check the ProgID spelling.
OLE error code 0x80020006: Unknown name. The method or property name is misspelled, or the installed Chilkat version is older than the one the code was written for. Check the name in the reference documentation.
Operator/operand type mismatch. A Chilkat return value was compared with .T. or .F., or used with NOT. Compare with 1 instead.
Non-English characters appear as ? VFP converted the Unicode string to a code page that can't represent them. See Unicode text.
A PDF or image saved from FoxPro is corrupt Binary data passed through a FoxPro string. See Why FileToStr() on a binary file is a mistake.
A Chilkat method returns 0 or an empty string The operation itself failed (a network error, a bad password, an invalid file path, and so on). Show LastErrorText; it names the cause.

Next Steps

Visual FoxPro is a trademark of the Microsoft group of companies.