0

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 ^^

Community
  • 1
  • 1
Dwza
  • 6,494
  • 6
  • 41
  • 73
  • What is `SalStrLength()`? I was expecting to see something like `Set nLen = _DoxStringConvert( sInput , sOutput, DOX_IN_RTF|DOX_OUT_HTML )` – Blas Soriano May 30 '15 at 09:51
  • This give me the String-Length of the given string in centura. I just changed it to `SalStrGetBufferLength( sInput )` since I realised I dont need the length. But I still have no result. – Dwza May 30 '15 at 09:55
  • In the example from your link, I see `$len = _DoxStringConvert($InBuff, $OutBuff, BitOr($DOX_IN_HTML,$DOX_OUT_RTF),$hDoxlibDll)` and inside that function these lengths are calculated as `Local $iInLength = StringLen($sInBuffer)` and `Local $iOutLength = StringLen($sOutBuffer)` – Blas Soriano May 30 '15 at 09:56
  • I know :) The source I posted is like this one. (Kind of like in the function) and I dont calc it befor call, I calc it while call – Dwza May 30 '15 at 09:58
  • Then, if you wrote your own `_DoxStringConvert()` maybe we should see that to find a possible error. – Blas Soriano May 30 '15 at 09:59
  • This is why I sayed this question could get tricky. To bind a DLL I only write the name and say to centura what are the parameters are e.g. Return boolean and Parameter String, String and so on. The function is like Edited. There is no possability to post it as a real function... its crappy centra :/ but its where the programm im working on is written in. – Dwza May 30 '15 at 10:03
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/79188/discussion-between-dwza-and-blas-soriano). – Dwza May 30 '15 at 10:04
  • Before you use words like 'crappy' Centura - be sure the problem is not you. 0 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. – Steve Leighton Jan 18 '19 at 00:12
  • For the record, the Team Developer 6.1 IDE programming language is 'SAL' - SQLWindows Application Language, not 'Gupta' or 'Centura'. 'Gupta' is the company that maintains the IDE. 'Centura' only ever put out one version of the IDE and that was v1.5 . Why do people continue to call it Centura . Centura was defunct in about 1995 , but 'Gupta' is now part of OpenText and TeamDeveloper is now running at v7.1 , is .Net enabled and UNICODE platform. Remember that when dealing with Strings. – Steve Leighton Jan 18 '19 at 00:19

1 Answers1

0

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(....

Steve Leighton
  • 790
  • 5
  • 15