hi all
I hope to know how to use user32.dll in my C# windows Application and i will appreciate who uploaded user32.dll with thanx.
hi all
I hope to know how to use user32.dll in my C# windows Application and i will appreciate who uploaded user32.dll with thanx.
Know the answer? Post it. Somebody with the same question will find it here.
Bechir BejaouiRank #144 · 15.9K pointsPosted Feb 19, 2009, 12:42 PM EST
You have to use COM interop because user32 is unmanaged code that means written outside the .Net language C, C++(not VC++) so we use the System.Runtime.InteropServices to import this unmanaged code
First add the namespace System.Runtime.Interop
Then to call any function within user32.dll library you have to do as follow
[DllImport("user32.dll")]
static extern <Method name>(Arg0, Arg1,........,ArgN);
then to call it you simply invoke it within your code
Example:
To draw text using the method DrawText of user32.dll
http://www.pinvoke.net/default.aspx/user32.DrawText