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 › Programming Tutorials › Starting in Direct-X 8.1

Starting in Direct-X 8.1

Posts 1–15 of 56 · Page 1 of 4
Dave84311
[MPGH]Dave84311
Starting in Direct-X 8.1
What You Need
Strong knowledge of C++
Direct-X SDK Current version that supports Direct-X 8.1
Microsoft Visual Studios (6.0 w/ C++ Support, 2003 (Preferable), 2005)

Information
C++ with Direct-X is extremely complicated. Some one with no prior C++ knowledge shouldn't attempt this tutorial. If you are using this as a learning experience, feel free to read.

By the way, we are using Direct-X 8.1 because Microsoft decided managed is the best way to program in 9.0… So we aren't going to program in it.

What we will try to do now is make a basic window that you can use in later tutorials to begin writing your first game in Direct-X!

Lets Start
If you don't have any of the noted software above installed, you probably should install it. You also need to install the SDK, you should do that after installing your compiler otherwise you will have to add the libraries/headers manually the compiler's options.

Creating a Project
If you have some C++ knowledge you should know what to do. Make a new EMPTY PROJECT called "MPGH.net Tutorial 1".

Now, you must access your "Project's Settings". Open your Project's Settings, head to the Link tab (Project Settings and Link may not exist, it depends on what compiler your using. I am using VS 2003). In that tab there are about seven settings, on the first input box enter "d3d8.lib". This library holds all you need for basic Direct-X functionality (functions). Well you are basically ready.

Coding Begins
Right click and add "New" > "CPP File", if you know where else goto "File" > "New" > "CPP File". Call this CPP file "Main.cpp", I like keeping my base file where all main function is placed. However I use my game name as the CPP name when its a big project I am working on. Anyways open up your new Main CPP file, whatever you named it.
First we need the Direct-X base header file that will use the libary file you added to your project above. This header file is called "d3d8.h". Include this header file:

Code:
#include <d3d8.h>

//Application Title, using this variable the window class is easy to unregister
static char appTitle[ ]= "Starting in C++/Direct-X 8.1 - Tutorial 1";
We don't want your code to be sketchy so we need to make a header file. Make a new header file as you named your Main CPP file, for example if you named your main cpp "Main.cpp" then call your header file "Main.h".
Include this header file to your main cpp so code looks something like this:

Code:
#include <d3d8.h>
#include "Main.h"
Since we are using the Windows API to display your window and Direct-X surface, we need to create a main method initialize the project (Where your game starts). Add the following function to your main cpp.

Code:
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIsntance, LPSTR cmd, INT cmdsh)
{
Now we must configure the window class settings. Add the following code:

Code:
//Declares the windows class
WNDCLASSEX wc;

ZeroMemory(&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);					//Sets the window’s size
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;		//Sets the window’s style
wc.lpfnWndProc = MsgProc;							//Passes the message handler
wc.hInstance = hInstance;							//Passes the instance handler
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);	//Colors the window background black
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);			//Uses the default application icon - large
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); 			//Uses the default application icon - small
wc.hCursor = LoadCursor(NULL, IDC_ARROW);				//Uses the default application pointer
wc.lpszClassName = appTitle;						//Window’s Name

//Or Use:
//WNDCLASSEX wc = {sizeof(WNDCLASSEX), CS_HREDRAW | CS_VREDRAW | CS_OWNDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, appTitle, NULL};

//Register the window class
RegisterClassEx(&wc);
The settings of the window are all done. Now we have to pass the settings to the window we are going to create.

Code:
//Create the window
HWND hWnd = CreateWindow(appTitle, appTitle, WS_OVERLAPPEDWINDOW, 100, 100, 640, 480, NULL, NULL, wc.hInstance, NULL );

//Show the window
ShowWindow(hWnd, nCmdShow);
Great! Now your window shows – Code isn’t fully functional so expect errors if you try to run it. It doesn’t stay up though. We need to initialize Direct-X and create a while loop to keep the game running while it should be.

