Solved DirectX Text in hwnd!

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
Hello. Im getting a problem, im trying to do a text overlay in a hwnd, and it works, problem is that the background is getting black. Is there anyway to remove this ?

here is the code.....

C++:
int RenderIt()
{

    dx_Device->Clear(0, 0, D3DCLEAR_TARGET, 0, 1.0f, 0);
    dx_Device->BeginScene();
    DrawText("LALALALL HELLOW",100,100,255,0,255);

    dx_Device->EndScene();
    dx_Device->PresentEx( 0, 0, 0, 0, 0);
}


int DrawText(char* String, int x, int y, int r, int g, int b)
{
    RECT Font;
    Font.bottom = 0;
    Font.left = x;
    Font.top = y;
    Font.right = 0;
    dx_Font->DrawTextA(0, String, strlen(String), &Font, DT_NOCLIP, D3DCOLOR_ARGB(255, r, g, b));

    return 0;
}


int D3DIniti(HWND hWnd)
{
    if(FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, &dx_Object)))
        exit(1);

    dx_Param.BackBufferFormat    = D3DFMT_A8R8G8B8;
    dx_Param.hDeviceWindow        = hWnd;
    dx_Param.MultiSampleQuality = DEFAULT_QUALITY;
    dx_Param.SwapEffect            = D3DSWAPEFFECT_DISCARD;
    dx_Param.Windowed            = true;

    if(FAILED(dx_Object->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &dx_Param, 0, &dx_Device)))
        exit(1);

    D3DXCreateFont(dx_Device, 15, 0, 0, 0, false, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH, "Verdana", &dx_Font);

    return 0;
}
 

Rake

I'm not your friend
Administrator
Jan 21, 2014
12,513
78,998
2,419
read this entire guide and check the links
 
Last edited:

brinkz

Coder
Meme Tier VIP
Sep 3, 2012
209
1,688
12
#include <dwmapi.h>
#pragma comment ( lib, "dwmapi.lib" )

MARGINS:
C++:
typedef struct _MARGINS
{
    int cxLeftWidth;      // width of left border that retains its size
    int cxRightWidth;     // width of right border that retains its size
    int cyTopHeight;      // height of top border that retains its size
    int cyBottomHeight;   // height of bottom border that retains its size
} MARGINS, *PMARGINS;
Taken from Uxtheme.h
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
#include <dwmapi.h>
#pragma comment ( lib, "dwmapi.lib" )

MARGINS:
C++:
typedef struct _MARGINS
{
    int cxLeftWidth;      // width of left border that retains its size
    int cxRightWidth;     // width of right border that retains its size
    int cyTopHeight;      // height of top border that retains its size
    int cyBottomHeight;   // height of bottom border that retains its size
} MARGINS, *PMARGINS;
Taken from Uxtheme.h
ive include dwmapi and the lib...thats why im so confused
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Similar threads

Community Mods