להורדה | תוכנה לשליטה בנוקיה
-
@מישהו12 זה הקוד (בc#)
WindowsFormsApp1.rarזה הקוד מקובץ Form1.cs (שם נמצא רוב הקוד)using System; using System.Diagnostics; using System.Drawing; using System.IO.Ports; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp1 { public partial class Form1 : Form { #region DllImport //[DllImport("user32.dll")] //static extern int GetWindowTextLength(IntPtr hWnd); [DllImport("user32.dll")] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); [DllImport("user32.dll")] private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); [DllImport("user32.dll")] private static extern bool SetLayeredWindowAttributes(IntPtr hWnd, int crKey, byte bAlpha, int dwFlags); [DllImport("user32.dll")] private static extern int GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll")] static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); [DllImport("user32.dll")] static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); [DllImport("user32.dll")] private static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam); [DllImport("user32.dll")] private static extern bool EnumChildWindows(IntPtr hwndParent, EnumWindowsProc lpEnumFunc, IntPtr lParam); private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam); [DllImport("user32.dll")] static extern IntPtr GetDC(IntPtr hwnd); [DllImport("user32.dll")] static extern IntPtr ReleaseDC(IntPtr hwnd, IntPtr hdc); [DllImport("gdi32.dll")] static extern IntPtr CreateCompatibleDC(IntPtr hdc); [DllImport("gdi32.dll")] static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight); [DllImport("gdi32.dll")] static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj); [DllImport("gdi32.dll")] static extern bool BitBlt(IntPtr hdcDest, int xDest, int yDest, int wDest, int hDest, IntPtr hdcSource, int xSrc, int ySrc, CopyPixelOperation rop); [DllImport("gdi32.dll")] static extern bool DeleteDC(IntPtr hdc); [DllImport("gdi32.dll")] static extern bool DeleteObject(IntPtr hObject); [DllImport("user32.dll")] private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); #endregion SerialPort sp; IntPtr hApp = IntPtr.Zero; IntPtr hFrm = IntPtr.Zero; IntPtr hPnl = IntPtr.Zero; IntPtr hMkScrnDmpBtn = IntPtr.Zero; IntPtr hPnCnctBtn = IntPtr.Zero; public Form1() { InitializeComponent(); /*foreach (string pn in SerialPort.GetPortNames()) { sp = new SerialPort(pn) { WriteTimeout = 100, NewLine = "\r\n" }; try { sp.Open(); sp.WriteLine("AT+CKPD=\":p\""); sp.Close(); break; } catch {} }*/ Process nsdPrc = Process.Start("nsd"); nsdPrc.WaitForInputIdle(); FormClosing += (s, e) => nsdPrc.Kill(); hApp = nsdPrc.MainWindowHandle; //IntPtr hGrp = IntPtr.Zero; //bool phoneConnected = false; EnumWindows((hWnd, lParam) => { uint pid; GetWindowThreadProcessId(hWnd, out pid); if (pid == nsdPrc.Id) { hFrm = hWnd; return false; } return true; }, IntPtr.Zero); EnumChildWindows(hFrm, (hWnd, lParam) => { StringBuilder windowTextBuilder = new StringBuilder(40); GetWindowText(hWnd, windowTextBuilder, 40); string windowText = windowTextBuilder.ToString(); StringBuilder classNameBuilder = new StringBuilder(40); GetClassName(hWnd, classNameBuilder, 40); string className = classNameBuilder.ToString(); switch (className) { case "TPanel": hPnl = hWnd; break; case "TBitBtn": if (windowText == "Make ScreenDump") hMkScrnDmpBtn = hWnd; else if (windowText == "Phone Connect") hPnCnctBtn = hWnd; break; //case "TGroupBox": // hGrp = hWnd; // phoneConnected = windowText.Length > 0; // break; } return true; }, IntPtr.Zero); SetWindowLong(hFrm, -20, GetWindowLong(hFrm, -20) | 0x80000); SetLayeredWindowAttributes(hFrm, 0, 0, 0x2); SetWindowLong(hApp, -20, GetWindowLong(hApp, -20) | 0x80); ScreenDumpTask(); WakeScreenTask(); PictureBox[] keys = { k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k20, k21 }; PictureBox[] keysHighligt = { k1h, k2h, k3h, k4h, k5h, k6h, k7h, k8h, k9h, k10h, k11h, k12h, k13h, k14h, k15h, k16h, k17h, k18h, k19h, k20h, k21h }; string kcmds = "123456789*0#spm^v><[]"; for (int i = 0; i < keys.Length; i++) { int j = i; keys[i].MouseEnter += (s, e) => keysHighligt[j].Visible = true; keysHighligt[i].MouseLeave += (s, e) => keysHighligt[j].Visible = false; keysHighligt[i].Cursor = Cursors.Hand; keysHighligt[i].MouseClick += (s, e) => { if (e.Button == MouseButtons.Left) { while (true) { try { sp.Open(); sp.WriteLine($"AT+CKPD=\"{kcmds[j]}\""); sp.Close(); break; } catch { if (MessageBox.Show("הטלפון לא מחובר", "שגיאת התחברות", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading) == DialogResult.Cancel) break; } } } }; } SaveFileDialog sfd = new SaveFileDialog() { InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop), Filter = "*.png|*.png" }; btnSaveScreen.Click += (s, e) => { Graphics g = Graphics.FromImage(picPhone.Image); Bitmap bmp = new Bitmap(picScreen.Width, picScreen.Height); picScreen.DrawToBitmap(bmp, new Rectangle(0, 0, picScreen.Width, picScreen.Height)); g.DrawImage(bmp, 36, 81, picScreen.Width, picScreen.Height); sfd.FileName = ""; if (sfd.ShowDialog() == DialogResult.OK) picPhone.Image.Save(sfd.FileName); }; btnSaveZoomScreen.Click += (s, e) => { sfd.FileName = ""; if (sfd.ShowDialog() == DialogResult.OK) picZoomScreen.Image.Save(sfd.FileName); }; btnCall.Click += (s, e) => { while (true) { try { sp.Open(); sp.WriteLine($"ATD{txtPhoneNumber.Text}{(chkSendMyPhoneNumber.Checked ? "i" : "I")};"); sp.Close(); break; } catch { if (MessageBox.Show("הטלפון לא מחובר", "שגיאת התחברות", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading) == DialogResult.Cancel) break; } } }; } private async void ScreenDumpTask() { await Task.Run(async () => { while (true) { SendMessage(hPnCnctBtn, 0x201, IntPtr.Zero, IntPtr.Zero); SendMessage(hPnCnctBtn, 0x202, IntPtr.Zero, IntPtr.Zero); SendMessage(hMkScrnDmpBtn, 0x201, IntPtr.Zero, IntPtr.Zero); SendMessage(hMkScrnDmpBtn, 0x202, IntPtr.Zero, IntPtr.Zero); int bLeft = 8; int bTop = 9; int bWidth = 240; int bHeight = 320; IntPtr hdc = GetDC(hPnl); IntPtr hdcDest = CreateCompatibleDC(hdc); IntPtr hBitmap = CreateCompatibleBitmap(hdc, bWidth, bHeight); IntPtr hOld = SelectObject(hdcDest, hBitmap); BitBlt(hdcDest, 0, 0, bWidth, bHeight, hdc, bLeft, bTop, (CopyPixelOperation)0x00CC0020); SelectObject(hdcDest, hOld); DeleteDC(hdcDest); ReleaseDC(hPnl, hdc); picScreen.Image = picZoomScreen.Image = Image.FromHbitmap(hBitmap); DeleteObject(hBitmap); await Task.Delay(1); } }); } private async void WakeScreenTask() { await Task.Run(async () => { while (true) { try { if (sp != null) { sp.Open(); sp.WriteLine("AT+CKPD=\":p\""); sp.Close(); } else { foreach (string pn in SerialPort.GetPortNames()) { sp = new SerialPort(pn) { WriteTimeout = 100, NewLine = "\r\n" }; try { sp.Open(); sp.WriteLine("AT+CKPD=\":p\""); sp.Close(); break; } catch { } } } } catch {} await Task.Delay(5000); } }); } } }
הקוד קורא להרבה פונקציות win32 (כדי לקבל את התמונות מnsd, ללחוץ על הלחצנים שלו ולהסתיר אותו).
ובנוסף יש את serialport שזה שולח פקודות לטלפון (לדוגמאsp.WriteLine("AT+CKPD=\"5\"");
נותן פקודה ללחוץ על מקש 5) -
@נ-נח כתב בלהורדה | תוכנה לשליטה בנוקיה:
בס"ד
בניתי את התוכנה לכיף, זה לא כל כך מועיל עם הגזירה של משרד התקשורת...האפשרויות שקיימות כעת בתוכנה:
- "לחיצה" על מקשי הטלפון
- שמירת התמונה
- חיוג למספר טלפון
התוכנה מבוססת על nsdלהורדה
נ.ב. הטלפון בתוכנה הוא בלי מקשים בעברית (כי לא מצאתי תמונה טובה)
זה עובד גם בחיבור בלוטוס'?
-