Release CCM Counter

Tusta

Head Member
Donator
Messages
13
Points
164
CCM Counter :VerTical:
CCM Counter is created in 10 minutes with Visual Studio 2017 in vc#.

Download: is attached.
Virus Scan: not needed because i have add the source.

features:
  • Members counter
  • Awesome design
  • Included source code
  • Good performance
Image:

Source:

Code:
using System;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CCM_Counter_2
{
    public partial class Counter : Form
    {
        [DllImportAttribute("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

        [DllImportAttribute("user32.dll")]
        public static extern bool ReleaseCapture();

        public String Count { get; set; } = "0";

        public Thread Run { get; set; }

        public Counter()
        {
            InitializeComponent();

            ButtonClose.Click += (Object Obj, EventArgs Event) =>
            {
                this.Focus();
                Application.Exit();
                Run.Abort();
            };

            Grid.Paint += (Object Obj, PaintEventArgs Paint) =>
            {
                using (Graphics G = Paint.Graphics)
                {
                    G.DrawString(String.Format("CCM Counter - {0}", Environment.UserName),
                        this.Font, Brushes.Gainsboro, 0, 2);
                    G.Dispose();
                }
            };

            Grid.MouseDown += (Object Obj, MouseEventArgs Mouse) =>
            {
                if(Mouse.Button is MouseButtons.Left)
                {
                    ReleaseCapture();
                    SendMessage(Handle, 0xA1, 0x2, 0);
                }
            };

            Area.Paint += (Object Obj, PaintEventArgs Paint) =>
            {
                using (Graphics G = Paint.Graphics)
                {
                    G.DrawString(String.Format("Members: {0}", Count as String),
                        new Font("Segoe UI", 15F, FontStyle.Regular),
                        Brushes.Gainsboro, 10, 10);
                    G.Dispose();
                }
            };

            CheckForIllegalCrossThreadCalls = false;
            Run = new Thread(new ThreadStart(() => {
                do
                {
                    MemberCounter();
                    Thread.Sleep(1000);
                    Area.Refresh();
                }
                while (true);
            }));
            Run.Start();
        }

        private void MemberCounter()
        {
            try
            {
                using (WebClient Client = new WebClient())
                {
                    var HTML = Client.DownloadString("https://cabconmodding.com/") as String;
                    int Position = HTML.IndexOf("<dl class=\"memberCount\">") + 46;
                    String MemberCount = HTML.Substring(Position, 20);
                    String Value = String.Join("", MemberCount.ToCharArray().Where(Char.IsDigit));

                    Count = (Value);
                }
            }
            catch (Exception Error)
            {
                Count = (Error.Message);
            }
        }
    }
}

VerTical.



 

Attachments

Last edited:

Freezee

Moderator
Staff member
Messages
184
Points
423
Why'd you use the dll's?, they weren't really needed. Other then maybe performance wise.
 

Similar threads


Top