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

How can you configure a .net remoting object via xml file?

0 Answers  


How can you debug failed assembly binds?

1 Answers  


How do you define the lease of the object?

1 Answers  


What do you mean by passport authentication and windows authentication ?

5 Answers   TCS,


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

8 Answers   Qwest, Sons Of Technology, TCS,


In which conditions do you opt for Remoting services?

8 Answers   Manland, Tech Mahindra,


Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs? In what way it is best?

2 Answers  


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

0 Answers  


How to register a shared assembly ?

1 Answers   Digital GlobalSoft,


When do we use delegates in your remoting applications?

0 Answers  


Explain the types of .net remoting?

0 Answers  


About .NET Remoting and types of remoting ?

2 Answers   MMTS, SunGard,


Categories