Code:
//If DirectX Initializes properly, simply begin updating window
if (InitializeDirectX())
{
	while (gameIsRunning)
{
	//Update the window
UpdateWindow(hWnd);
}
}

UnregisterClass(appTitle, wc.hInstance);
Now… We need a message handler to finish this tutorial up.
Code:
//Message handler
LRESULT WINAPI MsgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
switch(wMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
break;
}

return DefWindowProc(hWnd, WMsg, wParam, lParam);
}
Now we need to add these two function declarations to your main header file.
Code:
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIsntance, LPSTR cmd, INT cmdsh);
LRESULT WINAPI MsgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
Good job guy! You did it, you setup the basic Win32 window where your game will play.

Project File & Source Code

*This tutorial isn’t complete, may be buggy, I wrote this tutorial straight from my head*
#1 · 20y ago
Dave84311
[MPGH]Dave84311
Post any problems, bugs or comments you have. If you need better description for anything let me know.
#2 · 20y ago
arunforce
[MPGH]arunforce
It's DirectX not Direct-X!
#3 · 20y ago
Dave84311
[MPGH]Dave84311
It's whatever I want to call it
#4 · 20y ago
SH
shercipher
Tried a Code::Blocks port but C::B doesn't support DX 8.1 (just DX 9). Will try again tomorrow.
#5 · 20y ago
hjerherjdsd
hjerherjdsd
i use Ogre (an Object-Oriented Graphics Rendering Engine), a lot easyer then learning the directX api and 100 times quicker to learn. i know a bit of directX but its just too time consuming to do even simple things. u might think a prebuilt engine would be slower and limit u to certain game types but u can build anything in ogre. look at this game http://www.alliancethegame.com/screenshots.php this was built on ogre.
#6 · 20y ago
SadisticGrin
SadisticGrin
Quote Originally Posted by hjerherjdsd
i use Ogre (an Object-Oriented Graphics Rendering Engine), a lot easyer then learning the directX api and 100 times quicker to learn. i know a bit of directX but its just too time consuming to do even simple things. u might think a prebuilt engine would be slower and limit u to certain game types but u can build anything in ogre. look at this game http://www.alliancethegame.com/screenshots.php this was built on ogre.


wouldn't this be for making a game? Not for hacking one? :P
#7 · 20y ago
hjerherjdsd
hjerherjdsd
well, yea...
#8 · 20y ago
smartie
smartie
Any pics of the result?

Nice tut, for straight from your head.
#9 · 19y ago
killer2334
killer2334
how can i learn more about c++ pm me any solutions
#10 · 19y ago
crisp1994
crisp1994
kk thx ill test it
#11 · 19y ago
yacniel
yacniel
i'ma give it a try
#12 · 19y ago
somethingwitty
somethingwitty
god i am such a newb....
#13 · 19y ago
FluffyStuff
FluffyStuff
Quote Originally Posted by somethingwitty View Post
god i am such a newb....
Newb + restarting old threads == ultra lame.
#14 · 19y ago
colommm752
colommm752
i have only C++ i have to download other programs
#15 · 19y ago
Posts 1–15 of 56 · Page 1 of 4

Post a Reply

Similar Threads

  • crossfire direct startBy teun95 in CrossFire Hacks & Cheats
    6Last post 16y ago
  • Combat Arms Direct StartBy zmansquared in Combat Arms Hacks & Cheats
    40Last post 16y ago
  • Web Start/ Direct Start?By Wax. in Combat Arms Discussions
    17Last post 15y ago
  • [REQUEST] Direct Combat Arms Start [CODE]By Katie_Perry in Combat Arms Hack Coding / Programming / Source Code
    12Last post 16y ago
  • Combat Arms Direct StartBy cyagon in Combat Arms Hacks & Cheats
    1Last post 16y ago

Tags for this Thread

#or directx#starting#tutorial