Sign in to follow this  
Followers 0
beqa

nvda controller client wrapper on autoit

11 posts in this topic

hello all.

please help.

i am trying to write a wrapper for nvda controller client in autoit.

it is a first attempt of working with dlls within autoit, nad without success.

so, i created one function which check if nvda is running, and then function with check if it is running display a msg.

so, here is my code:

if @OSArch = "X64" Then
Local Const $nvdaControllerClient64 = DllOpen

("nvdaControllerClient64.dll")
else
Local Const $nvdaControllerClient32 = DllOpen

("nvdaControllerClient32.dll")
endif

Func IsRunning()
if @OSArch = "X64" then
Return DllCall($nvdaControllerClient64, "testIfRunning")[0]
else
Return DllCall($nvdaControllerClient32, "testIfRunning")[0]
endif
Return False
EndFunc

Func test()
if IsRunning = True then
msgbox(0, 'hi', 'hello')
endif
EndFunc

 

and here is c# code for accessing this function:

    /* [comm_status][fault_status] error_status_t __stdcall nvdaController_testIfRunning(void); */

    [DllImport("nvdaControllerClient32.dll", EntryPoint = "nvdaController_testIfRunning")]
    extern static uint nvdaController32_testIfRunning();

    [DllImport("nvdaControllerClient64.dll", EntryPoint = "nvdaController_testIfRunning")]
    extern static uint nvdaController64_testIfRunning();

    public static bool IsRunning()
    {
        if (Is64bit())
        {
            return nvdaController64_testIfRunning() == 0;
        }
        return nvdaController32_testIfRunning() == 0;
    }

 

thanks.

Share this post


Link to post
Share on other sites



hello, are there someone?

Share this post


Link to post
Share on other sites

hello.

i've researched more about dllCalls in autoit and here is again non working script.

if @OSArch = "X64" Then
Local Const $nvdaControllerClient64 = DllOpen

("nvdaControllerClient64.dll")
else
Local Const $nvdaControllerClient32 = DllOpen

("nvdaControllerClient32.dll")
endif

test()

Func IsRunning()
if @OSArch = "X64" then
Return DllCall($nvdaControllerClient64, "VOID", "testIfRunning", 0)
else
Return DllCall($nvdaControllerClient32, "VOID", "testIfRunning", 0)
endif
Return False
EndFunc

Func test()
if IsRunning() then
msgbox(0, 'nvda is running', 'success')
endif
EndFunc

 

so, first param is dll which should be opened, there return type, which is Void, then function testIfRunning and then what it should return there is 0

however, when i am running script it doesn't display a messageBox.

please help me what i am doing wrong.

Share this post


Link to post
Share on other sites

There is no VOID return type in DLLCall, use NONE as the help file says.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

ok, i changed without any success.

Share this post


Link to post
Share on other sites

What type is type 0? Read the help file, I don't do much with DLLCall, but even I can see your parameters are wrong.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

i really can't understand how it should be written in autoit.

so, dllcall("dll", "NONE", "testIfrunning", this is a function which must return 0 on success

Share this post


Link to post
Share on other sites

ok, maybe this is correct.

if @OSArch = "X64" Then
Local Const $nvdaControllerClient64 = DllOpen

("nvdaControllerClient64.dll")
else
Local Const $nvdaControllerClient32 = DllOpen

("nvdaControllerClient32.dll")
endif

test()

Func IsRunning()
if @OSArch = "X64" then
Return DllCall($nvdaControllerClient64, "NONE", "testIfRunning")
else
Return DllCall($nvdaControllerClient32, "NONE", "testIfRunning")
endif
Return False
EndFunc

Func test()
if IsRunning() then
msgbox(0, 'nvda is running', 'success')
endif
EndFunc

 

but how to check if it returns 0, this means that nvda is running, display a msgbox.

Share this post


Link to post
Share on other sites

hi, is someone here who can help?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I don't have the library to play with but I believe this is correct.

Func nvdaController_testIfRunning()
    Local $aResult

    If (@OSArch == "X64") Then
        $aResult = DllCall("nvdaControllerClient64.dll", "UINT", "nvdaController_testIfRunning")
    Else
        $aResult = DllCall("nvdaControllerClient32.dll", "UINT", "nvdaController_testIfRunning")
    EndIf

    If (@error <> 0) Then Return SetError(@error, @extended, 0);

    Return ($aResult[0] = 0)
EndFunc
Edited by Tekk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0