DllImportAttribute.EntryPoint 필드

정의

호출할 DLL 진입점의 이름 또는 서수를 나타냅니다.

public: System::String ^ EntryPoint;
public string EntryPoint;
public string? EntryPoint;
val mutable EntryPoint : string
Public EntryPoint As String 

필드 값

예제

다음 코드 예제에서는 특성을 사용하여 DllImportAttribute Win32 MessageBox 함수를 가져오는 방법을 보여줍니다. 이 코드 예제에서는 속성을 사용하여 EntryPoint 가져올 함수를 지정한 다음 이름을 MyNewMessageBoxMethod로 변경합니다.

using System;
using System.Runtime.InteropServices;

class Example
{
    // Use DllImport to import the Win32 MessageBox function.
    // Specify the method to import using the EntryPoint field and 
    // then change the name to MyNewMessageBoxMethod.
    [DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "MessageBox")]
    public static extern int MyNewMessageBoxMethod(IntPtr hWnd, String text, String caption, uint type);
    
    static void Main()
    {
        // Call the MessageBox function using platform invoke.
        MyNewMessageBoxMethod(new IntPtr(0), "Hello World!", "Hello Dialog", 0);
    }
}
Imports System.Runtime.InteropServices

Module Example

    ' Use DllImport to import the Win32 MessageBox function.
    ' Specify the method to import using the EntryPoint field and 
    ' then change the name to MyNewMessageBoxMethod.
    <DllImport("user32.dll", CharSet:=CharSet.Unicode, EntryPoint:="MessageBox")> _
    Function MyNewMessageBoxMethod(ByVal hwnd As IntPtr, ByVal t As String, ByVal caption As String, ByVal t2 As UInt32) As Integer
    End Function


    Sub Main()
        ' Call the MessageBox function using platform invoke.
        MyNewMessageBoxMethod(New IntPtr(0), "Hello World!", "Hello Dialog", 0)
    End Sub

End Module

설명

진입점이 포함된 DLL의 이름을 나타내는 문자열을 제공하여 진입점 이름을 지정하거나 진입점을 서수로 식별할 수 있습니다. 서수에는 #1과 같은 # 기호 접두사로 지정됩니다. 이 필드를 생략하면 공용 언어 런타임은 로 표시된 DllImportAttributethe.NET 메서드의 이름을 사용합니다.

자세한 내용은 DLL에서 함수 식별을 참조하세요. 필드를 사용하는 방법을 보여 주는 예제는 EntryPoint진입점 지정을 참조하세요.

적용 대상

추가 정보