B4J Library SD_NativeAccess (jna)

This library allows access to the jna to use some functions for managing windows and applications.
You need to get these JARs and include them in the additional libraries folder: jna-5.0.0 and jna-platform-5.0.0

With this library you can obtain the Handle of the applications that run on your Windows PC, both visible and invisible ones. A bit like you would with the task manager.
From the Hande you can get the name of the window, the coordinates and dimensions and finally the file name and path of the app.
There are many other functions that can be implemented with jna, as soon as I have time I will add a few more

SD_NativeAccess

Author:
Star-Dust
Version: 1.03
  • Na_Rectangle
    • Fields:
      • Height As Int
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • Left As Int
      • Top As Int
      • Width As Int
    • Functions:
      • Initialize
        Inizializza i campi al loro valore predefinito.
  • NativeAccess
    • Functions:
      • Class_Globals As String
      • GetCOM As List
        USB or COM
      • GetIdleTime As Long
      • GetListWindowsHandle (OnlyVisible As Boolean) As List
      • GetListWindowsTitle (OnlyVisible As Boolean) As List
      • GetRegisterCurrentUser (KeyPath As String, KeyValue As String) As String
      • GetRegisterLocalMachine (KeyPath As String, KeyValue As String) As String
      • GetUSB As List
      • GetWindowRect (Handle As Object) As Na_Rectangle
      • GetWindowsActiveTitle As String
      • getWindowsFilePath (Handle As Object) As String
      • getWindowsTitle (Handle As Object) As String
      • Initialize As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • Minimize (Handle As Object) As String
      • Monitor (On As Boolean) As String
      • SetForegroundWindow (Title As String) As String
      • SetWindowRec (Handle As Object, Left As Int, Top As Int, Width As Int, Height As Int) As String


Update
  • rel 1.01
    • Add Monitor (On As Boolean)
  • rel. 1.02
    • Added GetUSB
      returns the list of installed usb devices
    • Added GetCOM
      returns the list of serial port
    • Added GetIdleTime
      returns the user's idle time
  • rel 1.03
    • Added GetRegisterCurrentUser (KeyPath As String, KeyValue As String) As String
  • rel 1.04
    • Added GetRegisterLocalMachine (KeyPath As String, KeyValue As String) As String
 

Attachments

  • SD_NativeAccess 1.04.zip
    8.2 KB · Views: 9
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
example
 

Attachments

  • Sample_NativeAccess.zip
    2.2 KB · Views: 37

Star-Dust

Expert
Licensed User
Longtime User
Update rel 1.01
  • Add Monitor (On As Boolean)
    Turn On or Off the monitor
B4X:
Na.Initialize
Na.Monitor(False)
Sleep(500)
Na.Monitor(True)
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update rel 1.02
  • Added GetUSB
    returns the list of installed usb devices
  • Added GetCOM
    returns the list of serial port
  • Added GetIdleTime
    returns the user's idle time
 

Star-Dust

Expert
Licensed User
Longtime User
Update rel 1.03
  • Addes GetRegisterCurrentUser (KeyPath As String, KeyValue As String) As String
Sample:
Log(Na.GetRegisterCurrentUser("SOFTWARE\Microsoft\Windows\CurrentVersion\Extensions","rtf"))
 
Top