How do you directly call a native function exported from a
DLL?

Answer Posted / santhanakumar

HERE IS THE CODE EXAMPLE :

using System.Runtime.InteropServices; \
class C
{
[DllImport("user32.dll")]
public static extern int MessageBoxA(int h, string
m, string c, int type);
public static int Main()
{
return MessageBoxA(0, “Hello
World!”, “Caption”, 0);
}
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the Difference between CAO and SAO in Remoting.

564


When should we choose .net remoting over .net web services?

542


What do you mean by passport authentication?

532


Explain how does assembly versioning in .net prevent dll hell?

554


Explain how to perform remoting?

528






Define singleton activation mode in .net remoting?

525


Explain the types of .net remoting?

612


Which Namespaces is used to achieve the Remoting?

571


What are the security features in .net remoting?

547


Explain the difference between the registerwellknownservicetype(), registerwellknownclienttype(), registeractivatedservicetype() and registeractivatedclienttype() in .net?

536


What is the purpose of strong name?

582


Difference between web services & remoting?

610


What is the difference beween the registerwellknownservicetype() and registerwellknownclienttype()?

602


Will clr handle unmanaged code or not?

579


What are the types of remoting?

549