::TextOut vs CDC::TextOut

This is a discussion on ::TextOut vs CDC::TextOut within the Windows Programming forums, part of the Platform Specific Boards category; I am wrote a DLL to hook the TextOut calls to GDI32.dll. This works if the programs that run use ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    170

    ::TextOut vs CDC::TextOut

    I am wrote a DLL to hook the TextOut calls to GDI32.dll. This works if the programs that run use ::TextOut but does not work if they do pDC->TextOut in OnDraw().

    What is the difference between the two? What would I hook to get access to the CDC::TextOut calls?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Apijaking huh?

    I havent bothered to troll the MFC source (which is available with VC++ BTW).....but I imagine CDC::TextOut does call TextOut and I guess its missed here because when you hook an API, you hook the symbols in your exe's import table....and if you use MFC, then I suppose the MFC runtime will call TextOut....not your app.....so that's why its being missed....

    I havent tried this though....just guessing

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    170
    Yes. I found the API hijacking info and have been tayloring it to my needs.

    You answer was a little over my head. I don't know what that means about my exe's import table.

    Currently I hook everything. I want to log all the text that ever appears on the screen. It wasn't working, so I wrote a little app that did a pDC->TextOut and that didnt work. Then I changed to ::TextOut and it did work.

    I am hoping to use this to collect all the text in a given application. And I similarly hope to be able to read the cards in a solitaire game, a question I previusly posted.

    Can you point me at something to help me understand why it's not working? I respect your opinions and advice, I just don't fully understand it this time . I am sure it will make perfect sense after I understand it.
    Best Regards,

    Bonkey

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    You should have a knowledge on the PE executable format and if possible some basic ASM

    The best person to learn this stuff from is the person that pioneered the methods you are using - Matt Pietrek. He's a win guru that's been writing for MSDN for years.....

    I think this article touches on the subject, but do a search on his name and Api Hijack/hook and you will find other stuff

    Happy reading!

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Actually, that's not the best article...but its worth a read

    Try this first

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using TextOut() to align positive & negative numbers
    By csonx_p in forum Windows Programming
    Replies: 4
    Last Post: 05-27-2008, 08:12 AM
  2. TextOut() flickering
    By Xterria in forum Game Programming
    Replies: 6
    Last Post: 01-22-2004, 09:55 PM
  3. TextOut() Questions
    By Dipset in forum Windows Programming
    Replies: 2
    Last Post: 07-05-2003, 12:38 PM
  4. print TextOut
    By andrewjf9 in forum Windows Programming
    Replies: 2
    Last Post: 11-21-2002, 11:36 PM
  5. TextOut problem
    By Chimpsag in forum Windows Programming
    Replies: 1
    Last Post: 09-14-2002, 01:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21