nerdexam
GIAC

GSSP-NET · Question #140

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…

The correct answer is C. [DllImport("user32")] extern int MessageBox(int hWd, String Mytext, String Mycaption, uint. See the full explanation below for the reasoning.

Question

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?

Options

  • A[DllImport("user32")] extern int MessageBoxA(int hWd, String Mytext, String Mycaption,
  • B[DllImport("user32")] extern int Win32API_User32_MessageBox(Int hWd, String Mytext,
  • C[DllImport("user32")] extern int MessageBox(int hWd, String Mytext, String Mycaption, uint
  • D[DllImport("C:\WINDOWS\system32\user32.dll")] extern int MessageBox(int hWd, String

How the community answered

(38 responses)
  • A
    11% (4)
  • B
    3% (1)
  • C
    82% (31)
  • D
    5% (2)

Community Discussion

No community discussion yet for this question.

Full GSSP-NET Practice