I sense a lil' bit of arrogance from someone ostensibly asking for help.
1 2 3 4 5
|
void Player_t::ReadPlayerInformation()
{
ReadProcessMemory(HANDLE hProcess)
}
| |
This doesn't make sense, it isn't valid syntax. Pass your HANDLE object as a parameter of your ReadPlayerInformation method.
void Player_t::ReadPlayerInformation(HANDLE the_name_of_the_local_handle_variable)
Otherwise, you have to make your HANDLE object a global variable (or global variable with a fancy wrapper on it that people like to call a "Singleton"), which I do not suggest.
Edit and Edit 2:
My question and your answer has nothing to do at all. That is simple stuff. This is different. |
Passing data to a function is not complicated. I think you're confused on the nature of passing by value. Say the data in the HANDLE object (regardless of actual type) is 13245. When you pass your handle function by value to a function, you are copying that value 13245. In this scenario, that value represents the "handle" to the actual data you want, which is more than just one number. You can think of a "handle" as another word for "pointer".
That being said, there can be times that make this more complicated, in general. Say the data that your HANDLE points to outlives the scope of the function it was created it, then you will have to do something a bit more complicated to not have a memory leak, but based on what you've shown us so far, this does not appear to be the case.