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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / moghan

Yes we can call a native function exported from a Dll in
the following way,
I used C#.Net for Coding.

Add a Namespace that "System.Runtime.InteropServices"

Then use the following code,

Syntax:
[DllImport("dllname")]
here place the function in "dllname" Dll.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Dot Net Remoting Interview Questions

What is strong name and what is the purpose of strong name ?

8 Answers   Qwest, Sons Of Technology, TCS,


explain is .NET Remoting?

2 Answers   Mind Tree,


Which Namespaces is used to achieve the Remoting?

0 Answers  


How can you create a strong name for a .NET assembly?

2 Answers  


What are dynamic assemblies?

0 Answers  






What is the Difference between CAO and SAO in Remoting.

0 Answers  


What is the difference between the RegisterWellknownServiceType(), RegisterWellknownClientType(), RegisterActivatedServiceType() and RegisterActivatedClientType() in .net?

0 Answers  


What are the different types of channels used by .net remoting and which is the best one?

0 Answers  


How to directly call a native function exported from a dll?

0 Answers  


When do we use delegates in your remoting applications?

0 Answers  


what is Client-activated object in remoting?

0 Answers   DELL,


What is a formatter in .net remoting?

0 Answers  


Categories