using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Drawing.Imaging; namespace Omega { public partial class Form1 : Form { public Form1() { InitializeComponent(); int[] f2p = { 0, 1, 0, 3, 4, 5, 0, 7, 8, 0, 10, 11, 0, 13, 14, 15, 16, 17, 0, 19, 20, 21, 0, 0, 0, 25, 0, 0, 0, 29, 30, 0, 32, 33, 34, 35, 0, 37, 38, 39, 40, 0, 0, 43, 0, 45, 0, 47, 0, 49, 50, 51, 52, 0, 0, 55, 0, 57, 0, 0, 0, 61, 62, 63, 0, 0, 0, 67, 68, 0, 0, 0, 72, 73, 74, 75, 0, 0, 0, 0, 80, 81, 0, 0, 0, 85, 86, 87, 0, 0, 90, 0, 0, 93, 94, 95, 96, 0, 0, 0, 0, 101, 102, 0, 0, 105, 106, 107, 108, 109, 0, 0, 0, 113, 0, 0, 0, 117, 118, 119, 0, 0, 122, 0, 0, 125, 0, 127, 128, 0, 0, 0, 0 }; int n = 133; ToolStripMenuItem temp; for (int i=1; i= 25 && i < 51) worlds2650ToolStripMenuItem.DropDownItems.Add(temp); else if (i >= 51 && i < 76) worlds5175ToolStripMenuItem.DropDownItems.Add(temp); else if (i >= 76 && i < 101) worlds75100ToolStripMenuItem.DropDownItems.Add(temp); else if (i >= 101 && i < 126) worlds101125ToolStripMenuItem.DropDownItems.Add(temp); else if (i >= 126 && i < 133) worlds126132ToolStripMenuItem.DropDownItems.Add(temp); temp.Click += new System.EventHandler(World_Click); } for (int i = 26; i < n; i++) { temp = new ToolStripMenuItem(); temp.Name = "World" + i; temp.Text = "World " + i; if (f2p[i] == i) { temp.Image = Omega.Properties.Resources.freeIcon; } else { temp.Image = Omega.Properties.Resources.membersIcon; } worlds125ToolStripMenuItem.DropDownItems.Add(temp); temp.Click += new System.EventHandler(World_Click); } switch (AppOptions.Instance.GetOption("ShowChat").ToLower()) { case "true": this.Height = 720; break; case "false": this.Height = 579; break; } if (AppOptions.Instance.GetOption("doomMusic") == "NEDM") { webBrowser1.Navigate("http://nedmspray.ytmnd.com/"); } else { } } private void World_Click(object sender, System.EventArgs e) { // WorldURL = "http://" & WorldServer & ".runescape.com/lang/en/aff/runescape/game.ws?lowmem=" & Detail & "&plugin=0"; ToolStripMenuItem temp; temp = (ToolStripMenuItem)sender; string strWorld = temp.Text; strWorld = strWorld.Replace("World", ""); strWorld = strWorld.Trim(); int WorldNo = Convert.ToInt32(strWorld); //So there you have it. The World number is now stored in "WorldNo". //From here, do the normal procedure like you would do anyhow" } #region screenshot public Image CaptureScreen() { return CaptureWindow(User32.GetDesktopWindow()); } /// /// Creates an Image object containing a screen shot of a specific window /// /// The handle to the window. (In windows forms, this is obtained by the Handle property) /// public Image CaptureWindow(IntPtr handle) { // get te hDC of the target window IntPtr hdcSrc = User32.GetWindowDC(handle); // get the size User32.RECT windowRect = new User32.RECT(); User32.GetWindowRect(handle, ref windowRect); int width = windowRect.right - windowRect.left; int height = windowRect.bottom - windowRect.top; // create a device context we can copy to IntPtr hdcDest = GDI32.CreateCompatibleDC(hdcSrc); // create a bitmap we can copy it to, // using GetDeviceCaps to get the width/height IntPtr hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, width, height); // select the bitmap object IntPtr hOld = GDI32.SelectObject(hdcDest, hBitmap); // bitblt over GDI32.BitBlt(hdcDest, 0, 0, width, height, hdcSrc, 0, 0, GDI32.SRCCOPY); // restore selection GDI32.SelectObject(hdcDest, hOld); // clean up GDI32.DeleteDC(hdcDest); User32.ReleaseDC(handle, hdcSrc); // get a .NET image object for it Image img = Image.FromHbitmap(hBitmap); // free up the Bitmap object GDI32.DeleteObject(hBitmap); return img; } /// /// Captures a screen shot of a specific window, and saves it to a file /// /// /// /// public void CaptureWindowToFile(IntPtr handle, string filename, ImageFormat format) { Image img = CaptureWindow(handle); img.Save(filename, format); } /// /// Captures a screen shot of the entire desktop, and saves it to a file /// /// /// public void CaptureScreenToFile(string filename, ImageFormat format) { Image img = CaptureScreen(); img.Save(filename, format); } /// /// Helper class containing Gdi32 API functions /// private class GDI32 { public const int SRCCOPY = 0x00CC0020; // BitBlt dwRop parameter [DllImport("gdi32.dll")] public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hObjectSource, int nXSrc, int nYSrc, int dwRop); [DllImport("gdi32.dll")] public static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int nWidth, int nHeight); [DllImport("gdi32.dll")] public static extern IntPtr CreateCompatibleDC(IntPtr hDC); [DllImport("gdi32.dll")] public static extern bool DeleteDC(IntPtr hDC); [DllImport("gdi32.dll")] public static extern bool DeleteObject(IntPtr hObject); [DllImport("gdi32.dll")] public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject); } /// /// Helper class containing User32 API functions /// private class User32 { [StructLayout(LayoutKind.Sequential)] public struct RECT { public int left; public int top; public int right; public int bottom; } [DllImport("user32.dll")] public static extern IntPtr GetDesktopWindow(); [DllImport("user32.dll")] public static extern IntPtr GetWindowDC(IntPtr hWnd); [DllImport("user32.dll")] public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC); [DllImport("user32.dll")] public static extern IntPtr GetWindowRect(IntPtr hWnd, ref RECT rect); } #endregion private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { this.Text = "\"Omega\" M1 || " + webBrowser1.DocumentTitle; } private void takeScreenshotToolStripMenuItem_Click(object sender, EventArgs e) { string scrnum = AppOptions.Instance.GetOption("ScreenShotInt"); string scrformat = AppOptions.Instance.GetOption("ScreenShotFormat"); int scrint = Convert.ToInt32(scrnum); string pathtoscrdir = AppOptions.Instance.GetOption("ScreenShotDir"); CaptureWindowToFile(this.Handle, pathtoscrdir + "Omega" + scrnum.ToString() + "." + scrformat, ImageFormat.Png); int scrafter = scrint + 1; string idupdate = scrafter.ToString(); AppOptions.Instance.SetOption("ScreenShotInt", idupdate); } } }