T
Trecius
Hello, Newsgroupians:
I've a question regarding the Win32 function EnumWindows. First, the
prototype for EnumWindows is as follows...
BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
As such, I have declared the following...
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int EnumWindows(EnumWindowsProcDelegate lpEnumFunc,
IntPtr lParam];
private delegate int EnumWindowsProcDelegate(IntPtr hwnd, IntPtr lParam);
Now, I'd like to call the EnumWindows. When it finds a specific window I'm
looking for, I want the lParam to be the return value of that specific
window. Here's an example...
IntPtr hwnd = new IntPtr();
EnumWindows(new EnumWindowsProcDelegate(EnumWndProc), hwnd);
....
private static int EnumWndProc(IntPtr hwnd, IntPtr lParam)
{
// For simplicity, the first window I find will be set to the lParam
lParam = hwnd;
}
However, after calling EnumWindows(...), hwnd is always 0x00000000 after the
EnumWndProc. As such, I tried the GCHandle, but I still get no where. Does
anyone know what I can do to return a client handle in the lParam?
Thank you, all.
Trecius
I've a question regarding the Win32 function EnumWindows. First, the
prototype for EnumWindows is as follows...
BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
As such, I have declared the following...
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int EnumWindows(EnumWindowsProcDelegate lpEnumFunc,
IntPtr lParam];
private delegate int EnumWindowsProcDelegate(IntPtr hwnd, IntPtr lParam);
Now, I'd like to call the EnumWindows. When it finds a specific window I'm
looking for, I want the lParam to be the return value of that specific
window. Here's an example...
IntPtr hwnd = new IntPtr();
EnumWindows(new EnumWindowsProcDelegate(EnumWndProc), hwnd);
....
private static int EnumWndProc(IntPtr hwnd, IntPtr lParam)
{
// For simplicity, the first window I find will be set to the lParam
lParam = hwnd;
}
However, after calling EnumWindows(...), hwnd is always 0x00000000 after the
EnumWndProc. As such, I tried the GCHandle, but I still get no where. Does
anyone know what I can do to return a client handle in the lParam?
Thank you, all.
Trecius