Code example of C# - use WinAPIs

M

Mr. X.

Hello.
I need some examples of codes of using WinAPIs in C#
(especially - use of enumChildWindow).

Thanks :)
 
A

Arne Vajhøj

I need some examples of codes of using WinAPIs in C#
(especially - use of enumChildWindow).

Example snippet:

public delegate bool Win32Callback(IntPtr hwnd, IntPtr lParam);
[DllImport("user32.Dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumChildWindows(IntPtr parentHandle,
Win32Callback callback,IntPtr lParam);
public bool Show(IntPtr hwnd, IntPtr lParam)
{
MessageBox.Show(hwnd.ToInt64().ToString());
return true;
}
public void Button1Click(object sender, EventArgs e)
{
EnumChildWindows(this.Handle, Show, IntPtr.Zero);
}

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top