Which of the following code segments will you use to accomplish this task?

Posted by: Pdfprep Category: GSSP-.NET Tags: , ,

You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET as its application development platform. You are creating an application using the .NET Framework.

You write the following code snippet to call a method from the Win32 API by using PInvoke:

int rst = MessageBox(hWd, Mytext, Mycaption, Mytype);

You are required define a method prototype.

Which of the following code segments will you use to accomplish this task?
A . [DllImport("user32")] extern int MessageBoxA(int hWd, String Mytext, String Mycaption, uint Mytype);
B . [DllImport("user32")] extern int Win32API_User32_MessageBox(Int hWd, String Mytext, String Mycaption, uint Mytype);
C . [DllImport("user32")] extern int MessageBox(int hWd, String Mytext, String Mycaption, uint Mytype);
D . [DllImport("C:\WINDOWS\system32\user32.dll")] extern int MessageBox(int hWd, String Mytext, String Mycaption, uint Mytype);

Answer: C

Leave a Reply

Your email address will not be published.