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.
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Administrator
Date of registration: Jul 16th 2008
Location: Erlangen, Germany
Occupation: Software Developer
Hobbies: Jabaco, game theory, text-mining
Jabaco will support internal java classes in a future version ...Quoted
' Jabaco IDE does not seem to know internal classes of AudioFileFormat
I'll fix this problem in Jabaco. So you need only a temporary workaround. Your solution is clever (in my mind) but if you don't like it you could try to find another solution with java reflections...Quoted
There might be clever alternative ways to solve this. Who has a suggestion?
Another solution to save your time:Quoted
I'm not quite sure if I understand the exact usage of NativeCall() to access WIN32 API routines in external DLL libraries.
Jabaco Source |
|
1 2 3 4 5 6 |
Public WinApi Function mciSendString Lib "winmm.dll" _ Alias "mciSendStringA" ( _ ByVal lpstrCommand As String, _ ByVal lpstrReturnString As String, _ ByVal uReturnLength As Long, _ ByVal hwndCallback As Long) As Long |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Public Sub main(ByJava args() As String) Dim retStr As String Dim va(0 To 5) As Variant Dim res As Variant , i As Integer retStr = space(128) i = 128 va(0) = "TEST" va(1) = "TEST" va(2) = "zz" va(3) = retStr va(4) = i va(5) = "C:\test.ini" res = NativeCall("KERNEL32", "GetPrivateProfileStringA", va) msgbox va(3) End Sub |
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Hi,
yes, I also haven't succeeded with output parameters.
see here
"NativeCall" and WINAPI probably need some more thoughts and some testing.
Due to Java's limitations (some would rather call it: "style") it is not directly possible to use output parameters.
One way around would be to pass a container object as parameter and call its setter method from within the called routine.
But this would obviously spoil the WINAPI syntax and would make WINAPI very much different from its VB6 predecessor,
Greetings!
A1880
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Option Explicit Private myValue As Integer Public Sub clsHolder() ' constructor for initialization myValue = -1 End Sub ' we are not using "properties". ' This is just a demo for Holder objects .... Public Function GetValue() As Integer GetValue = myValue End Function Public Sub SetValue(i As Integer) myValue = i End Sub |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Public Sub main(ByJava args() As String) Dim holder As clsHolder = New clsHolder Dim holderArray(0 To 5) As String holderArray(1) = "hoo!" out.println "value before calling: " & holder.GetValue & " " & holderArray(1) Call Callee(holder, holderArray) out.println "value after calling: " & holder.GetValue & " " & holderArray(1) msgbox "ciao!" End Sub Private Sub Callee(holder As clsHolder, holderArray() As String) ' "ByRef" nor "ByVal" make no difference here! holder.SetValue 5 holderArray(1) = "ray!" End Sub |
This post has been edited 1 times, last edit by "A1880" (Feb 20th 2009, 4:01pm)
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 |
Public Sub Command1_Click() Dim o As IntCall Dim i As Integer Dim p(2) As String p(0) = "C:\Test.txt" p(1) = "C:\Test2.txt" com#eaio#nativecall#NativeCall.init() o = New IntCall( "kernel32", "CopyFileA" ) i = o.executeCall( p() ) End Sub |