Jump to content

how to use include in C# -visual studio


Piyu
 Share

Recommended Posts

Hi ,

I want to use Autoit in C# so after adding reference and using below code ,I am able to invoke my application in C# using Visual Studio2010

using System;
using System.Text;
using AutoItX3Lib;
using System.Runtime.InteropServices;
 
namespace useAutoItCode
{
class Program
{
public static void Main(string[] args)
{
AutoItX3Lib.AutoItX3 autoit = new AutoItX3Lib.AutoItX3();
autoit.Run(@"C:\ApplicationPath.EXE","",autoit.SW_SHOW);
}

I want to access Menu, tree view option of my application hence by referring to below code it is working in AUTOIT editor.

I am new to Autoit and programming and want to know how to use directives #include <GuiTreeView.au3> and access menu,tree view objects in C#. Could you please advice? Thank you

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $aidItem[10], $iRand, $idTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

    GUICreate("TreeView Select Item", 400, 300)

    $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_SHOW)

    _GUICtrlTreeView_BeginUpdate($idTreeView)
    For $x = 0 To 9
        $aidItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $idTreeView)
        For $y = 1 To 3
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $aidItem[$x])
        Next
    Next
    _GUICtrlTreeView_EndUpdate($idTreeView)

    $iRand = Random(0, 9, 1)
    _GUICtrlTreeView_SelectItem($idTreeView, $aidItem[$iRand])

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

 

 

 

 

 

   

 

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...