what is the difference between a handle and reference(pointer) to a variable or object
what is the difference between a handle and reference(pointer) to a variable or object
A pointer is just a variable that holds a memory address. A handle is a pointer to a pointer. I'm sure you understand the benefits of pointers, but handles are used quite a lot in Windows programming. When you have a complex GUI, the OS may need to move around large chunks of memory often. If your program has a pointer to one of these chunks that gets moved, the value of that pointer suddenly changes, which can cause problems for your program. That's why handles are used. The handle consistently points to one pointer, and that pointer will then point to wherever the memory is. Hope that helps.