Gold mine of Visual C++ tricks!
How to Watch this Pointer – The Wizards Way!
![]()
How to watch the this pointer? Just add ‘this’ to watch window. Everyone does like that. Isn’t it? But how Visual C++ wizards watch ‘this’ pointer?

![]()
The secret is, visual C++ compiler passes this pointer via ECX register. So add (ClassName*)(@ECX) to watch window will give you this pointer. Have a look at the screenshot.

![]()
Interesting, the internals of Visual C++. Isn’t it?
![]()
Targeted Audiance – Intermediate.
Another way open the C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat file and put those string inside.
Wow, cool site. Thanks for posting. Really like reading sites like this.
Excellent observations and you have a great way of expressing things. Thanks for this.
No posts after July? Where are you?
What about adding ‘this’ into watch window?
It works as well
Hi Glaz,
Thanks for the comment. The intention of this article is about – how ‘this’ pointer is passed underneath.
A candle can be lighted by using a magic wand or by using a matchbox. Using matchbox is easy but magic wand need skills.
Best Regards,
Jijo.