You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

A1880

Intermediate

  • "A1880" is male
  • "A1880" started this thread

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

1

Sunday, February 15th 2009, 7:05pm

Output parameters and WINAPI

Hi all,
I've tried to call an external DLL via WINAPI. This usually works quite well in Jabaco, but in my special case I encountered problems, because the call was supposed to pass back output parameters.

My example:

Source code

1
2
3
Private WINAPI Function GetPrivateProfileString Lib "KERNEL32" Alias "GetPrivateProfileStringA" _
    (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _
     ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long


Looking at the decompiled Java code generated by Jabaco, I saw no way how the changed value of "lpReturnedString" could be possibly copied back to the String variable of the calling routine. A bug in Jabaco?

I tried several alternatives playing around with ByRef, ByVal, IntCall(), and NativeCall().
No chance, at least not for me!

Any hints are greatly appreciated!

A1880

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

2

Monday, February 16th 2009, 12:01am

Hi,

I am not sure if this really works in Jabaco, maybe there must be some work left to bring this to work.

afaik in java it is only possible to return a string as the return value of a function.

maybe the Properties-object works for your needs:

Jabaco Source

1
2
3
4
5
6
Dim iniFile As New java#io#File("C:\\Test.ini")
   Dim iniReader As New java#io#FileReader(inifile)
   Dim ini As New java#util#Properties
   ini.load(inireader)   
   Dim v As String = ini.get("TestEntry")
   msgbox v




greetings OlimilO

Rate this thread
WoltLab Burning Board