RTF 2 HTML conversion via DLL is not working

289 Views Asked by At

This question could get quit tricky.

Scenario:

I am using a IDE called Team Developer 6.1. It has its own programming language called Gupta / Centura. Now since I have no other chance to do it in an other way, I have to use a RTF-Control element to get a bit usebility into the GUI.

What I want to achive is sending an email but the content is in RTF and I have to convert it into HTML.

Anyways... I bind in a DLL called doxlib.dll there are 2 functions inside that I want to use.

_DoxConvert (converts a rtf-file to a html-file)

_DoxStringConvert (converts rtf-content into html-content)

I found something in the Internet that helped me to get the first one running.

Finaly the third post from here made it running!

The second function is driving me crazy because I get no output and I dont know why. I guess this has some to do with the output length buffer. Also the function returns 0 all the time but in the samples it should return some kind of number... actually there is my point where I fail in reading the third reply :D

Does someone has an idea how this would look like in C++ if the third reply would get transformed from autoit to c++?

At the moment my call looks like (Centura)

Function:  ConvertToHTML
Parameter: String sInput
           String sOutput

Set nLen = _DoxStringConvert( sInput , SalStrGetBufferLength( sInput ), sOutput, SalStrGetBufferLength( sOutput), DOX_IN_RTF|DOX_OUT_HTML )

Sample call:

Call ConvertToHTML( "my string", output_var )

But this output length thing seems so wrong to me ^^

1

There are 1 best solutions below

0
On

You are using TD6.1 which is UNICODE. SalStrGetBufferLength() was deprecated due Team Developer's switch from ANSI to Unicode back in v5.0. You need to use SalGetBufferLength() for better results.

SalGetBufferLength() Gets the number of bytes used by the buffer to store a specified string.

Also, when calling any external function from TeamDeveloper , you must allocate memory to any strings using SalSetBufferLength i.e.

bOk = SalSetBufferLength(sTargetStr, nBuffLength)

Sets the number of bytes used by the buffer to store a specified string.

in your case Call SalSetBufferLength( sInput, nnn) Call SalSetBufferLength( sOutput, nnn) then Set nLen = _DoxStringConvert(....