33,323
社区成员




#include <stdlib.h>
class TestThisPointer
{
public:
TestThisPointer(void):n(0){}
~TestThisPointer(void){}
public:
static void TestStatic(void)
{
unsigned long dwThisPtr = 0;
__asm
{
MOV dwThisPtr, EBX
}
TestThisPointer* thisPtr = (TestThisPointer*)dwThisPtr;
thisPtr->SayHello();
}
void SayHello(void)
{
printf("%d:Hello.\n", n);
++n;
}
private:
int n;
};
int main(int argc, char* argv[])
{
TestThisPointer obj;
unsigned long objAddress = (unsigned long)&obj;
unsigned long temp = 0;
__asm
{
MOV EBX, objAddress
}
TestThisPointer::TestStatic();
system("pause");
return 0;
}