تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تعديل هذا الكود
#1
كود :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, [Out] StringBuilder lParam);

        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr GetWindow(IntPtr hWnd, GetWindow_Cmd uCmd);
                public string fixString(string str)
        {
            return str.Split(new char[] { ':' })[1].Substring(1);
        }



        public void getWindowText(IntPtr hwnd)
        {
            IntPtr hWnd = FindWindowEx(hwnd, IntPtr.Zero, "#32770", null);
            for (int i = 0; i < 12; i++)
            {
                hWnd = GetWindow(hWnd, GetWindow_Cmd.GW_HWNDNEXT);
            }
            IntPtr ptr3 = FindWindowEx(hWnd, IntPtr.Zero, "Static", null);
            for (int j = 0; j < 80; j++)
            {
                int num3 = (int)SendMessage(ptr3, 14, IntPtr.Zero, null);
                if (num3 > 0)
                {
                    StringBuilder builder;
                    switch (j)
                    {
                        case 20:
                            builder = new StringBuilder(num3 + 1);
                            SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                            Values.Name = this.fixString(builder.ToString());
                            goto Label_02EE;

                        case 0x15:
                            builder = new StringBuilder(num3 + 1);
                            SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                            Values.Level = this.fixString(builder.ToString());
                            goto Label_02EE;

                        case 0x16:
                            builder = new StringBuilder(num3 + 1);
                            SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                            Values.SP = this.fixString(builder.ToString().Replace(',', '.'));
                            goto Label_02EE;

                        case 0x1d:
                            builder = new StringBuilder(num3 + 1);
                            SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                            Values.HP = builder.ToString().Replace(',', '.');
                            goto Label_02EE;

                        case 30:
                            builder = new StringBuilder(num3 + 1);
                            SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                            Values.MP = builder.ToString().Replace(',', '.');
                            goto Label_02EE;

                        case 0x1f:
                            builder = new StringBuilder(num3 + 1);
                            SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                            Values.EXP = builder.ToString();
                            goto Label_02EE;

                        case 0x20:
                            {
                                builder = new StringBuilder(num3 + 1);
                                SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                                string[] strArray = builder.ToString().Split(new char[] { '\n' });
                                Values.Pos = this.fixString(strArray[0]);
                                Values.Loc = strArray[1];
                                goto Label_02EE;
                            }
                        case 0x26:
                            builder = new StringBuilder(num3 + 1);
                            SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                            Values.Ip = builder.ToString().Split(new char[] { '(' })[1].Replace(')', ' ');
                            goto Label_02EE;
                    }
                    builder = new StringBuilder(num3 + 1);
                    SendMessage(ptr3, 13, (IntPtr)builder.Capacity, builder);
                    builder.ToString();
                }
            Label_02EE:
                ptr3 = GetWindow(ptr3, GetWindow_Cmd.GW_HWNDNEXT);
            }
            IntPtr ptr4 = FindWindowEx(hwnd, IntPtr.Zero, "Static", null);
            int capacity = (int)SendMessage(ptr4, 14, IntPtr.Zero, null);
            StringBuilder lParam = new StringBuilder(capacity);
            SendMessage(ptr4, 13, (IntPtr)lParam.Capacity, lParam);
            string[] strArray3 = lParam.ToString().Split(new char[] { '\n' });
            Values.EXPMin = this.fixString(strArray3[1].Replace('\t', ' '));
            Values.EXPHour = this.fixString(strArray3[6].Replace('\t', ' '));
            Values.EXPTotal = this.fixString(strArray3[13].Replace('\t', ' '));
            Values.SPMin = this.fixString(strArray3[2].Replace('\t', ' '));
            Values.SPHour = this.fixString(strArray3[7].Replace('\t', ' '));
            Values.SPTotal = this.fixString(strArray3[14].Replace('\t', ' '));
            Values.KillsMin = this.fixString(strArray3[3].Replace('\t', ' '));
            Values.KillsHour = this.fixString(strArray3[8].Replace('\t', ' '));
            Values.KillsTotal = this.fixString(strArray3[15].Replace('\t', ' '));
            Values.Died = this.fixString(strArray3[0x10].Replace('\t', ' '));
            Values.Gold = this.fixString(strArray3[0x11].Replace('\t', ' ').Replace(',', '.'));
            Values.Drops = this.fixString(strArray3[0x12].Replace('\t', ' '));
        }




        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
الخطئ فى GetWindow_Cmd ما هو الحل ؟
الرد }}}}
تم الشكر بواسطة:
#2
ما هي رسالة الخطأ ؟
صل من قطعك , واعط من منعك , وإعف عن من ظلمك Big Grin
الرد }}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [سؤال] ممكن شرح مبسط لهذا الكود ابو روضة 6 588 31-07-16, 04:47 PM
آخر رد: سعود
  تصحيح هذا الكود أسامة 2 145 05-07-16, 07:06 PM
آخر رد: أسامة
  مساعدة في الكود الذي يفتح لي النموذج Form2 عند الضغط على الايقونة button1 aaddeel 3 156 01-07-16, 04:27 AM
آخر رد: aaddeel
Thumbs Up [سؤال] [تم الحل] تعديل في سورس كود لمكتبة لا تدعم العربي Easy4ever 21 4,510 16-12-15, 09:21 AM
آخر رد: myalsailamy
  [نقاش] كيف يمكن التغلب على مسألة تعديل بنية البرنامج ؟ عبد الله 7 447 29-09-15, 07:38 AM
آخر رد: عبد الله
  [سؤال] ماهي الاخطاء التي تتواجد في الكود ؟ 0theghost0 0 462 25-02-15, 12:36 PM
آخر رد: 0theghost0
  [C#.NET] تعديل البيانات في الداتاغريد فيو غير مرتبطة بداتا سورس info@cnr 0 326 05-02-15, 12:24 PM
آخر رد: info@cnr
  [C#.NET] تعديل خصائص فورم من فورم أخر info@cnr 4 985 06-01-15, 06:05 PM
آخر رد: info@cnr
  [سؤال] عن برنامج تحميل من الانترنت من خلال الكود mybbarab 5 1,057 18-10-14, 12:24 AM
آخر رد: mybbarab
  [كود] تعديل Control.WndProc Method أسامة 6 704 11-09-14, 11:31 PM
آخر رد: vbnet

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم