I'm porting a piece of code from VC6 to VS2008. The code typedef
s HSPRITE
as int
. But Windows SDK 6.1 already declared HSPRITE
through DECLARE_HANDLE
. I don't want to rename HSPRITE
in my code since it will consume a lot of time to rename it in .cpp files. So, how can I undeclare HSPRITE
?
How can I undeclare DECLARE_HANDLE?
801 Views Asked by Triang3l At
2
There are 2 best solutions below
1

The only correct way is to not include the header that defines HSPRITE, which may not be an option.
Alternatively you should check out one of the following:
Do you really use HSPRITE as an int? Maybe you can remove the definition of HSPRITE from your code and use the one defined in windows' headers.
Use Find and Replace to rename HSPRITE to some other name in your code; it's a matter of a few seconds.
Best is what @ybungalobill says. If you absolutely cannot use his answer, you can also trick windows.h into not declaring it, like this: