C# Gdi Overlay Source

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Uzman Üye
Katılım
6 Mar 2016
Mesajlar
187
Tepki puanı
24
Ödüller
7
10 HİZMET YILI
Çoğu Kod Videodan Bakılmıştır Diğerleri Yardım Alınarak.
Edit:en aşşağıdaki top most kodu biraz sıkıntılıdır nedenini bilmiyorum
-------------------------------------------------------------------------------
PHP:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace projeadı
{
    public partial class formadı : Form
    {
        RECT rect;
        public const string WINDOW_NAME = "oyun adı";
        IntPtr handle = FindWindow(null, WINDOW_NAME);

           public struct RECT
        {
            public int left, top, right, bottom;
        }


        [DllImport("user32.dll")]
        private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

        [DllImport("user32.dll", SetLastError = true)]
        private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr FindWindow(string ipClassName, string ipWindowName);

        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);

        [DllImport("user32.dll")]
        static extern IntPtr GetForegroundWindow();

        [DllImport("user32.dll")]
        static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);


        private void formadı_Load(object sender, EventArgs e)
        {
            this.BackColor = Color.Wheat; //System.Drawing.Color.Black; Daha iyi Gözükür
            this.TransparencyKey = Color.Wheat; //System.Drawing.Color.Black; Daha iyi Gözükür
            this.TopMost = true; //açıldığında devamlı önde kalmasını sağlar
            this.FormBorderStyle = FormBorderStyle.None; //programın penceri kısmını siler
            this.ShowInTaskbar = false; //görev çubuğunda gözükmemesini sağlar
            this.DoubleBuffered = true; //titrememesini sağlar

            int initialStyle = GetWindowLong(this.Handle, -20);
            SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20); //mousenin formun içinde geçmesini sağlar


 
        private string GetActiveWindowTitle()
        {
            const int nChars = 256;
            StringBuilder Buff = new StringBuilder(nChars);
            IntPtr handle = GetForegroundWindow();

            if (GetWindowText(handle, Buff, nChars) > 0)
            {
                return Buff.ToString();
            }
            return null;
        }

        //bunuda timere yazıcaksınız bu kod oyun penceresinin kordinatını alıp formu devamlı orda tutar ayrıca timerin intervalını 1 yapmayı unutmayın

        {
                GetWindowRect(handle, out rect);
                this.Top = rect.top;
                this.Left = rect.left;
         }



            //buda timere yazılacak eğer oyun kapalıysa otomatikmen program kapanır

            Process[] p = Process.GetProcessesByName("oyun ismi);
            // If Notting Found (Length = 0)
            if (p.Length == 0)
            {
                Application.Exit();
            }


            //timere yazılacak kod ,bu kod oyun öndeyse formu devamlı önde tutar arkadaysa arkada tutar

            if (GetActiveWindowTitle() == "oyunun ismi")
            {
                this.TopMost = true;
            }
            else
            {
                this.TopMost = false;
            }
 
Son düzenleme:
Uzman Üye
Katılım
2 Şub 2016
Mesajlar
252
Tepki puanı
12
10 HİZMET YILI
O zaman kodlamada sorun vardır kodlar karışmıştır ! (line 61).satırda sorun olabilir bir bakın derim.
 
Onaylı Üye
Katılım
3 Ağu 2017
Mesajlar
61
Tepki puanı
11
Yaş
28
8 HİZMET YILI
Onun yerine autoıt kullanmak daha mantıklı değilmi
 
<Ç0rumlu>
Ultra Üye
Katılım
19 May 2016
Mesajlar
1,546
Tepki puanı
135
Ödüller
10
Yaş
29
10 HİZMET YILI
Eyw Teşekkürler Yararlı Bir Paylaşım
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...