Question: In C++, can I simply cast a pointer to a DWORD?

```
MyClass * thing;
DWORD myPtr = (DWORD)thing;

```

Would that work?

Answer: 
You undoubtedly *can* do it.

Whether it would work will depend on the environment and what you want it to do.

On 32-bit Windows1 (the most common place to see `DWORD`) it'll normally be fine. On a 64-bit Windows (where you also see `DWORD`, but not nearly as much) it generally won't. 

---

1. Or, more accurately, when compiled as a 32-bit executable that will run as a 32-bit process, regardless of the actual copy of Windows you happen to run that on.
No, in a 64 bit process, a pointer is 64 bits but a DWORD is only 32 bits. Use a DWORD\_PTR.