This callback function is called when I press a button, but I wanted to pass the handle out of it to use it in another button or something else, and use openprocess out of it. How?
Thanks.
This callback function is called when I press a button, but I wanted to pass the handle out of it to use it in another button or something else, and use openprocess out of it. How?
What is "EnumWindowsProcb"?
If you mean "EnumWindowsProc", then that's what the second parameter to EnumWindowsProc is for.
I mean, I want to use hProcess out of the bool, the lparam I sent with enumwindows() is going to be used at the bool, but the variables I declare inside the bool can't be used out of it. Example:
I mean, I want to use hProcess out of the bool, the lparam I sent with enumwindows() is going to be used at the bool, but the variables I declare inside the bool can't be used out of it.
I have no idea what you are trying to say.
If you are saying that you want that variable set, then pass the entire object as the second parameter and store the value there in the EnumWindowProcb function.
but the variables I declare inside the bool can't be used out of it.
I doubt you are interesting in accessing precisely a variable of the callback context. Your interest is the value of the variable, and this is where lParam gives you the pointer to the variable from original function context:
From Paul's example:
Code:
static BOOL CALLBACK EnumWindowsProcb(HWND hwnd, LPARAM lParam)
{
//...
HANDLE *pHandle = (HANDLE*)lParam;
*pHandle = hProcess; // here you copy the value of local variable hProcess
....
Last edited by Igor Vartanov; October 28th, 2010 at 12:37 AM.
Bookmarks