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# Programming › overlay d3dx9

overlay d3dx9

Posts 1–14 of 14 · Page 1 of 1
speedforyou
speedforyou
overlay d3dx9
well could someone please help me draw overlay on combat arms?(only fullscreen)
#1 · 14y ago
MarkHC
MarkHC
Quote Originally Posted by speedforyou View Post
well could someone please help me draw overlay on combat arms?(only fullscreen)
To make it work on fullscreen you have o inject the dll on the process... If you want a easier stuff, make it work only on windowed mode.. no hooks, no injections.. just regular stuff
#2 · 14y ago
speedforyou
speedforyou
is that how xfire,fraps does it?
#3 · 14y ago
Jorndel
Jorndel
Quote Originally Posted by speedforyou View Post
is that how xfire,fraps does it?
I think they just capture the Directx Image Drawing stuff or so.
Sure you can find this with google.

Me google:
#4 · edited 14y ago · 14y ago
MarkHC
MarkHC
Quote Originally Posted by speedforyou View Post
is that how xfire,fraps does it?
Actually, Fraps indeed Hooks the Directx.. as I found on Google:

It(Fraps) works by hooking some system calls and inserting itself into the call-chain between an app and DirectX.

If I recall correctly, from other forum discussions, Fraps hooks a few things to force the app to load its DLL, then hooks Present() calls and executes a device->Clear() call before calling the real Present(), with a list of small rectangles to set to a different color, which can spell out the FPS number that it displays. This has a minimal performance impact and is widely compatible with whatever rendering the app is doing.
#5 · 14y ago
speedforyou
speedforyou
anybody got code how to code this?
#6 · 14y ago
MarkHC
MarkHC
Quote Originally Posted by speedforyou View Post
anybody got code how to code this?
I have the code for it (no hooks) on C++... Not That hard to translate to C#... But if you want to deal with DirectX stuff, C++ its your best bet. Anyway, This code is part of a wallhack that I'm trying to do, here it goes:

PS: This code is a mix of Online Tutorials + Code snippets That I've found + Personal Stuff.
PS2: The forum Code's tag has messed up with the indentation... Not Me

Code:
//Basic Header Files
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#include <dwmapi.h>


//DirectX Header Files
#include <d3d9.h>
#include <d3dx9.h>


//Loads the DirectX libs
#pragma comment(lib, "dwmapi.lib")
#pragma comment(lib,"d3d9.lib")
#ifdef _DEBUG
  #pragma comment(lib,"d3dx9d.lib")
#else
  #pragma comment(lib,"d3dx9.lib")
#endif

//---------------Defines--------------------------//
#define WS_EX_LAYERED   0x00080000  //
#define LWA_ALPHA       0x00000002      //
#define ARGB_TRANS        0x00000000   // 100% transparent


//---------------Globals Declaration---------------------------------//
LPDIRECT3D9EX             d3d;                                               // The D3D Object
LPDIRECT3DDEVICE9EX d3ddev;                                          //The D3DDevice
int                                  w_Width       = 800;                       //Initial Window Width
int                                  w_Height      = 600;                       //Initial Window Height
ID3DXFont                     *font             = NULL;                     //Font to write on the window
wchar_t                          status[512]  = L"waiting";             //status message to display
HRESULT                         hr                 = D3D_OK;                
MARGINS                        g_mgDWMMargins= {-1,-1,-1,-1}; //Margins for thw Window
WCHAR                         *AppName        = L"DirectX Test";   //Application Name
HWND                            Mw2_hWnd      = NULL;                  //MW2 Window
DWORD                          Mw2_pid        = 0;                          //MW2 Process Pid
HANDLE                          Mw2_process   = NULL;                 //MW2 Process
bool                                init_ok       = false;                        //Is Everything initialized?
COORD                           w_pos         = {50,50};                 //Initial Window Position
COORD                           w_res         = {800, 600};             //Initial Window Resolution

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void DrawStringAt(LPCWSTR string, int x, int y,COLORREF color, ID3DXFont *Font);


