Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › [Source]Simple menu class

[Source]Simple menu class

Posts 1–15 of 45 · Page 1 of 3
Void
Void
[Source]Simple menu class
Uhg, not much to say, I made a simple menu class this morning for myself to use since I don't like everyone else's.

The function's name speak for themselves, except for InitControls. To initiate the hotkeys for the menu, just put InitControls in a loop and create a seperate thread for it.

[highlight=cpp]
void MainThread()
{
while(true)
{
MenuInstance->InitControls();
}
}

....

CreateThread(0,0,(LPTHREAD_START_ROUTINE)MainThrea d,0,0,0);
[/highlight]

That's the only seemingly confusing part. Use the menu item's index to get it's current status ( on/off ). When your module detaches I made a function to release the classes private members so you don't get leaks.

Here we go.

Menu.h:
[highlight=cpp]
#ifndef MENU_H
#define MENU_H

#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>

struct MenuItem {
int index;
char* text;
bool status;
MenuItem* pNext;
};

class cMenu {
private:
IDirect3DDevice9* m_pDevice;
ID3DXFont* m_pFont;
MenuItem* MenuItems;
int CurrSelected;
int m_nItems;

public:
cMenu(IDirect3DDevice9*,ID3DXFont*);
void Update(IDirect3DDevice9*,ID3DXFont*);

void AddItem(char*,int);
void RenderMenu(void);
void InitControls(void);
void Release(void);
bool GetStatus(int);
};

#endif
[/highlight]

Menu.cpp
[highlight=cpp]
#include "Menu.h"


cMenu::cMenu(IDirect3DDevice9 *pDevice, ID3DXFont *pFont)
{
cMenu::m_pDevice = pDevice;
cMenu::m_pFont = pFont;
cMenu::MenuItems = NULL;
cMenu::CurrSelected = 1;
cMenu::m_nItems = 0;
}

void cMenu::Update(IDirect3DDevice9 *pDevice, ID3DXFont *pFont)
{
cMenu::m_pDevice = pDevice;
cMenu::m_pFont = pFont;
}

void cMenu::AddItem(char *text, int index)
{
MenuItem* Ptr = new MenuItem;
MenuItem* Before = new MenuItem;
MenuItem* New = new MenuItem;

New->index = index;
New->text = text;
New->status = false;
New->pNext = NULL;

if(cMenu::MenuItems == NULL)
{
cMenu::MenuItems = New;
cMenu::MenuItems->pNext = NULL;
} else {
Ptr = cMenu::MenuItems;
while(Ptr->pNext != NULL)
{
Ptr = Ptr->pNext;
}
Ptr->pNext = New;
}
cMenu::m_nItems++;

}

void cMenu::RenderMenu()
{
MenuItem* Ptr = new MenuItem;
MenuItem* Before = new MenuItem;
MenuItem* New = new MenuItem;

RECT rect;
rect.top = 20;
rect.left = 20;
rect.right = 150;
rect.bottom = 20;

Ptr = cMenu::MenuItems;
do
{
if(!(Ptr->index == CurrSelected) && !Ptr->status)
{
cMenu::m_pFont->DrawText(0,Ptr->text,-1,&rect,DT_LEFT|DT_NOCLIP,D3DCOLOR_XRGB(255,0,0)) ;
cMenu::m_pFont->DrawText(0,"Off",-1,&rect,DT_RIGHT|DT_NOCLIP,D3DCOLOR_XRGB(255,0,0)) ;
}
if(Ptr->index == CurrSelected && !Ptr->status)
{
cMenu::m_pFont->DrawText(0,Ptr->text,-1,&rect,DT_LEFT|DT_NOCLIP,D3DCOLOR_XRGB(0,255,0)) ;
cMenu::m_pFont->DrawText(0,"Off",-1,&rect,DT_RIGHT|DT_NOCLIP,D3DCOLOR_XRGB(0,255,0)) ;
}

if(!(Ptr->index == CurrSelected) && Ptr->status)
{
cMenu::m_pFont->DrawText(0,Ptr->text,-1,&rect,DT_LEFT|DT_NOCLIP,D3DCOLOR_XRGB(255,0,0)) ;
cMenu::m_pFont->DrawText(0,"On",-1,&rect,DT_RIGHT|DT_NOCLIP,D3DCOLOR_XRGB(255,0,0)) ;
}
if(Ptr->index == CurrSelected && Ptr->status)
{
cMenu::m_pFont->DrawText(0,Ptr->text,-1,&rect,DT_LEFT|DT_NOCLIP,D3DCOLOR_XRGB(0,255,0)) ;
cMenu::m_pFont->DrawText(0,"On",-1,&rect,DT_RIGHT|DT_NOCLIP,D3DCOLOR_XRGB(0,255,0)) ;
}


rect.top += 17;
Ptr = Ptr->pNext;
}while(Ptr != NULL);



}

