View Poll Results: Do you think this will work?

Voters
4. This poll is closed
  • Yes

    3 75.00%
  • No

    1 25.00%
Results 1 to 11 of 11
  1. #1
    User1's Avatar
    Join Date
    Jul 2009
    Gender
    female
    Location
    Above the influence
    Posts
    4,085
    Reputation
    61
    Thanks
    4,294,967,295
    My Mood
    Crappy

    My C# Menu Class

    Hey guys, I attempted to get a menu working on my C# hack but I couldn't get the d3d device so I just gave up. I'ma just give up here after a few hours of googling, there seems to be no simple solution I could use. If anyone manages to get it, please help me out. Otherwise here is my menu code... It might not work as I can't test it without getting the device.

    This is a basic port of Void's menu, Void also helped me out on a lot of the menu...

    To C&P'ers, theres no point as this code will not work without a device.

    Note: This code supports display numeral values as well as On/Off, the number can only go up to 10, but you can easily change that.

    [PHP]//User1's C# Menu Class, ported from Void's menu class.
    //Please give credits when used.
    //This code might catastrophically fail as I never tried this...

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;
    using Microsoft.DirectX;
    using Microsoft.DirectX.Direct3D;


    namespace CombatArmsHack
    {
    class Menu
    {
    //Please tell me you understand the below code...
    [DllImport("user32.dll")]
    static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);

    private System.Drawing.Font menuFont = new System.Drawing.Font("Comic Sans MS", 15); //The font to set the D3D Font to...

    private Device m_Device; //D3D Device, if you can get this Managed or Unmanaged, please contact me.
    private Font m_Font; //D3D Font
    public List<MenuItem> MenuItems = new List<MenuItem>();


    //Creates the font and sets the device
    public Menu(Device device)
    {
    m_Device = device;
    m_Font = new Font(m_Device,menuFont);
    }
    //Add a new Item to the Menu.
    public void AddItem(string Text, int State, bool Logic)
    {
    MenuItem NewItem = new MenuItem();
    NewItem.Text = Text;
    NewItem.State = State;
    NewItem.Logic = Logic;

    MenuItems.Add(NewItem);
    }
    //Draws menu.
    public void RenderMenu()
    {
    //Rectangle where one of the menu items will be rendered
    System.Drawing.Rectangle CurRect = new System.Drawing.Rectangle(20,20,150,20);

    for(int i = 0; i < MenuItems.Count;i++)
    {
    bool Selected = MenuItems[i].Selected;
    int State = MenuItems[i].State;
    bool Logic = MenuItems[i].Logic;
    string Text = MenuItems[i].Text;


    if(Selected)
    {//Item is Selected
    m_Font.DrawText(null,Text,CurRect,DrawTextFormat.L eft,System.Drawing.Color.Lime);
    if(Logic)
    {//Item is On/Off
    if(State == 0)
    {//Item Off
    m_Font.DrawText(null,"Off",CurRect,DrawTextFormat. Right,System.Drawing.Color.Red);
    }
    else
    {//Item On
    m_Font.DrawText(null,"On",CurRect,DrawTextFormat.R ight,System.Drawing.Color.White);
    }
    }
    else
    {//If Not boolean, draw value
    m_Font.DrawText(null,State.ToString(),CurRect,Draw TextFormat.Right,System.Drawing.Color.White);
    }
    }
    else
    {//Normal Item
    m_Font.DrawText(null,Text,CurRect,DrawTextFormat.L eft,System.Drawing.Color.CornflowerBlue);
    if(Logic)
    {//Item is On/Off
    if(State == 0)
    {//Item Off
    m_Font.DrawText(null,"Off",CurRect,DrawTextFormat. Right,System.Drawing.Color.Red);
    }
    else
    {//Item On
    m_Font.DrawText(null,"On",CurRect,DrawTextFormat.R ight,System.Drawing.Color.White);
    }
    }
    else
    {//Draw Number
    m_Font.DrawText(null,State.ToString(),CurRect,Draw TextFormat.Right,System.Drawing.Color.White);
    }
    }
    CurRect.Y += 17; //Shift rectangle down so the text does not get clipped.
    }
    }
    //Takes care of which menu item is selected, and if it is on or off.
    public void Controls()
    {
    int CurIndex = 0;
    if(GetAsyncKeyState(System.Windows.Forms.Keys.Down ) != 0)
    {
    CurIndex++;
    if (CurIndex > MenuItems.Count - 1)
    {
    CurIndex = MenuItems.Count - 1;
    }
    MenuItems[CurIndex].Selected = true;
    try
    {
    MenuItems[CurIndex - 1].Selected = false;
    }
    catch (Exception) { }
    }
    if (GetAsyncKeyState(System.Windows.Forms.Keys.Up) != 0)
    {
    CurIndex--;
    if (CurIndex < 0)
    {
    CurIndex = 0;
    }
    MenuItems[CurIndex].Selected = true;
    try
    {
    MenuItems[CurIndex + 1].Selected = false;
    }
    catch (Exception) { }
    }
    if (GetAsyncKeyState(System.Windows.Forms.Keys.Right) != 0)
    {
    int CurState = MenuItems[CurIndex].State;
    if (MenuItems[CurState].Logic)
    {//If Boolean
    if (CurState == 0)
    {
    CurState++;
    }
    else
    {
    CurState = 0;
    }
    }
    else
    {//Numeral Value
    CurState++;
    if (CurState > 10)
    {
    CurState = 10;
    }
    }
    }
    if (GetAsyncKeyState(System.Windows.Forms.Keys.Left) != 0)
    {
    int CurState = MenuItems[CurIndex].State;
    if (MenuItems[CurState].Logic)
    {//If Boolean
    if (CurState == 0)
    {
    CurState = 1;
    }
    else
    {
    CurState = 0;
    }
    }
    else
    {//Numeral Value
    CurState--;
    if (CurState < 0)
    {
    CurState = 0;
    }
    }
    }
    }

    public void Release()
    {//Release Unmanaged memory.
    m_Font.Dispose();
    m_Device.Dispose();
    }
    }

    //Menu Items
    class MenuItem
    {
    public string Text; //Text to Display
    public bool Selected; //Highlight?
    public int State; //On/Off/Number
    //If Logic is true, 0 = Off, 1 = On. Else it is a number
    public bool Logic; //State is Bool or Num?
    //If Logic = True, then the menu will display the State as On/Off.
    }
    }
    [/PHP]

    I hope one day someone can put this to good use, and again please help me get the D3D Device if possible...

    Yes I know this code might be an epic fail as well, I'm not at all experienced with DX, or MDX.
    Any donations would help


    Quote Originally Posted by Bombsaway707

    HOLY SHIT ITS USER1
    Quote Originally Posted by Blood

    HOLY SHIT ITS USER1
    Quote Originally Posted by Alby-kun


    HOLY SHIT ITS USER1
    Quote Originally Posted by Ali

    HOLY SHIT ITS USER1
    Quote Originally Posted by CodeDemon
    HOLY SHIT ITS USER1
    Quote Originally Posted by Jussofresh View Post
    HOLY SHIT ITS USER1!
    [21:13] CoderNever: HOLY SHIT ITS USER1!
    Yes it is me... Yup Yup




  2. #2
    Dreamer's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Seattle
    Posts
    8,746
    Reputation
    333
    Thanks
    1,456
    My Mood
    Breezy
    NICE RELEASE BUT ITS A MISTAKE RELEASING IT!!! ALL YOUR HARD WORK
    Resource Team: Feb/5/2012 - May/5/2012
    Middleman: April/25/2012 - September/16/12


  3. #3
    CoderNever's Avatar
    Join Date
    Feb 2009
    Gender
    female
    Location
    https://mpgh.net MPGHCash: $700,458,011
    Posts
    1,197
    Reputation
    131
    Thanks
    2,235
    My Mood
    Buzzed
    This looks real hard man
    I Apologize for my latest release "CN Hack 7-11-11" I assure you it is not up to "CN Standard", and I feel bad due to all its flaws. I'm working hard, and steadily to remake it for I can bring everyone a hack they will really like!


    Support NSY Inject

    CoderNever
    GameArena
    _Fk127_
    ViSiON
    -Lunar_
    Bubbles Kittys

    Code:
    ¢N Mike says
    Cyber Bulling is bad
    J Whit says
    Yea bob wants to fuck my pussy
    ¢N Mike says
    Whit
    dont be a cyber bully
    J Whit says
    FUCK YOU
    ¢N Mike says
    Words hurt
    ѱ NOOB says
    whit gets bullied in school so he goes online and bullies kids online
    J Whit says
    DUH
    Stress relieve
    relieving
    The kintergarden kids beat my ass
    ¢N Mike says
    Thats just sad

  4. #4
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,170
    Reputation
    490
    Thanks
    2,253
    Thanks For Sharing Mate...

  5. #5
    User1's Avatar
    Join Date
    Jul 2009
    Gender
    female
    Location
    Above the influence
    Posts
    4,085
    Reputation
    61
    Thanks
    4,294,967,295
    My Mood
    Crappy
    NP, a days work released into public domain... Not bad.
    Any donations would help


    Quote Originally Posted by Bombsaway707

    HOLY SHIT ITS USER1
    Quote Originally Posted by Blood

    HOLY SHIT ITS USER1
    Quote Originally Posted by Alby-kun


    HOLY SHIT ITS USER1
    Quote Originally Posted by Ali

    HOLY SHIT ITS USER1
    Quote Originally Posted by CodeDemon
    HOLY SHIT ITS USER1
    Quote Originally Posted by Jussofresh View Post
    HOLY SHIT ITS USER1!
    [21:13] CoderNever: HOLY SHIT ITS USER1!
    Yes it is me... Yup Yup




  6. The Following User Says Thank You to User1 For This Useful Post:

    WindowsVista (08-17-2010)

  7. #6
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,196
    Reputation
    205
    Thanks
    1,439
    My Mood
    Mellow
    Yup, after the whole day of him spamming me for help, he just gives up. |:

  8. #7
    User1's Avatar
    Join Date
    Jul 2009
    Gender
    female
    Location
    Above the influence
    Posts
    4,085
    Reputation
    61
    Thanks
    4,294,967,295
    My Mood
    Crappy
    Quote Originally Posted by Void View Post
    Yup, after the whole day of him spamming me for help, he just gives up. |:
    Wana help me out and show me how to get the device?
    Any donations would help


    Quote Originally Posted by Bombsaway707

    HOLY SHIT ITS USER1
    Quote Originally Posted by Blood

    HOLY SHIT ITS USER1
    Quote Originally Posted by Alby-kun


    HOLY SHIT ITS USER1
    Quote Originally Posted by Ali

    HOLY SHIT ITS USER1
    Quote Originally Posted by CodeDemon
    HOLY SHIT ITS USER1
    Quote Originally Posted by Jussofresh View Post
    HOLY SHIT ITS USER1!
    [21:13] CoderNever: HOLY SHIT ITS USER1!
    Yes it is me... Yup Yup




  9. #8
    scimmyboy's Avatar
    Join Date
    Jan 2008
    Gender
    male
    Location
    https://mpgh.net MPGHCash: $442,596,199
    Posts
    5,649
    Reputation
    26
    Thanks
    895
    My Mood
    Happy
    this is why u dont do C#

  10. #9
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,035
    Reputation
    340
    Thanks
    2,786
    My Mood
    Sad
    Lol, now you need another C++ DLL to activate the CLR runtime and host your C# DLL in it.

  11. #10
    User1's Avatar
    Join Date
    Jul 2009
    Gender
    female
    Location
    Above the influence
    Posts
    4,085
    Reputation
    61
    Thanks
    4,294,967,295
    My Mood
    Crappy
    Quote Originally Posted by freedompeace View Post
    Lol, now you need another C++ DLL to activate the CLR runtime and host your C# DLL in it.
    Done long time ago... Thats the whole base of my project LOL
    Any donations would help


    Quote Originally Posted by Bombsaway707

    HOLY SHIT ITS USER1
    Quote Originally Posted by Blood

    HOLY SHIT ITS USER1
    Quote Originally Posted by Alby-kun


    HOLY SHIT ITS USER1
    Quote Originally Posted by Ali

    HOLY SHIT ITS USER1
    Quote Originally Posted by CodeDemon
    HOLY SHIT ITS USER1
    Quote Originally Posted by Jussofresh View Post
    HOLY SHIT ITS USER1!
    [21:13] CoderNever: HOLY SHIT ITS USER1!
    Yes it is me... Yup Yup




  12. #11
    kutzki's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Canada
    Posts
    647
    Reputation
    81
    Thanks
    107
    My Mood
    Pensive
    DUDE NICE CODING MAN!!! I SEE NOW WHAT you were working on...

Similar Threads

  1. [Source Code] Delphi Menu Class
    By Departure in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 25
    Last Post: 06-10-2011, 08:22 PM
  2. [Source]Simple menu class
    By Void in forum C++/C Programming
    Replies: 44
    Last Post: 10-04-2010, 09:21 PM
  3. Guild Wars New Classes
    By Chronologix in forum General Gaming
    Replies: 24
    Last Post: 07-23-2006, 09:46 AM
  4. Heavy Weapons Class mine bug. I had no idea.
    By NukeAssault in forum General Gaming
    Replies: 2
    Last Post: 07-20-2006, 07:54 AM
  5. [Tutorial]Change class without respawn
    By vir2000 in forum Game Hacking Tutorials
    Replies: 0
    Last Post: 01-04-2006, 02:47 PM