Jump to content

C# Autoit - ControlClick


Berdar7
 Share

Recommended Posts

Hi,

I am using autoitx in c#. My project is need to use ControlClik. But sometimes Autoit gives error. This error is Attempt to read or write protected memory. 

My code : 

[DllImport("AutoItX3.dll", CharSet = CharSet.Auto)]
    internal static extern int AU3_ControlClick([MarshalAs(UnmanagedType.LPWStr)] string title, [MarshalAs(UnmanagedType.LPWStr)] string text, [MarshalAs(UnmanagedType.LPWStr)] string control, [MarshalAs(UnmanagedType.LPWStr)] string button, int numClicks, int x, int y);

AU3_ControlClick("BerkBot Browser", "", "[CLASS:WebPluginView; INSTANCE:1]", "left", 1, Rec.X, Rec.Y);

I used try catch but always give memory exception.

Link to comment
Share on other sites

3 hours ago, JohnOne said:

It's wise to post full code.

 public static bool BotSearch3D(Bitmap SmallBitmap, bool Click)
        {
            try
            {
                berkhandle = (IntPtr)FindWindow(null, "BerkBot Browser");
                if (berkhandle == null || berkhandle.ToString() == "0")
                {
                    GC.Collect();
                    return false;
                }
                else
                {
                    Rectangle Rec = SearchBitmap(SmallBitmap, PrintWindow(berkhandle));
                    if (Rec.X > 0 && Rec.Y > 0)
                    {
                        AU3_ControlClick("BerkBot Browser", "", "[CLASS:WebPluginView; INSTANCE:1]", "left", 1, Rec.X, Rec.Y);
                        GC.Collect();
                        return true;
                    }
                    GC.Collect();
                    return false;
                }
            }
            catch { GC.Collect(); return false; }
        }

This is working in loop per 300 ms. 

Link to comment
Share on other sites

  • Moderators

Berdar7,

When I search for "Berkbot" I get a NY divorce lawyer and various gamebot hits. Have you read our Forum rules and can you assure me that this thread meets those requirements?

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

On 19.02.2017 at 11:04 PM, Melba23 said:

Berdar7,

When I search for "Berkbot" I get a NY divorce lawyer and various gamebot hits. Have you read our Forum rules and can you assure me that this thread meets those requirements?

M23

 

Berkbot.net is my website and BerkBot is mine. Yes, this is gamebot and i made it. What is the problem ?

Link to comment
Share on other sites

  • Moderators

Berdar7,

Quote

Yes, this is gamebot and i made it. What is the problem ?

The problem is that the Forum rules to which I linked you above include the following:

Quote

Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects:

  • [...]
  • Launching, automation or script interaction with games or game servers, regardless of the game.

So this thread falls foul of the rules and has been locked. Please do read and respect our rules in future.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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