You write the following code to call a function from the Win32 Application Programming Interface (API) by using platform invoke. Dim r As Integer = MessageBox(hWnd, strText, strCaption, strType) You need to define a method prototype. Which code segment should you use?

You write the following code to call a function from the Win32 Application Programming Interface
(API) by using platform invoke.
Dim r As Integer = MessageBox(hWnd, strText, strCaption, strType)
You need to define a method prototype. Which code segment should you use?

 A. <DllImport("user32")> _Function MessageBox( _
    ByVal hWnd As IntPtr, ByVal text As String, _
    ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function
B. <DllImport("user32")> _Function MessageBoxA( _
    ByVal hWnd As IntPtr, ByVal text As String, _
    ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function
C. <DllImport("user32")> _Function Win32API_User32_MessageBox ( _
    ByVal hWnd As IntPtr, ByVal text As String, _
    ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function
D. <DllImport("C:\WINDOWS\system32\user32.dll ")> _Function MessageBox( _
    ByVal hWnd As IntPtr, ByVal text As String, _
    ByVal Caption As String, ByVal t As UInt32) As IntegerEnd Function

Answer: A

No comments:

Post a Comment