Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Code example of C# - use WinAPIs

10 views
Skip to first unread message

Mr. X.

unread,
May 21, 2012, 2:40:13 AM5/21/12
to
Hello.
I need some examples of codes of using WinAPIs in C#
(especially - use of enumChildWindow).

Thanks :)

Anders Eriksson

unread,
May 21, 2012, 6:28:58 AM5/21/12
to
Have a look at http://pinvoke.net
Sometimes there is a sample code!

// Anders

--
English isn't my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.

Peter Duniho

unread,
May 21, 2012, 12:50:04 PM5/21/12
to

Arne Vajhøj

unread,
May 21, 2012, 11:21:07 PM5/21/12
to
On 5/21/2012 2:40 AM, Mr. X. wrote:
> 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

0 new messages