You write the following code to call a function from the Win32 Application Programming Interface

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 method prototype.
Which code segment should you use?

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

Answer: A

No comments:

Post a Comment