How can I add a reference of a COM DLL in my application?
I have tried to add kernel32.dll and user32.dll but these are not supporting..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should not need to add a reference to either kernel32.dll or user32.dll. These DLLs are part of Windows and can be imported in your code without adding a reference. You do this using P/Invoke.
For example, to call the function SendMessage in user32.dll, you could use the following C# code:
For more information and code snippets for methods in these DLLs, check out the P/Invoke wiki.
EDIT: You may also check out this article from the MSDN magazine for more information about P/Invoking and specifically some of the author’s comments about style and best practices.