Example: ctrx_<obj>_get_info

To demonstrate the *get_info functions, we use a simple Windows application:

InfoRetrieval_EXE() {
    long x, y, wd, ht;
    /* Run a program with a push button, text edit box, 
    single select list and multiple select list */

    /*Run the program*/
    ctrx_obj_mouse_click("<class=SysListView32>",
        258, 398, LEFT_BUTTON, 0, 
        "NULL=snapshot170", CTRX_LAST );

    ctrx_sync_on_window("Desktop", ACTIVATE, 
        0, 0, 801, 601, "snapshot171", CTRX_LAST );

    ctrx_obj_mouse_double_click("<class=SysListView32>", 
        259, 397, LEFT_BUTTON, 0, "Desktop=snapshot172", CTRX_LAST );

    ctrx_get_window_name(object_value_buffer);

    // Output: ctrx_get_window_name: Desktop
    lr_message( "ctrx_get_window_name: %s",
        object_value_buffer );  

    ctrx_get_window_position("Form1", &x, &y, &wd, &ht);

    // Output: Window position is 0, 0, 0, 0

    lr_message("Window position is %ld, %ld, %ld, %ld",
        x, y, wd, ht);

    /* The Command1 push button */

    ctrx_sync_on_window("Form1", ACTIVATE, 
        7, 7, 596, 256, "snapshot173", CTRX_LAST );

    // Confirm that the command button is in focus.

    ctrx_button_get_info("Form1",41, 39, 
        FOCUSED, object_value_buffer, CTRX_LAST );

    // Output: ctrx_button_get_info: TRUE

    lr_message( "ctrx_button_get_info: %s",
        object_value_buffer );

    /* Clicking the button displays the "Have a nice day" 
        message box */

    ctrx_obj_mouse_click(
	   "<text=Command1 class=ThunderRT6CommandButton>", 
	    41, 39, LEFT_BUTTON, 0, "Form1=snapshot174", CTRX_LAST );

    // The message box has focus, not the command button.

    ctrx_button_get_info("Form1",41, 39, 
        FOCUSED, object_value_buffer, CTRX_LAST );

    // Output: ctrx_button_get_info: FALSE

    lr_message( "ctrx_button_get_info: %s",
        object_value_buffer );

    /*Acknowledge the message box*/

    ctrx_sync_on_window("ObjectTest", 
        ACTIVATE, 302, 258, 171, 101, 
        "snapshot175", CTRX_LAST );

    // Get the message box title and position

    ctrx_get_window_name(object_value_buffer);

    // Output: ctrx_get_window_name: ObjectTest

    lr_message( "ctrx_get_window_name: %s",
        object_value_buffer );

    ctrx_get_window_position("Form1", &x, &y, &wd, &ht);

    // Output: Window position is 7, 7, 596, 256

    lr_message("Window position is %ld, %ld, %ld, %ld", 
        x, y, wd, ht);

    // Click OK to acknowledge the message box

    ctrx_obj_mouse_click("<text=OK class=Button>", 
        72, 71, LEFT_BUTTON, 0, 
        "ObjectTest=snapshot176", CTRX_LAST );

    /*Tab to text box Text1*/

    ctrx_sync_on_window("Form1", ACTIVATE, 
        7, 7, 596, 256, "snapshot177", CTRX_LAST );

    ctrx_obj_mouse_click(
        "<text=Form1 class=ThunderRT6FormDC>",
        233, 12, LEFT_BUTTON, 0, 
        "Form1=snapshot178", CTRX_LAST );

    ctrx_key("TAB_KEY", 0);

    // Get the text

    ctrx_edit_get_info("Form1",6, 65,
        TEXT, object_value_buffer, CTRX_LAST );

    // Output: ctrx_edit_get_info: Text1

    lr_message( "ctrx_edit_get_info: %s",
        object_value_buffer );

    ctrx_sync_on_obj_info("Form1",
        6, 65, FOCUSED, "TRUE", CTRX_LAST );

    /*Change the text*/
    /* Select the text: mouse down at beginning, and up at end */

    ctrx_obj_mouse_down(
        "<text=Text1 class=ThunderRT6TextBox>",
        8, 71, LEFT_BUTTON, 0, 
        "Form1=snapshot179", CTRX_LAST );

    ctrx_obj_mouse_up(
        "<text=Text1 class=ThunderRT6TextBox>", 
        74, 72, LEFT_BUTTON, 0, 
        "Form1", CTRX_LAST );
    ctrx_type("T1");

    // Get the new text

    ctrx_edit_get_info("Form1",
        6, 65,TEXT, 
        object_value_buffer, CTRX_LAST );

    // Output: ctrx_edit_get_info: T1

    lr_message( "ctrx_edit_get_info: %s",
        object_value_buffer );

    /*Click title bar, then tab to Single Selection List*/

    ctrx_obj_mouse_click(
        "<text=Form1 class=ThunderRT6FormDC>", 
        191, 11, LEFT_BUTTON, 0, 
        "Form1=snapshot181", CTRX_LAST );

    ctrx_key("TAB_KEY", 0);

    // How many lines in the list?

    ctrx_list_get_info("Form1",22, 89, 
        LINES, object_value_buffer, CTRX_LAST );

    // Output: ctrx_list_get_info: 7

    lr_message( "ctrx_list_get_info: %s", object_value_buffer );

    ctrx_sync_on_obj_info("Form1", 22, 89, 
        FOCUSED, "TRUE", CTRX_LAST );

    /*Select the 4th row of the list box */

    ctrx_obj_mouse_click("<class=ThunderRT6ListBox>", 
        44, 131, LEFT_BUTTON, 0, 
        "Form1=snapshot182", CTRX_LAST );

    // What item is selected?

    ctrx_list_get_info("Form1",22, 89, ITEM, object_value_buffer, CTRX_LAST );

    // Output: ctrx_list_get_info: Emma

    lr_message( "ctrx_list_get_info: %s", object_value_buffer );

    // Change the selection

    ctrx_list_select_item("Form1",22,89, "HENRY", CTRX_LAST );

    ctrx_list_get_info("Form1",22, 89, 
        ITEM, object_value_buffer, CTRX_LAST );

    // Output: ctrx_list_get_info: Henry

    lr_message( "ctrx_list_get_info: %s", object_value_buffer );

.......................
   return 0;
}