void cMenu::InitControls()
{
MenuItem* Ptr = new MenuItem;

if(GetAsyncKeyState(VK_DOWN))
{
if(CurrSelected != cMenu::m_nItems)
CurrSelected += 1;

Sleep(100);
}
if(GetAsyncKeyState(VK_UP))
{
if(CurrSelected != 1)
CurrSelected -= 1;

Sleep(100);
}
if(GetAsyncKeyState(VK_RIGHT))
{
Ptr = cMenu::MenuItems;
while(Ptr != NULL)
{
if(Ptr->index == CurrSelected)
{
break;
}
Ptr = Ptr->pNext;
}
Ptr->status = !Ptr->status;

Sleep(100);
}
if(GetAsyncKeyState(VK_LEFT))
{
Ptr = cMenu::MenuItems;
while(Ptr != NULL)
{
if(Ptr->index == CurrSelected)
{
break;
}
Ptr = Ptr->pNext;
}
Ptr->status = !Ptr->status;

Sleep(100);
}
}

void cMenu::Release()
{
cMenu::m_pDevice->Release();
cMenu::m_pFont->Release();
}

bool cMenu::GetStatus(int index)
{
MenuItem* Ptr = new MenuItem;
Ptr = cMenu::MenuItems;
while(Ptr != NULL)
{
if(Ptr->index == index)
{
break;
}
Ptr = Ptr->pNext;
}
return Ptr->status;
}
[/highlight]

Also.. I made a small example just in case you guys can't figure out how to use it.. The whole project is the attached file below.
#1 · edited 15y ago · 16y ago
SC
scimmyboy
YOU SUCK. YOU SUCK. first post. love you david
#2 · 16y ago
Auxilium
Auxilium
Looks gewd. Won't use however because im still learning C++
#3 · 16y ago
Void
Void
Ohai there Patrick. The thanks button is waiting to be pressed. |:
#4 · 16y ago
Auxilium
Auxilium
Pressed
#5 · 16y ago
'Bruno
'Bruno
wow... Attachments Pending Approval? fail... C++ section now needs approval

Nice david ;d anyway i wouldn't expect a different result from ya =D unfortunately i don't know much (anything) about D3D to comment that much.
#6 · 16y ago
Void
Void
Oyaa credits to Brinuz for his linked lists tutorial.
#7 · 16y ago
'Bruno
'Bruno
Quote Originally Posted by Void View Post
Oyaa credits to Brinuz for his linked lists tutorial.
=o im surprised that someone used it lulz
#8 · 16y ago
Void
Void
I'm the only one who thanked it I think. |:
#9 · 16y ago
Melodia
Melodia
Cute ~
#10 · 16y ago
Void
Void
Quote Originally Posted by Melodia View Post
Cute ~
Why thank you Mel. /
#11 · 16y ago
inmate
inmate
Quote Originally Posted by Melodia View Post
Cute ~
Agree
#12 · 16y ago
FA
Fabolous
Not Gellins base. But VOID'S base
#13 · 16y ago
Void
Void
It's just a class..
#14 · 16y ago
freedompeace
freedompeace
Quote Originally Posted by Void View Post
It's just a class..
Hey Void, does unlocking the cursor mid-game (eg, while you're in game killing people / re-spawning) allow mouse co-ordinates other than center to be grabbed?

(I don't have the game, so I can't find out - I have 1GB internet per month, and Combat Arms is well... rather large)
#15 · 16y ago
Posts 1–15 of 45 · Page 1 of 3

Post a Reply

Similar Threads

  • [Source] Checkbox Menu by Str1k3r21 *D3D8*By phoenixraider in C++/C Programming
    7Last post 17y ago
  • [Source] Keyboard Menu 2.0By phoenixraider in C++/C Programming
    5Last post 16y ago
  • [C++ SOURCE]Simple D3D Show Time and DateBy mastermods in Combat Arms Hack Coding / Programming / Source Code
    12Last post 16y ago
  • My C# Menu ClassBy User1 in Combat Arms Hack Coding / Programming / Source Code
    10Last post 16y ago
  • [SOURCE] Simple Teleport hackBy Solify in Combat Arms EU Hack Coding/Source Code
    42Last post 15y ago

Tags for this Thread

None