Problem with Return Value while calling C function?

Creating a macro - Writing a Script - Using the API

Problem with Return Value while calling C function?

Postby BoskeyT » Fri Feb 29, 2008 5:59 pm

Hi All,

I am calling C dll in macro which converts Unicode data to 8 bit encoding data
' Prototype of C function.
' extern "C" int _stdcall Uni2Eni(wchar_t * uni, unsigned char * eni, int size)

'Here is the function where creating alias of C function using C dll(capi.dll)
' ByVal Uni As String ( Its a Unicode string)
‘ByVal eni As String ( its a Non_Unicode string)
Declare Function UNI2Eni Lib "capi.dll" Alias " Uni2Eni " ( ByVal Uni As String, ByVal eni As String, ByVal iSize As Integer) As Integer

Sub Test
Dim iRet as integer
Dim sEni as String
iRet = UNI2Eni(“क”,sEni,40)
End Sub
On calling this function it return iRet =1 which shows conversion has been successful but the value returned in sEni is showing blank .
Is it the problem with data type or something else?
Please anyone can help me?.
I have used the same dll in VBA its gives right output.
I am using open office 2.0.
BoskeyT
 
Posts: 2
Joined: Mon Feb 18, 2008 8:06 am

Re: Problem with Return Value while calling C function?

Postby ms777 » Wed Mar 05, 2008 1:10 am

try replacing
Code: Select all   Expand viewCollapse view
Declare Function UNI2Eni Lib "capi.dll" Alias " Uni2Eni " ( ByVal Uni As String, ByVal eni As String, ByVal iSize As Integer) As Integer
by
Code: Select all   Expand viewCollapse view
Declare Function UNI2Eni Lib "capi.dll" Alias " Uni2Eni " ( ByRef Uni As String, ByRef eni As String, ByVal iSize As Integer) As Integer
ms777
Volunteer
 
Posts: 129
Joined: Mon Oct 08, 2007 1:33 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 7 guests