HRESULT D3DStartup(HWND hWnd)
{
    BOOL                                    bCompOk             = FALSE;   // Is composition enabled? 
    D3DPRESENT_PARAMETERS  pp;                                       // Presentation prefs
    DWORD                                 msqAAQuality        = 0;        // Non-maskable quality
    HRESULT                  hr;

    // Make sure that DWM composition is enabled
    DwmIsCompositionEnabled(&bCompOk);
    if(!bCompOk) return E_FAIL;


    // Create a Direct3D object
    hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &d3d);
    if (FAILED(hr)) {
        swprintf_s(status, L"Error Direct3DCreate9Ex:%u", hr);
        MessageBox(0,status,L"Error",MB_ICONERROR);
        return E_FAIL;
    }

    // Setup presentation parameters
    ZeroMemory(&pp, sizeof(pp));
    pp.Windowed            = TRUE;
    pp.SwapEffect          = D3DSWAPEFFECT_DISCARD; // Required for multi sampling
    pp.BackBufferFormat    = D3DFMT_A8R8G8B8;       // Back buffer format with alpha channel


    // Set highest quality non-maskable AA available or none if not
    if (SUCCEEDED(d3d->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT,
        D3DDEVTYPE_HAL,
        D3DFMT_A8R8G8B8,
        TRUE,
        D3DMULTISAMPLE_NONMASKABLE,
        &msqAAQuality
        )))
    {
        // Set AA quality
        pp.MultiSampleType     = D3DMULTISAMPLE_NONMASKABLE;
        pp.MultiSampleQuality  = msqAAQuality - 1;
    }
    else
    {
        // No AA
        pp.MultiSampleType     = D3DMULTISAMPLE_NONE;
    }


    // Create a Direct3D device object
    hr = d3d->CreateDeviceEx(D3DADAPTER_DEFAULT,
        D3DDEVTYPE_HAL,
        hWnd,
        D3DCREATE_HARDWARE_VERTEXPROCESSING,
        &pp,
        NULL,
        &d3ddev
        );
    if (FAILED(hr)) {
        swprintf_s(status, L"Error CreateDeviceEx:%u", hr);
        MessageBox(0,status,L"Error",MB_ICONERROR);
        return E_FAIL;
    }
}


//---------------------------------------------------------------------------
// Render()
//
// Render the scene to the back buffer
VOID Render(VOID)
{


    COLORREF color = 0xFFFF0000;
    // Sanity check
    if(d3ddev == NULL) return;


    // Clear the back buffer and z buffer to transparent
    d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, ARGB_TRANS, 1.0f, 0);


    // Render scene
    d3ddev->BeginScene();

        DrawStringAt(L"MW2 FourDeltaOne ESP", 5,20,color, font);

    d3ddev->EndScene();


    // Update display
    d3ddev->PresentEx(NULL, NULL, NULL, NULL, NULL);
}


void D3DShutdown(void)
{
    if(d3ddev != NULL)
        d3ddev->Release();
    if(d3d != NULL)
        d3d->Release();
}


INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT)
{
    //----------Enabling the Console Window----------//
    AllocConsole();


    HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
    int hCrt = _open_osfhandle((long) handle_out, _O_TEXT);
    FILE* hf_out = _fdopen(hCrt, "w");
    setvbuf(hf_out, NULL, _IONBF, 1);
    *stdout = *hf_out;


    HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
    hCrt = _open_osfhandle((long) handle_in, _O_TEXT);
    FILE* hf_in = _fdopen(hCrt, "r");
    setvbuf(hf_in, NULL, _IONBF, 128);
    *stdin = *hf_in;
    //------------------------------------------------//


    HWND       hWnd  = NULL;
    MSG        uMsg;
    HRESULT       hr;
    long Loops = 0;
    WNDCLASSEX wc = {sizeof(WNDCLASSEX), // cbSize
        NULL,                            // style
        WindowProc,                      // lpfnWndProc
        NULL,                            // cbClsExtra
        NULL,                            // cbWndExtra
        hInstance,                       // hInstance
        LoadIcon(NULL, IDI_APPLICATION), // hIcon
        LoadCursor(NULL, IDC_ARROW),     // hCursor
        NULL,                            // hbrBackground
        NULL,                            // lpszMenuName
        AppName,                    // lpszClassName
        LoadIcon(NULL, IDI_APPLICATION)};// hIconSm


    RegisterClassEx(&wc);
    hWnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_COMPOSITED | WS_EX_TRANSPARENT | WS_EX_LAYERED,             // dwExStyle
        // WS_EX_COMPOSITED: for best performance in transparent mode
        // WS_EX_TOPMOST: always on top window
        // WS_EX_TRANSPARENT | WS_EX_LAYERED: click-through window
        AppName,                 // lpClassName
        AppName,                 // lpWindowName
        WS_POPUP,                    // dwStyle
        // dropped the WS_SIZEBOX, otherwise we have a "glow" background
        //WS_POPUP | WS_SIZEBOX,        // dwStyle
        w_pos.X, w_pos.Y, // x, y
        w_res.X, w_res.Y,          // nWidth, nHeight
        NULL,                         // hWndParent
        NULL,                         // hMenu
        hInstance,                    // hInstance
        NULL);                        // lpParam


    // Extend glass to cover whole window
    hr = DwmExtendFrameIntoClientArea(hWnd, &g_mgDWMMargins);
     
    // Initialize Direct3D
    if (SUCCEEDED(D3DStartup(hWnd)))
    {
        D3DXCreateFont(d3ddev, 20, 10, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &font );
        // Show the window
        ShowWindow(hWnd, SW_SHOWDEFAULT);
        UpdateWindow(hWnd);


        // Enter main loop
        while(TRUE)
        {
            // Check for a message
            if(PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE))
            {
                // Check if the message is WM_QUIT
                if(uMsg.message == WM_QUIT)
                {
                    // Break out of main loop
                    break;
                }


                // Pump the message
                TranslateMessage(&uMsg);
                DispatchMessage(&uMsg);
            }

            if (Mw2_hWnd == NULL) {
                Mw2_hWnd = FindWindow(NULL,L"Modern Warfare 2");
                if (Mw2_hWnd != NULL)
                    swprintf_s(status, L"app found\n");
            }

            if ((Mw2_hWnd != NULL) && (Mw2_pid == 0)) {
                GetWindowThreadProcessId(Mw2_hWnd,&Mw2_pid);
            }
            if ((Mw2_process == NULL) && (Mw2_pid != 0)) {
                Mw2_process = OpenProcess(PROCESS_VM_READ,false,Mw2_pid);
            }
            if (Mw2_process != NULL) {
                if ((!init_ok) || ((Loops % 20) == 0)) {
                    RECT client_rect;
                    GetClientRect(Mw2_hWnd, &client_rect); //Get The Resolution
                    w_res.X = client_rect.right;
                    w_res.Y = client_rect.bottom;
                    RECT bounding_rect;
                    GetWindowRect(Mw2_hWnd,&bounding_rect); //Get the Position
                    if (init_ok) {
                        if ((w_pos.X != bounding_rect.left) || (w_pos.Y != bounding_rect.top)) {
                            MoveWindow(hWnd, bounding_rect.left,bounding_rect.top, client_rect.right,client_rect.bottom,false);
                            w_pos.X = bounding_rect.left;
                            w_pos.Y = bounding_rect.top;
                        }
                    } else {
                        if ((bounding_rect.left == 0) && (bounding_rect.top == 0)) {
                            // we force a 1 pixel move, otherwise the window is not resized (bug?)
                            MoveWindow(hWnd, bounding_rect.left-1, bounding_rect.top-1, client_rect.right,client_rect.bottom,false);
                        }
                        MoveWindow(hWnd, bounding_rect.left,bounding_rect.top, client_rect.right,client_rect.bottom,false);


                        //D3DShutdown();            // we resized then window so we need to recreate all D3D objects
                        //D3DStartup(hWnd);
                    }


                    init_ok = true;                // off we go!
                }
            }


            if(Loops % 10 == 0){ //Check if MW2 is still Open, if not, closes everything
                if (FindWindow(NULL,L"Modern Warfare 2") == NULL) {
                    SendMessage(hWnd, WM_CLOSE, NULL, NULL);    // quit if game is closed
                }
            }
            Loops++;
            if(Loops >100) Loops = 0;
            Render();
        }
    }
    // Shutdown Direct3D
    D3DShutdown();

    // Exit application
    return 0;
}

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
        case WM_DESTROY:
            {
                PostQuitMessage(0);
                return 0;
            } break;
    }


    return DefWindowProc (hWnd, message, wParam, lParam);
}
 
