You write the following code to call a function from the Win32 Application Programming Interface (API) by using platform invoke.

You write the following code to call a function from the Win32 Application Programming Interface
(API) by using platform invoke.
int rc = MessageBox(hWnd, text, caption, type); You need to define a methon prototype.
Which code segment should you use?

A. [DllImport("user32")]public static extern int MessageBox(int hWnd, String text,
    String caption, uint type);
B. [DllImport("user32")]public static extern int MessageBoxA(int hWnd, String text,
    String caption, uint type);
C. [DllImport("user32")]public static extern int Win32API_User32_MessageBox(
    int hWnd, String text, String caption, uint type);
D. [DllImport(@"C:\WINDOWS\system32\user32.dll")]public static extern int
    MessageBox(int hWnd, String text,

    String caption, uint type);


Answer: A

No comments:

Post a Comment