Writing text with DirectX
Hi guys , in the last days I read a lot about hooking and how to create a DirectX-overlay.
With the help of many tutorials I managed to create a injectable DLL.
Now I want to Print some text before the EndScene. I also did this with rectangles and it worked.
My problem is that all tutorials I found didn't work at all , or i guess im to stupid
Ok I used this tut from
MPGH
i used the first method , here is the Code , I put this in a header and want to call it in the cpp file
void PrintText1(double x, double y, DWORD dwColor, LPD3DXFONT pFont, char *Text, ...)
{
char buffer[256];
//This is for handling the "..." parameters
va_list argList;
va_start(argList, Text);
vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer) - strlen(buffer), Text, argList);
va_end(argList);
//Our Rect to where the text will be printed
RECT Rect =
{
x,
y,
x + 500,
y + 50
};
pFont->DrawText(NULL, buffer, -1, &Rect, DT_NOCLIP, dwColor);
}
But always get this Error in Visual Studio 2010:
IntelliSense: argument of type "char *" is incompatible with parameter of type "LPCWSTR"
Ok and then my problem is how to call the function correctly
Have you any other suggestions to display text , or do you know why this isn't working?
THX in advance

Explicitly call DrawTextA instead of the DrawText macro, or change the character set of your project to "multi-byte"
LPCWSTR in msvc++ is wchar_t *.
you should declare UNICODE in your project.