void DrawStringAt(LPCWSTR string, int x, int y,COLORREF color, ID3DXFont *Font){
    RECT font_rct;
    SetRect(&font_rct, x, y, w_res.X, w_res.Y);
    Font->DrawText(NULL, string, -1, &font_rct, DT_LEFT | DT_NOCLIP | DT_SINGLELINE, color);
}
Change the Lines FindWindow(NULL,L"Modern Warfare 2") to the name of your application window and it should work fine.
#7 · edited 14y ago · 14y ago
Jorndel
Jorndel
Quote Originally Posted by General Shepherd View Post
I have the code for it (no hooks) on C++... Not That hard to translate to C#... But if you want to deal with DirectX stuff, C++ its your best bet. Anyway, This code is part of a wallhack that I'm trying to do, here it goes:

PS: This code is a mix of Online Tutorials + Code snippets That I've found + Personal Stuff.
PS2: The forum Code's tag has messed up with the indentation... Not Me

Code:
//Basic Header Files
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#include <dwmapi.h>


//DirectX Header Files
#include <d3d9.h>
#include <d3dx9.h>


//Loads the DirectX libs
#pragma comment(lib, "dwmapi.lib")
#pragma comment(lib,"d3d9.lib")
#ifdef _DEBUG
  #pragma comment(lib,"d3dx9d.lib")
#else
  #pragma comment(lib,"d3dx9.lib")
#endif

//---------------Defines--------------------------//
#define WS_EX_LAYERED   0x00080000  //
#define LWA_ALPHA       0x00000002      //
#define ARGB_TRANS        0x00000000   // 100% transparent


//---------------Globals Declaration---------------------------------//
LPDIRECT3D9EX             d3d;                                               // The D3D Object
LPDIRECT3DDEVICE9EX d3ddev;                                          //The D3DDevice
int                                  w_Width       = 800;                       //Initial Window Width
int                                  w_Height      = 600;                       //Initial Window Height
ID3DXFont                     *font             = NULL;                     //Font to write on the window
wchar_t                          status[512]  = L"waiting";             //status message to display
HRESULT                         hr                 = D3D_OK;                
MARGINS                        g_mgDWMMargins= {-1,-1,-1,-1}; //Margins for thw Window
WCHAR                         *AppName        = L"DirectX Test";   //Application Name
HWND                            Mw2_hWnd      = NULL;                  //MW2 Window
DWORD                          Mw2_pid        = 0;                          //MW2 Process Pid
HANDLE                          Mw2_process   = NULL;                 //MW2 Process
bool                                init_ok       = false;                        //Is Everything initialized?
COORD                           w_pos         = {50,50};                 //Initial Window Position
COORD                           w_res         = {800, 600};             //Initial Window Resolution

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void DrawStringAt(LPCWSTR string, int x, int y,COLORREF color, ID3DXFont *Font);


HRESULT D3DStartup(HWND hWnd)
{
    BOOL                                    bCompOk             = FALSE;   // Is composition enabled? 
    D3DPRESENT_PARAMETERS  pp;                                       // Presentation prefs
    DWORD                                 msqAAQuality        = 0;        // Non-maskable quality
    HRESULT                  hr;

    // Make sure that DWM composition is enabled
    DwmIsCompositionEnabled(&bCompOk);
    if(!bCompOk) return E_FAIL;


    // Create a Direct3D object
    hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &d3d);
    if (FAILED(hr)) {
        swprintf_s(status, L"Error Direct3DCreate9Ex:%u", hr);
        MessageBox(0,status,L"Error",MB_ICONERROR);
        return E_FAIL;
    }

    // Setup presentation parameters
    ZeroMemory(&pp, sizeof(pp));
    pp.Windowed            = TRUE;
    pp.SwapEffect          = D3DSWAPEFFECT_DISCARD; // Required for multi sampling
    pp.BackBufferFormat    = D3DFMT_A8R8G8B8;       // Back buffer format with alpha channel


    // Set highest quality non-maskable AA available or none if not
    if (SUCCEEDED(d3d->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT,
        D3DDEVTYPE_HAL,
        D3DFMT_A8R8G8B8,
        TRUE,
        D3DMULTISAMPLE_NONMASKABLE,
        &msqAAQuality
        )))
    {
        // Set AA quality
        pp.MultiSampleType     = D3DMULTISAMPLE_NONMASKABLE;
        pp.MultiSampleQuality  = msqAAQuality - 1;
    }
    else
    {
        // No AA
        pp.MultiSampleType     = D3DMULTISAMPLE_NONE;
    }


    // Create a Direct3D device object
    hr = d3d->CreateDeviceEx(D3DADAPTER_DEFAULT,
        D3DDEVTYPE_HAL,
        hWnd,
        D3DCREATE_HARDWARE_VERTEXPROCESSING,
        &pp,
        NULL,
        &d3ddev
        );
    if (FAILED(hr)) {
        swprintf_s(status, L"Error CreateDeviceEx:%u", hr);
        MessageBox(0,status,L"Error",MB_ICONERROR);
        return E_FAIL;
    }
}


//---------------------------------------------------------------------------
// Render()
//
// Render the scene to the back buffer
VOID Render(VOID)
{


    COLORREF color = 0xFFFF0000;
    // Sanity check
    if(d3ddev == NULL) return;


    // Clear the back buffer and z buffer to transparent
    d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, ARGB_TRANS, 1.0f, 0);


    // Render scene
    d3ddev->BeginScene();

        DrawStringAt(L"MW2 FourDeltaOne ESP", 5,20,color, font);

    d3ddev->EndScene();


    // Update display
    d3ddev->PresentEx(NULL, NULL, NULL, NULL, NULL);
}


void D3DShutdown(void)
{
    if(d3ddev != NULL)
        d3ddev->Release();
    if(d3d != NULL)
        d3d->Release();
}


INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT)
{
    //----------Enabling the Console Window----------//
    AllocConsole();


    HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
    int hCrt = _open_osfhandle((long) handle_out, _O_TEXT);
    FILE* hf_out = _fdopen(hCrt, "w");
    setvbuf(hf_out, NULL, _IONBF, 1);
    *stdout = *hf_out;


    HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
    hCrt = _open_osfhandle((long) handle_in, _O_TEXT);
    FILE* hf_in = _fdopen(hCrt, "r");
    setvbuf(hf_in, NULL, _IONBF, 128);
    *stdin = *hf_in;
    //------------------------------------------------//


    HWND       hWnd  = NULL;
    MSG        uMsg;
    HRESULT       hr;
    long Loops = 0;
    WNDCLASSEX wc = {sizeof(WNDCLASSEX), // cbSize
        NULL,                            // style
        WindowProc,                      // lpfnWndProc
        NULL,                            // cbClsExtra
        NULL,                            // cbWndExtra
        hInstance,                       // hInstance
        LoadIcon(NULL, IDI_APPLICATION), // hIcon
        LoadCursor(NULL, IDC_ARROW),     // hCursor
        NULL,                            // hbrBackground
        NULL,                            // lpszMenuName
        AppName,                    // lpszClassName
        LoadIcon(NULL, IDI_APPLICATION)};// hIconSm


    RegisterClassEx(&wc);
    hWnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_COMPOSITED | WS_EX_TRANSPARENT | WS_EX_LAYERED,             // dwExStyle
        // WS_EX_COMPOSITED: for best performance in transparent mode
        // WS_EX_TOPMOST: always on top window
        // WS_EX_TRANSPARENT | WS_EX_LAYERED: click-through window
        AppName,                 // lpClassName
        AppName,                 // lpWindowName
        WS_POPUP,                    // dwStyle
        // dropped the WS_SIZEBOX, otherwise we have a "glow" background
        //WS_POPUP | WS_SIZEBOX,        // dwStyle
        w_pos.X, w_pos.Y, // x, y
        w_res.X, w_res.Y,          // nWidth, nHeight
        NULL,                         // hWndParent
        NULL,                         // hMenu
        hInstance,                    // hInstance
        NULL);                        // lpParam


    // Extend glass to cover whole window
    hr = DwmExtendFrameIntoClientArea(hWnd, &g_mgDWMMargins);
     
    // Initialize Direct3D
    if (SUCCEEDED(D3DStartup(hWnd)))
    {
        D3DXCreateFont(d3ddev, 20, 10, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &font );
        // Show the window
        ShowWindow(hWnd, SW_SHOWDEFAULT);
        UpdateWindow(hWnd);


        // Enter main loop
        while(TRUE)
        {
            // Check for a message
            if(PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE))
            {
                // Check if the message is WM_QUIT
                if(uMsg.message == WM_QUIT)
                {
                    // Break out of main loop
                    break;
                }


                // Pump the message
                TranslateMessage(&uMsg);
                DispatchMessage(&uMsg);
            }

            if (Mw2_hWnd == NULL) {
                Mw2_hWnd = FindWindow(NULL,L"Modern Warfare 2");
                if (Mw2_hWnd != NULL)
                    swprintf_s(status, L"app found\n");
            }

            if ((Mw2_hWnd != NULL) && (Mw2_pid == 0)) {
                GetWindowThreadProcessId(Mw2_hWnd,&Mw2_pid);
            }
            if ((Mw2_process == NULL) && (Mw2_pid != 0)) {
                Mw2_process = OpenProcess(PROCESS_VM_READ,false,Mw2_pid);
            }
            if (Mw2_process != NULL) {
                if ((!init_ok) || ((Loops % 20) == 0)) {
                    RECT client_rect;
                    GetClientRect(Mw2_hWnd, &client_rect); //Get The Resolution
                    w_res.X = client_rect.right;
                    w_res.Y = client_rect.bottom;
                    RECT bounding_rect;
                    GetWindowRect(Mw2_hWnd,&bounding_rect); //Get the Position
                    if (init_ok) {
                        if ((w_pos.X != bounding_rect.left) || (w_pos.Y != bounding_rect.top)) {
                            MoveWindow(hWnd, bounding_rect.left,bounding_rect.top, client_rect.right,client_rect.bottom,false);
                            w_pos.X = bounding_rect.left;
                            w_pos.Y = bounding_rect.top;
                        }
                    } else {
                        if ((bounding_rect.left == 0) && (bounding_rect.top == 0)) {
                            // we force a 1 pixel move, otherwise the window is not resized (bug?)
                            MoveWindow(hWnd, bounding_rect.left-1, bounding_rect.top-1, client_rect.right,client_rect.bottom,false);
                        }
                        MoveWindow(hWnd, bounding_rect.left,bounding_rect.top, client_rect.right,client_rect.bottom,false);


                        //D3DShutdown();            // we resized then window so we need to recreate all D3D objects
                        //D3DStartup(hWnd);
                    }


                    init_ok = true;                // off we go!
                }
            }


            if(Loops % 10 == 0){ //Check if MW2 is still Open, if not, closes everything
                if (FindWindow(NULL,L"Modern Warfare 2") == NULL) {
                    SendMessage(hWnd, WM_CLOSE, NULL, NULL);    // quit if game is closed
                }
            }
            Loops++;
            if(Loops >100) Loops = 0;
            Render();
        }
    }
    // Shutdown Direct3D
    D3DShutdown();

    // Exit application
    return 0;
}

LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
        case WM_DESTROY:
            {
                PostQuitMessage(0);
                return 0;
            } break;
    }


    return DefWindowProc (hWnd, message, wParam, lParam);
}
 
void DrawStringAt(LPCWSTR string, int x, int y,COLORREF color, ID3DXFont *Font){
    RECT font_rct;
    SetRect(&font_rct, x, y, w_res.X, w_res.Y);
    Font->DrawText(NULL, string, -1, &font_rct, DT_LEFT | DT_NOCLIP | DT_SINGLELINE, color);
}
Change the Lines FindWindow(NULL,L"Modern Warfare 2") to the name of your application window and it should work fine.
Why would you post an long C++ source here in the C# section?
That make no sense at all :|

Just tell him to go on google and search.
And learn more about programming before he run around asking for source.
#8 · 14y ago
MarkHC
MarkHC
Quote Originally Posted by Jorndel View Post
Why would you post an long C++ source here in the C# section?
That make no sense at all :|

Just tell him to go on google and search.
And learn more about programming before he run around asking for source.
I just posted cause 3 days ago I was on the same situation that he is now... and, if I was asking, I would like to get answered. And the code is in the code tags.. so doesn't even takes that much of space on the post... I know it might not be the right think to do, but I though it was the best I could do. Sorry if I'm breaking any rule or something
#9 · 14y ago
speedforyou
speedforyou
Quote Originally Posted by Jorndel View Post
Why would you post an long C++ source here in the C# section?
That make no sense at all :|

Just tell him to go on google and search.
And learn more about programming before he run around asking for source.
i have serched on google. and have not found anything... i was just wondering if anybody here knows how to do this.
/req close
/req delete
#10 · 14y ago
Hell_Demon
Hell_Demon
Your best bet is to inject and hook, the posted code should help
#11 · 14y ago
rabir007
rabir007
Quote Originally Posted by speedforyou View Post
well could someone please help me draw overlay on combat arms?(only fullscreen)
Top-Most + Layered Window
And make a timer, interval = 10; commands:
BringToTop(); (Or something like this...)

And use the Graphics to draw on the form....
#12 · 14y ago
MarkHC
MarkHC
Quote Originally Posted by rabir007 View Post


Top-Most + Layered Window
And make a timer, interval = 10; commands:
BringToTop(); (Or something like this...)

And use the Graphics to draw on the form....
Quick Note: I think That Don't work on FullScreen...

If you want to do something on fullscreen, you'll have to hook the game D3D(What could get you banned)... External Overlays doesn't work...
#13 · edited 14y ago · 14y ago
rabir007
rabir007
Quote Originally Posted by General Shepherd View Post

Quick Note: I think That Don't work on FullScreen...

If you want to do something on fullscreen, you'll have to hook the game D3D(What could get you banned)... External Overlays doesn't work...
Well, my Xhair program is using this method, and it is work perfectly...
I couldnt made it, if you dont show me the layered window...

You just have to make a timer
and in the timer, resize, and move your window:
Code:
private void timer_tick(...)
{
    this.Location = new Point(0,0)
    this.Size = Screen.PrimaryScreen.Bounds.Size;
}
This is work well for me
#14 · 14y ago
Posts 1–14 of 14 · Page 1 of 1

Post a Reply

Similar Threads

  • [Help] DirectX OverlaysBy JoshA56 in Visual Basic Programming
    0Last post 17y ago
  • whatt d3dx9 or d3d9.lldBy alextour in Combat Arms Hacks & Cheats
    3Last post 17y ago
  • D3Dx9.dll is missingBy guardian18 in Operation 7 General
    1Last post 16y ago
  • OP7 d3dx9.dll file missingBy CKDC in General
    1Last post 16y ago
  • TeamSpeak Overlay?By flametai1 in Combat Arms Help
    3Last post 16y ago

Tags for this Thread

None