Hello community,
a small hint for all who develop applications for different OS:
In Jabaco it is possible and very easy to use the WinAPI. If you use it, you can not run your application, e.g. with Linux OS, this means you can not call a WinAPI function, so you get an exception error. If you want to develop those applications, you can use a global variable to wrap WinAPI calls. Define the variable in the main procedure:
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
Public Form1 As New Form1
Global Windows As Boolean = False
Public Sub main(ByJava args() As String)
If LCase(Left(java#lang#System.getProperty("os.name"), 3)) = "win" Then
Windows = True
End If
Dim myArgs() As String
myArgs = args
Form1.SetDefaultClose()
Form1.Show()
End Sub
|
And you can use it in your code like this:
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
|
Private WinAPI Function MessageBeep Lib "user32.dll" (ByVal wType As Long) As Long
Public Sub Command1_Click()
If Windows Then
MessageBeep(1500)
End If
MsgBox "Dies ist ein Test"
End Sub
|
So it is possible to use WinAPI calls with Windows OS and run the application with different OS without native call exception error.
Cheers
Stefan