login about faq

I am creating a CSV file from a DBase file for the first time. When I try to set the SetCell parameters, I get an error saying there are not enough parameters.

If I look at the csv.SetCell in the Delphi Help Completion tool it gives the following information

function setcell: function(row: Integer; col: Integer; const content: WideString; out pVal: Integer); Integer

When I look at the function in

function SetCell(row: Integer; col: Integer; const content: WideString): Integer; safecall;

Nowhere do I see anything in the documentation about a 4th parameter. I added an integer field called "out":


That works but I'm not sure why the version I have ( needs this extra variable. I had to add the same variable to the SaveFile functions as well. I have used this for quite a while to import CSV files but this is the first I am playing with exporting data to an CSV using this component. This app is created with Delphi 4.

asked Aug 14 '13 at 13:44

drdx's gravatar image


You're using the ActiveX here with Delphi 4, which is correct.

At the COM level, all functions return HRESULT's (which is not seen by your Delphi application). Return values, such as strings, integers, etc. are always returned as an output-only argument, which w/ Chilkat is the last argument of the function -- but again, you don't see this in Delphi (or in VB6, or in most programming languages that can use ActiveX API's. You must be looking at the COM function signature.

The way it should look in Delphi is like this:

success := csv.SetCell(0,1,'red');

Where SetCell returns 1 for success or 0 for failure. At the COM function level, it looks like this:

HRESULT SetCell([in] long row, [in] long col, [in] BSTR content, [out, retval] long *pVal);


answered Aug 14 '13 at 17:02

chilkat's gravatar image

chilkat ♦♦

Yes I am using the ActiveX component.

Nothing I do can get it to work using the procedure as written in the example. It is working and outputting the data as requited but I have to use that fourth variable. On inspection at runtime it has a 5 digit number in it and every instance has the same number so I'm guessing it is a window flag.

This does not work: success := csv.SetCell(0,1,'red');

This does: success := csv.SetCell(0,1,'red', out);

"Success" is a 1 but "out" is 53244. If I do not add an integer field to hold that number I get an exception error.

I am migrating this application into Delphi 7 and will let you know if the same thing occurs there.


answered Aug 14 '13 at 17:20

drdx's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Aug 14 '13 at 13:44

Seen: 2,192 times

Last updated: Aug 14 '13 at 17:20

powered by OSQA