B4J Question Turn Screen On/Off (not pause or sleep or energy saver) only screen

Discussion in 'B4J Questions' started by Phsoftware_app, Jul 31, 2019.

  1. Phsoftware_app

    Phsoftware_app Member Licensed User

    Hello
    Anybody can tell me how i can turn off or on the screen?
     
  2. inakigarm

    inakigarm Well-Known Member Licensed User

  3. Phsoftware_app

    Phsoftware_app Member Licensed User

    Hy,and thank you,Can you make a simple example? i have copy the library,but i dont know how to use java.
     
  4. inakigarm

    inakigarm Well-Known Member Licensed User

    Copied nricmd to File.DirApp (B4J app folder/Objects)

    Code:
    Sub AppStart (Form1 As Form, Args() As String)
        MainForm = Form1
        
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
        'MainForm.Show
        
        jshell.Initialize(
    "shellevent","nircmd",Array As String("monitor","off"))
        jshell.WorkingDirectory=
    File.DirApp
        jshell.RunWithOutputEvents(
    1000)

    End Sub

    'Return true to allow the default exceptions handler to handle the uncaught exception.
    Sub Application_Error (Error As Exception, StackTrace As StringAs Boolean
        
    Return True
    End Sub

    Private Sub shellevent_StdErr (Buffer() As Byte, Length As Int)
        
    Dim Output As String = BytesToString(Buffer,0,Length,"UTF-8")
        
    Log(Output)
    End Sub

    Private Sub shellevent_StdOut (Buffer() As Byte, Length As Int)
        
    Dim Output As String = BytesToString(Buffer,0,Length,"UTF-8")
        
    Log(Output)
    End Sub

    Private Sub shellevent_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
        
    Log(Success)
    End Sub
     
  5. Phsoftware_app

    Phsoftware_app Member Licensed User

    Thank you,but malwarebytes detect nircmd as a virus.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice