DebateFort - Where Warriors Come To Debate
RAGECRY - Funny, Amusing, Interesting, Trending & Viral Videos and Images
GameOrc - Free Flash Games Online

Thread: overlay d3dx9

Results 1 to 14 of 14
  1. #1
    Expert Member
    MPGH Member
    speedforyou's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    745
    Reputation
    -59
    Thanks
    106
    My Mood
    Happy

    overlay d3dx9

    well could someone please help me draw overlay on combat arms?(only fullscreen)

    steel o-o's sig =
    = Done , = Not Done

    Leecher 0 =
    Newbie 25 =
    Member 50 =
    Advanced Member 100 =
    H4X0R Member 150 =
    Dual-Keyboard Member 250 =
    Expert Member 500 =
    's Trainer 750 =
    MPGH Expert 1000 =
    Synthetic Hacker 1250 =
    Blackhat Hacker 1500 =
    Whitehat Hacker 2000 =
    's Guardian 2500 =
    Upcoming MPGHiean 3000 =
    MPGH Addict 3500 =
    MPGHiean 4000 =
    MPGH Knight 4500 =
    MPGH Lord 5000 =
    MPGH Champion 5500 =
    MPGH King 6000 =
    MPGH Legend 6500 =
    MPGH God 7000 =
    MPGH God II 7500 =
    MPGH God III 8000 =
    MPGH God IV 8500 =
    MPGH God V 9000 =
    Arun's Slave 9500 =
    Dave's Slave 10000 =

  2. #2
    Former CoD Staff
    Former Staff
    -InSaNe-'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    In my room...
    Posts
    2,665
    Reputation
    48
    Thanks
    11,388
    My Mood
    Angelic
    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


    CoD Minion from 09/19/2012 to 01/10/2013

  3. #3
    Threadstarter
    Expert Member
    MPGH Member
    speedforyou's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    745
    Reputation
    -59
    Thanks
    106
    My Mood
    Happy
    is that how xfire,fraps does it?

    steel o-o's sig =
    = Done , = Not Done

    Leecher 0 =
    Newbie 25 =
    Member 50 =
    Advanced Member 100 =
    H4X0R Member 150 =
    Dual-Keyboard Member 250 =
    Expert Member 500 =
    's Trainer 750 =
    MPGH Expert 1000 =
    Synthetic Hacker 1250 =
    Blackhat Hacker 1500 =
    Whitehat Hacker 2000 =
    's Guardian 2500 =
    Upcoming MPGHiean 3000 =
    MPGH Addict 3500 =
    MPGHiean 4000 =
    MPGH Knight 4500 =
    MPGH Lord 5000 =
    MPGH Champion 5500 =
    MPGH King 6000 =
    MPGH Legend 6500 =
    MPGH God 7000 =
    MPGH God II 7500 =
    MPGH God III 8000 =
    MPGH God IV 8500 =
    MPGH God V 9000 =
    Arun's Slave 9500 =
    Dave's Slave 10000 =

  4. #4
    Such pain... Why now?!
    Editor - Manager
    Newsforce
    Contributor
    Donator
    Minionforce
    Cocksucker
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Hidden from your eyes
    Posts
    7,690
    Reputation
    619
    Thanks
    14,275
    My Mood
    Angelic
    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:
    Last edited by Jorndel; 06-14-2012 at 11:47 AM.

    YouTube
    Twitter
    Facebook



    Contact Me - MPGH
    [VM] [PM]



    My Junior
    Jorndel Jr.


    Feel free to Donate
     
    Contributor 01.27.2012 - Current
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - Current
    Minion 01-10-2013 - Current
    Former Staff 09-20-2012 - 01-10-2013
    Cocksucker 20-04-2013 - Current

  5. #5
    Former CoD Staff
    Former Staff
    -InSaNe-'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    In my room...
    Posts
    2,665
    Reputation
    48
    Thanks
    11,388
    My Mood
    Angelic
    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.


    CoD Minion from 09/19/2012 to 01/10/2013

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

    ElpidiosMan (07-18-2012)

  7. #6
    Threadstarter
    Expert Member
    MPGH Member
    speedforyou's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    745
    Reputation
    -59
    Thanks
    106
    My Mood
    Happy
    anybody got code how to code this?

    steel o-o's sig =
    = Done , = Not Done

    Leecher 0 =
    Newbie 25 =
    Member 50 =
    Advanced Member 100 =
    H4X0R Member 150 =
    Dual-Keyboard Member 250 =
    Expert Member 500 =
    's Trainer 750 =
    MPGH Expert 1000 =
    Synthetic Hacker 1250 =
    Blackhat Hacker 1500 =
    Whitehat Hacker 2000 =
    's Guardian 2500 =
    Upcoming MPGHiean 3000 =
    MPGH Addict 3500 =
    MPGHiean 4000 =
    MPGH Knight 4500 =
    MPGH Lord 5000 =
    MPGH Champion 5500 =
    MPGH King 6000 =
    MPGH Legend 6500 =
    MPGH God 7000 =
    MPGH God II 7500 =
    MPGH God III 8000 =
    MPGH God IV 8500 =
    MPGH God V 9000 =
    Arun's Slave 9500 =
    Dave's Slave 10000 =

  8. #7
    Former CoD Staff
    Former Staff
    -InSaNe-'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    In my room...
    Posts
    2,665
    Reputation
    48
    Thanks
    11,388
    My Mood
    Angelic
    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.
    Last edited by -InSaNe-; 06-17-2012 at 01:29 AM.


    CoD Minion from 09/19/2012 to 01/10/2013

  9. #8
    Such pain... Why now?!
    Editor - Manager
    Newsforce
    Contributor
    Donator
    Minionforce
    Cocksucker
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Hidden from your eyes
    Posts
    7,690
    Reputation
    619
    Thanks
    14,275
    My Mood
    Angelic
    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.

    YouTube
    Twitter
    Facebook



    Contact Me - MPGH
    [VM] [PM]



    My Junior
    Jorndel Jr.


    Feel free to Donate
     
    Contributor 01.27.2012 - Current
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - Current
    Minion 01-10-2013 - Current
    Former Staff 09-20-2012 - 01-10-2013
    Cocksucker 20-04-2013 - Current

  10. #9
    Former CoD Staff
    Former Staff
    -InSaNe-'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    In my room...
    Posts
    2,665
    Reputation
    48
    Thanks
    11,388
    My Mood
    Angelic
    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


    CoD Minion from 09/19/2012 to 01/10/2013

  11. #10
    Threadstarter
    Expert Member
    MPGH Member
    speedforyou's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    745
    Reputation
    -59
    Thanks
    106
    My Mood
    Happy
    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

    steel o-o's sig =
    = Done , = Not Done

    Leecher 0 =
    Newbie 25 =
    Member 50 =
    Advanced Member 100 =
    H4X0R Member 150 =
    Dual-Keyboard Member 250 =
    Expert Member 500 =
    's Trainer 750 =
    MPGH Expert 1000 =
    Synthetic Hacker 1250 =
    Blackhat Hacker 1500 =
    Whitehat Hacker 2000 =
    's Guardian 2500 =
    Upcoming MPGHiean 3000 =
    MPGH Addict 3500 =
    MPGHiean 4000 =
    MPGH Knight 4500 =
    MPGH Lord 5000 =
    MPGH Champion 5500 =
    MPGH King 6000 =
    MPGH Legend 6500 =
    MPGH God 7000 =
    MPGH God II 7500 =
    MPGH God III 8000 =
    MPGH God IV 8500 =
    MPGH God V 9000 =
    Arun's Slave 9500 =
    Dave's Slave 10000 =

  12. #11
    MPGH Addict
    Former Staff
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,591
    Reputation
    236
    Thanks
    3,786
    My Mood
    Cheeky
    Your best bet is to inject and hook, the posted code should help
    Ah we-a blaze the fyah, make it bun dem!

  13. #12
    MPGH Member
    rabir007's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Location
    Behind you...
    Posts
    1,731
    Reputation
    116
    Thanks
    1,699
    My Mood
    In Love
    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....

  14. #13
    Former CoD Staff
    Former Staff
    -InSaNe-'s Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    In my room...
    Posts
    2,665
    Reputation
    48
    Thanks
    11,388
    My Mood
    Angelic
    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...
    Last edited by -InSaNe-; 06-25-2012 at 08:18 PM.


    CoD Minion from 09/19/2012 to 01/10/2013

  15. #14
    MPGH Member
    rabir007's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Location
    Behind you...
    Posts
    1,731
    Reputation
    116
    Thanks
    1,699
    My Mood
    In Love
    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

Similar Threads

  1. D3Dx9.dll is missing
    By guardian18 in forum Operation 7 Hacks
    Replies: 1
    Last Post: 02-20-2010, 06:07 AM
  2. TeamSpeak Overlay?
    By flametai1 in forum Combat Arms Help
    Replies: 3
    Last Post: 12-22-2009, 07:30 PM
  3. OP7 d3dx9.dll file missing
    By CKDC in forum General
    Replies: 1
    Last Post: 10-25-2009, 05:38 PM
  4. whatt d3dx9 or d3d9.lld
    By alextour in forum Combat Arms Hacks & Cheats
    Replies: 3
    Last Post: 04-21-2009, 05:20 PM
  5. [Help] DirectX Overlays
    By JoshA56 in forum Visual Basic Programming
    Replies: 0
    Last Post: 01-19-2009, 02:32 PM