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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bechir BejaouiPosted Feb 19, 2009, 5:42 PM
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
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