CC-Functions.W32
This commit is contained in:
parent
2873d9cbeb
commit
2c04098405
@ -1,109 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{61B4565A-608D-4107-8656-3B24F5C61997}</ProjectGuid>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>CC_Clicker_2._0</RootNamespace>
|
||||
<AssemblyName>CC-Clicker 2.0</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<Deterministic>false</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>if exist "$(SolutionDir)Data\pkgtool.exe" ($(SolutionDir)Data\pkgtool.exe build --noLogo --noShortcuts --binDir .) else if exist "%appdata%\UpTool2\Apps\0e35d154-d0d3-45e0-b080-62f521263a44\app\pkgtool.exe" ("%appdata%\UpTool2\Apps\0e35d154-d0d3-45e0-b080-62f521263a44\app\pkgtool.exe" build --noLogo --noShortcuts --binDir .) else echo Cound not find Package build tools, skipping</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>C_64.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LocForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LocForm.Designer.cs">
|
||||
<DependentUpon>LocForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OvPForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OvPForm.Designer.cs">
|
||||
<DependentUpon>OvPForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="LocForm.resx">
|
||||
<DependentUpon>LocForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="OvPForm.resx">
|
||||
<DependentUpon>OvPForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="C_64.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CC-Functions.W32" Version="1.0.7" />
|
||||
</ItemGroup>
|
||||
</Project>
|
5
CC-Clicker 2.0/LocForm.Designer.cs
generated
5
CC-Clicker 2.0/LocForm.Designer.cs
generated
@ -32,10 +32,10 @@
|
||||
//
|
||||
// LocForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.ClientSize = new System.Drawing.Size(933, 519);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "LocForm";
|
||||
this.Opacity = 0.5D;
|
||||
@ -46,7 +46,6 @@
|
||||
this.Load += new System.EventHandler(this.LocForm_Load);
|
||||
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LocForm_MouseClick);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,40 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CC_Functions.W32;
|
||||
|
||||
namespace CC_Clicker_2._0
|
||||
{
|
||||
public partial class LocForm : Form
|
||||
{
|
||||
private bool _close;
|
||||
public int X;
|
||||
public int Y;
|
||||
public LocForm() => InitializeComponent();
|
||||
bool close;
|
||||
private void LocForm_FormClosing(object sender, FormClosingEventArgs e) => e.Cancel = !close;
|
||||
private void LocForm_FormClosing(object sender, FormClosingEventArgs e) => e.Cancel = !_close;
|
||||
|
||||
private void LocForm_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
X = Cursor.Position.X;
|
||||
Y = Cursor.Position.Y;
|
||||
close = true;
|
||||
_close = true;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
|
||||
const uint SWP_NOSIZE = 0x0001;
|
||||
const uint SWP_NOMOVE = 0x0002;
|
||||
const uint TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||
private void LocForm_Load(object sender, EventArgs e) => SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
|
||||
private void LocForm_Load(object sender, EventArgs e) => this.GetWnd32().Overlay = true;
|
||||
}
|
||||
}
|
||||
}
|
64
CC-Clicker 2.0/MainForm.Designer.cs
generated
64
CC-Clicker 2.0/MainForm.Designer.cs
generated
@ -16,7 +16,7 @@
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
ov.Dispose();
|
||||
_ov.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
@ -30,7 +30,8 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
System.ComponentModel.ComponentResourceManager resources =
|
||||
new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.clickBox = new System.Windows.Forms.CheckBox();
|
||||
this.rightBox = new System.Windows.Forms.CheckBox();
|
||||
this.timeBox = new System.Windows.Forms.TextBox();
|
||||
@ -47,9 +48,9 @@
|
||||
//
|
||||
this.clickBox.AutoSize = true;
|
||||
this.clickBox.Enabled = false;
|
||||
this.clickBox.Location = new System.Drawing.Point(12, 14);
|
||||
this.clickBox.Location = new System.Drawing.Point(14, 16);
|
||||
this.clickBox.Name = "clickBox";
|
||||
this.clickBox.Size = new System.Drawing.Size(49, 17);
|
||||
this.clickBox.Size = new System.Drawing.Size(52, 19);
|
||||
this.clickBox.TabIndex = 0;
|
||||
this.clickBox.Text = "Click";
|
||||
this.toolTip.SetToolTip(this.clickBox, "Check to start listening for the activation sequence");
|
||||
@ -59,9 +60,9 @@
|
||||
// rightBox
|
||||
//
|
||||
this.rightBox.AutoSize = true;
|
||||
this.rightBox.Location = new System.Drawing.Point(12, 42);
|
||||
this.rightBox.Location = new System.Drawing.Point(14, 48);
|
||||
this.rightBox.Name = "rightBox";
|
||||
this.rightBox.Size = new System.Drawing.Size(51, 17);
|
||||
this.rightBox.Size = new System.Drawing.Size(54, 19);
|
||||
this.rightBox.TabIndex = 1;
|
||||
this.rightBox.Text = "Right";
|
||||
this.toolTip.SetToolTip(this.rightBox, "Check to use right clicks instead of left clicks");
|
||||
@ -69,23 +70,28 @@
|
||||
//
|
||||
// timeBox
|
||||
//
|
||||
this.timeBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.timeBox.Anchor =
|
||||
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top |
|
||||
System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.timeBox.BackColor = System.Drawing.Color.White;
|
||||
this.timeBox.Location = new System.Drawing.Point(101, 12);
|
||||
this.timeBox.Location = new System.Drawing.Point(118, 14);
|
||||
this.timeBox.Name = "timeBox";
|
||||
this.timeBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.timeBox.Size = new System.Drawing.Size(116, 23);
|
||||
this.timeBox.TabIndex = 2;
|
||||
this.timeBox.Text = "100";
|
||||
this.toolTip.SetToolTip(this.timeBox, "Base delay between clicks in milliseconds. Must be an even number above 0");
|
||||
this.toolTip.SetToolTip(this.timeBox,
|
||||
"Base delay between clicks in milliseconds. Must be an even number above 0");
|
||||
this.timeBox.TextChanged += new System.EventHandler(this.timeBox_TextChanged);
|
||||
//
|
||||
// keyButton
|
||||
//
|
||||
this.keyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.keyButton.Anchor =
|
||||
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top |
|
||||
System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.keyButton.BackColor = System.Drawing.Color.Red;
|
||||
this.keyButton.Location = new System.Drawing.Point(101, 38);
|
||||
this.keyButton.Location = new System.Drawing.Point(118, 44);
|
||||
this.keyButton.Name = "keyButton";
|
||||
this.keyButton.Size = new System.Drawing.Size(100, 23);
|
||||
this.keyButton.Size = new System.Drawing.Size(117, 27);
|
||||
this.keyButton.TabIndex = 3;
|
||||
this.keyButton.Text = "Click to set key";
|
||||
this.toolTip.SetToolTip(this.keyButton, "Click and press a key to set it as the (de-)activation sequence");
|
||||
@ -95,13 +101,14 @@
|
||||
// delmBox
|
||||
//
|
||||
this.delmBox.AutoSize = true;
|
||||
this.delmBox.Location = new System.Drawing.Point(12, 69);
|
||||
this.delmBox.Location = new System.Drawing.Point(14, 80);
|
||||
this.delmBox.Name = "delmBox";
|
||||
this.delmBox.Size = new System.Drawing.Size(69, 17);
|
||||
this.delmBox.Size = new System.Drawing.Size(75, 19);
|
||||
this.delmBox.TabIndex = 4;
|
||||
this.delmBox.Text = "DelayMix";
|
||||
this.toolTip.SetToolTip(this.delmBox, "Check to generate more human clicks by waiting a random amount of time instead of" +
|
||||
" a fixed amount");
|
||||
this.toolTip.SetToolTip(this.delmBox,
|
||||
"Check to generate more human clicks by waiting a random amount of time instead of" +
|
||||
" a fixed amount");
|
||||
this.delmBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// timer
|
||||
@ -111,9 +118,9 @@
|
||||
// delmVal
|
||||
//
|
||||
this.delmVal.BackColor = System.Drawing.Color.White;
|
||||
this.delmVal.Location = new System.Drawing.Point(101, 67);
|
||||
this.delmVal.Location = new System.Drawing.Point(118, 77);
|
||||
this.delmVal.Name = "delmVal";
|
||||
this.delmVal.Size = new System.Drawing.Size(100, 20);
|
||||
this.delmVal.Size = new System.Drawing.Size(116, 23);
|
||||
this.delmVal.TabIndex = 5;
|
||||
this.delmVal.Text = "4";
|
||||
this.toolTip.SetToolTip(this.delmVal, "Maximum Delay that will be randomly added by DelayMix");
|
||||
@ -122,9 +129,9 @@
|
||||
// fixBox
|
||||
//
|
||||
this.fixBox.AutoSize = true;
|
||||
this.fixBox.Location = new System.Drawing.Point(12, 97);
|
||||
this.fixBox.Location = new System.Drawing.Point(14, 112);
|
||||
this.fixBox.Name = "fixBox";
|
||||
this.fixBox.Size = new System.Drawing.Size(79, 17);
|
||||
this.fixBox.Size = new System.Drawing.Size(87, 19);
|
||||
this.fixBox.TabIndex = 6;
|
||||
this.fixBox.Text = "Fix Position";
|
||||
this.toolTip.SetToolTip(this.fixBox, "Check to use a fixed click position instead of the Cursors position");
|
||||
@ -133,9 +140,9 @@
|
||||
//
|
||||
// fixButton
|
||||
//
|
||||
this.fixButton.Location = new System.Drawing.Point(101, 93);
|
||||
this.fixButton.Location = new System.Drawing.Point(118, 107);
|
||||
this.fixButton.Name = "fixButton";
|
||||
this.fixButton.Size = new System.Drawing.Size(100, 23);
|
||||
this.fixButton.Size = new System.Drawing.Size(117, 27);
|
||||
this.fixButton.TabIndex = 7;
|
||||
this.fixButton.Text = "Set Position";
|
||||
this.toolTip.SetToolTip(this.fixButton, "Set the location where clicks will be simulated");
|
||||
@ -146,9 +153,9 @@
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(213, 126);
|
||||
this.ClientSize = new System.Drawing.Size(260, 157);
|
||||
this.Controls.Add(this.fixButton);
|
||||
this.Controls.Add(this.fixBox);
|
||||
this.Controls.Add(this.delmVal);
|
||||
@ -158,16 +165,15 @@
|
||||
this.Controls.Add(this.rightBox);
|
||||
this.Controls.Add(this.clickBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(229, 165);
|
||||
this.MaximumSize = new System.Drawing.Size(266, 186);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(229, 165);
|
||||
this.MinimumSize = new System.Drawing.Size(266, 186);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "CC-Clicker 2.0";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,52 +1,41 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using CC_Functions.W32;
|
||||
using CC_Functions.W32.Hooks;
|
||||
|
||||
#pragma warning disable IDE1006
|
||||
namespace CC_Clicker_2._0
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
Point loc = Point.Empty;
|
||||
readonly OvPForm ov;
|
||||
public static Button _keyButton;
|
||||
public static bool _isSettingKey = false;
|
||||
public static Keys _key = Keys.LShiftKey;
|
||||
public static bool _isClicking = false;
|
||||
public static int _setDelay = 100;
|
||||
public static int _delmVal = 4;
|
||||
public static CheckBox _clickBox;
|
||||
public MainForm()
|
||||
private static bool _isSettingKey;
|
||||
private const Keys Key = Keys.LShiftKey;
|
||||
private static bool _isClicking;
|
||||
private static int _setDelay = 100;
|
||||
private static int _delmVal = 4;
|
||||
private readonly OvPForm _ov;
|
||||
private Point _loc = Point.Empty;
|
||||
|
||||
public MainForm(KeyboardHook hook)
|
||||
{
|
||||
InitializeComponent();
|
||||
_keyButton = keyButton;
|
||||
_clickBox = clickBox;
|
||||
ov = new OvPForm(loc.X, loc.Y);
|
||||
}
|
||||
|
||||
public static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
|
||||
Button keyButton1 = keyButton;
|
||||
_ov = new OvPForm(_loc.X, _loc.Y);
|
||||
hook.OnKeyPress += (e) =>
|
||||
{
|
||||
int vkCode = Marshal.ReadInt32(lParam);
|
||||
if (_isSettingKey)
|
||||
{
|
||||
_key = (Keys)vkCode;
|
||||
_keyButton.BackColor = Color.FromArgb(224, 224, 224);
|
||||
_clickBox.Enabled = true;
|
||||
_keyButton.Text = ((Keys)vkCode).ToString();
|
||||
keyButton1.BackColor = Color.FromArgb(224, 224, 224);
|
||||
clickBox.Enabled = true;
|
||||
keyButton1.Text = e.Key.ToString();
|
||||
_isSettingKey = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Keys)vkCode == _key)
|
||||
if (e.Key == Key)
|
||||
_isClicking = !_isClicking;
|
||||
}
|
||||
}
|
||||
return CallNextHookEx(_hookID, nCode, wParam, lParam);
|
||||
};
|
||||
}
|
||||
|
||||
private void clickBox_CheckedChanged(object sender, EventArgs e)
|
||||
@ -90,74 +79,38 @@ namespace CC_Clicker_2._0
|
||||
|
||||
private void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (_isClicking)
|
||||
{
|
||||
if (fixBox.Checked)
|
||||
Cursor.Position = loc;
|
||||
mouse_event((uint)(rightBox.Checked ? (MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP) : (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP)), (uint)Cursor.Position.X, (uint)Cursor.Position.Y, 0, 0);
|
||||
if (delmBox.Checked)
|
||||
timer.Interval = Math.Max(_setDelay + (new Random().Next(0, _delmVal) - (_delmVal / 2)), 1);
|
||||
}
|
||||
if (!_isClicking) return;
|
||||
if (fixBox.Checked)
|
||||
Cursor.Position = _loc;
|
||||
Mouse.Click(rightBox.Checked);
|
||||
if (delmBox.Checked)
|
||||
timer.Interval = Math.Max(_setDelay + (new Random().Next(0, _delmVal) - (_delmVal / 2)), 1);
|
||||
}
|
||||
|
||||
private void fixButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ov.Hide();
|
||||
using (LocForm frm = new LocForm())
|
||||
{
|
||||
if (frm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
loc = new Point(frm.X, frm.Y);
|
||||
fixBox.Checked = true;
|
||||
fixButton.BackColor = Color.Green;
|
||||
fixButton.Text = loc.ToString();
|
||||
}
|
||||
}
|
||||
_ov.Hide();
|
||||
using LocForm frm = new LocForm();
|
||||
if (frm.ShowDialog() != DialogResult.OK) return;
|
||||
_loc = new Point(frm.X, frm.Y);
|
||||
fixBox.Checked = true;
|
||||
fixButton.BackColor = Color.Green;
|
||||
fixButton.Text = _loc.ToString();
|
||||
}
|
||||
|
||||
private void fixBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (loc == Point.Empty)
|
||||
{
|
||||
fixBox.Checked = false;
|
||||
fixButton.BackColor = Color.Red;
|
||||
}
|
||||
if (_loc != Point.Empty) return;
|
||||
fixBox.Checked = false;
|
||||
fixButton.BackColor = Color.Red;
|
||||
}
|
||||
|
||||
private void fixButton_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
ov.setPos(loc.X, loc.Y);
|
||||
ov.Show();
|
||||
_ov.SetPos(_loc.X, _loc.Y);
|
||||
_ov.Show();
|
||||
}
|
||||
|
||||
private void fixButton_MouseLeave(object sender, EventArgs e) => ov.Hide();
|
||||
#region DllImports
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
|
||||
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
|
||||
public const int MOUSEEVENTF_LEFTDOWN = 0x02;
|
||||
public const int MOUSEEVENTF_LEFTUP = 0x04;
|
||||
public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
|
||||
public const int MOUSEEVENTF_RIGHTUP = 0x10;
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
static extern IntPtr GetModuleHandle(string lpModuleName);
|
||||
public static IntPtr SetHook(LowLevelKeyboardProc proc)
|
||||
{
|
||||
using (Process curProcess = Process.GetCurrentProcess())
|
||||
using (ProcessModule curModule = curProcess.MainModule)
|
||||
{
|
||||
return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
|
||||
const int WH_KEYBOARD_LL = 13;
|
||||
const int WM_KEYDOWN = 0x0100;
|
||||
public static LowLevelKeyboardProc _proc = HookCallback;
|
||||
public static IntPtr _hookID = IntPtr.Zero;
|
||||
#endregion
|
||||
private void fixButton_MouseLeave(object sender, EventArgs e) => _ov.Hide();
|
||||
}
|
||||
}
|
||||
}
|
11
CC-Clicker 2.0/OvPForm.Designer.cs
generated
11
CC-Clicker 2.0/OvPForm.Designer.cs
generated
@ -32,18 +32,19 @@
|
||||
//
|
||||
// OvPForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
|
||||
this.ClientSize = new System.Drawing.Size(30, 30);
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int) (((byte) (192)))), ((int) (((byte) (192)))),
|
||||
((int) (((byte) (0)))));
|
||||
this.ClientSize = new System.Drawing.Size(35, 35);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "OvPForm";
|
||||
this.Text = "OvPForm";
|
||||
this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
|
||||
this.TransparencyKey = System.Drawing.Color.FromArgb(((int) (((byte) (192)))), ((int) (((byte) (192)))),
|
||||
((int) (((byte) (0)))));
|
||||
this.Load += new System.EventHandler(this.OvPForm_Load);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.OvPForm_Paint);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CC_Functions.W32;
|
||||
|
||||
namespace CC_Clicker_2._0
|
||||
{
|
||||
@ -16,9 +10,10 @@ namespace CC_Clicker_2._0
|
||||
public OvPForm(int x, int y)
|
||||
{
|
||||
InitializeComponent();
|
||||
setPos(x, y);
|
||||
SetPos(x, y);
|
||||
}
|
||||
public void setPos(int x, int y) => Location = new Point(x - (Width / 2), y - (Height / 2));
|
||||
|
||||
public void SetPos(int x, int y) => Location = new Point(x - (Width / 2), y - (Height / 2));
|
||||
|
||||
private void OvPForm_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
@ -26,13 +21,6 @@ namespace CC_Clicker_2._0
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), Width / 2, (Height / 2) - 15, Width / 2, (Height / 2) + 15);
|
||||
}
|
||||
|
||||
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
|
||||
const uint SWP_NOSIZE = 0x0001;
|
||||
const uint SWP_NOMOVE = 0x0002;
|
||||
const uint TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||
private void OvPForm_Load(object sender, EventArgs e) => SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
|
||||
private void OvPForm_Load(object sender, EventArgs e) => this.GetWnd32().Overlay = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CC_Functions.W32.Hooks;
|
||||
|
||||
namespace CC_Clicker_2._0
|
||||
{
|
||||
static class Program
|
||||
internal static class Program
|
||||
{
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool UnhookWindowsHookEx(IntPtr hhk);
|
||||
|
||||
[STAThread]
|
||||
static void Main()
|
||||
private static void Main()
|
||||
{
|
||||
using KeyboardHook hook = new KeyboardHook();
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
MainForm._hookID = MainForm.SetHook(MainForm._proc);
|
||||
Application.Run(new MainForm());
|
||||
UnhookWindowsHookEx(MainForm._hookID);
|
||||
Application.Run(new MainForm(hook));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@ -33,4 +32,4 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Reference in New Issue
Block a user