Jump to content

Crash on using Au3_Controlgettext


Recommended Posts

Hi,

I am using AutoItx3.dll with Java.

But while using Au3_Controlgettext i am getting a JVM crash.

Code is as below:

public void AU3_ControlGetText(WString szTitle, WString szText, WString szControl,byte [] szControlText, int nBufSize);

autoitx.INSTANCE.AU3_ControlGetText( szTitle, szText, szControl,szControlText,nBufSize);

usage:

 byte[] controltext =  new byte[1024];
 autoitx.INSTANCE.AU3_ControlGetText( Title,Text,new WString("[CLASS:Edit;INSTANCE:52]"),controltext,1024);

can someone help me on this?

Edited by SreejaJayakumar
Link to comment
Share on other sites

Hi,

I am using AutoItx3.dll with Java.

But while using Au3_Controlgettext i am getting a JVM crash.

Code is as below:

public void AU3_ControlGetText(WString szTitle, WString szText, WString szControl,byte [] szControlText, int nBufSize);

autoitx.INSTANCE.AU3_ControlGetText( szTitle, szText, szControl,szControlText,nBufSize);

usage:

 byte[] controltext =  new byte[1024];

 autoitx.INSTANCE.AU3_ControlGetText( Title,Text,new WString("[CLASS:Edit;INSTANCE:52]"),controltext,1024);

can someone help me on this?

/**
     * Retrieves text from a control.
     * 
     * When using a control name in the Control functions, you need to add a
     * number to the end of the name to indicate which control. For example, if
     * there two controls listed called "MDIClient", you would refer to these as
     * "MDIClient1" and "MDIClient2".
     * 
     * @param title
     *            The title of the window to access.
     * @param text
     *            The text of the window to access.
     * @param controlId
     *            The control to interact with.
     * @return Returns text from a control if success, returns null if failed.
     */
    public static String getText(final String title, final String text,
            final String controlId) {
        final int bufSize = CONTROL_GET_TEXT_BUF_ZIZE;
        final CharBuffer controlText = CharBuffer.allocate(bufSize);
        getAutoItX()
                .AU3_ControlGetText(stringToWString(defaultString(title)),
                        stringToWString(text),
                        stringToWString(defaultString(controlId)), controlText,
                        bufSize);

        return hasError() ? Win32.getControlText(Control.getHandle_(title,
                text, controlId)) : Native.toString(controlText.array());
    }
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...