Results 1 to 10 of 10

Hybrid View

  1. #1
    Kryo4lex's Avatar
    Join Date
    Apr 2012
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    0
    My Mood
    Buzzed

    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

     
    Code:
    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

  2. #2
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,679
    My Mood
    Mellow
    Explicitly call DrawTextA instead of the DrawText macro, or change the character set of your project to "multi-byte"

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  3. #3
    kibbles18's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    US
    Posts
    860
    Reputation
    5
    Thanks
    127
    Or cast it as LPCWSTR
    Way she fuckin goes boys

  4. #4
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,679
    My Mood
    Mellow
    Quote Originally Posted by kibbles18 View Post
    Or cast it as LPCWSTR
    Casting doesn't work. A wide string can't be cast back and forth between to a C-string

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  5. #5
    Nico's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Germany :D
    Posts
    15,918
    Reputation
    1121
    Thanks
    8,622
    Quote Originally Posted by Jason View Post


    Casting doesn't work. A wide string can't be cast back and forth between to a C-string
    Not directly but there are ways to do it.

  6. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,679
    My Mood
    Mellow
    Quote Originally Posted by Nico View Post


    Not directly but there are ways to do it.
    I'm aware of that, but I just said a direct cast wouldn't work

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  7. #7
    Nico's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Germany :D
    Posts
    15,918
    Reputation
    1121
    Thanks
    8,622
    Quote Originally Posted by Jason View Post


    I'm aware of that, but I just said a direct cast wouldn't work
    Let's discuss more about that.

  8. #8
    lannyboy's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    97
    Reputation
    10
    Thanks
    420
    LPCWSTR in msvc++ is wchar_t *.
    you should declare UNICODE in your project.

  9. #9
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,679
    My Mood
    Mellow
    Quote Originally Posted by lannyboy View Post
    LPCWSTR in msvc++ is wchar_t *.
    you should declare UNICODE in your project.
    Thanks for being completely redundant. Toddle on.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

Similar Threads

  1. OpenGL With DirectX
    By kronus980 in forum General
    Replies: 7
    Last Post: 04-24-2010, 12:18 AM
  2. [Source Help]Read/Write Text[Solved]
    By Samueldo in forum Visual Basic Programming
    Replies: 4
    Last Post: 04-05-2010, 10:17 AM
  3. grab text and write text from address
    By CodeHPro in forum Visual Basic Programming
    Replies: 4
    Last Post: 08-30-2009, 11:14 AM
  4. Help with directx
    By xtcevolution in forum Combat Arms Hacks & Cheats
    Replies: 1
    Last Post: 10-21-2008, 05:45 PM
  5. Help With DirectX 9.0
    By GoBxHiTz in forum Combat Arms Hacks & Cheats
    Replies: 12
    Last Post: 08-22-2008, 10:25 AM

Tags for this Thread