Macht man das so in 2012?

  • VB.NET

Es gibt 7 Antworten in diesem Thema. Der letzte Beitrag () ist von RodFromGermany.

    Macht man das so in 2012?

    Hallo,

    macht man das hier noch so in VS 2012?

    VB.NET-Quellcode

    1. Delegate Function DigMnP(wUcW As IntPtr, gDtnKmwic As UInteger()) As <MarshalAs(UnmanagedType.Bool)> Boolean
    2. Delegate Function BNKirR(sVmi As IntPtr, aiYK As IntPtr) As UInteger
    3. Delegate Function quIckc(sVmi As IntPtr, aiYK As IntPtr, ByRef bufr As IntPtr, bufroUniuersa As Integer, ByRef MsTg As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
    4. Delegate Function DnfchP(wUcWead As IntPtr, DtnE As IntPtr) As UInteger



    Oder wurde das auch schon abgelöst?

    Ich kenn es nur so.
    Fehler , wenn ich Folgendes probiere:



    VB.NET-Quellcode

    1. Private DDegat As Func(Of IntPtr, IntPtr) = Function(A As IntPtr, B As IntPtr) As UInteger
    2. End Function



    Nested function does not have a signature that is compatible with delegate
    System.Func(Of Intptr, Intptr)



    Ist der Datentyp nicht geeignet?

    VB.NET-Quellcode

    1. Private _del As Func(Of IntPtr, IntPtr, UInteger)


    Der letzte Parameter hier gibt den Rückgabetyp an. Intellisense sagt Dir das.
    Die Unendlichkeit ist weit. Vor allem gegen Ende. ?(
    Manche Menschen sind gar nicht dumm. Sie haben nur Pech beim Denken. 8o
    Wenn ich es so habe:

    VB.NET-Quellcode

    1. Private Function CIt(Of T)(A As String, B As String) As T
    2. Return DirectCast(DirectCast(Marshal.GetDelegateForFunctionPointer(GetProcAddress(LoadLibrary(A), B), GetType(T)), Object), T)
    3. End Function
    4. Delegate Function ADegat(A As IntPtr, B As UInteger()) As <MarshalAs(UnmanagedType.Bool)> Boolean
    5. Delegate Function BDegat(A As IntPtr, B As IntPtr) As UInteger
    6. Delegate Function CDegat(A As IntPtr, B As IntPtr, ByRef C As IntPtr, D As Integer, ByRef E As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
    7. Delegate Function DDegat(A As IntPtr, B As IntPtr) As UInteger
    8. Delegate Function EDegat(A As IntPtr, B As UInteger()) As <MarshalAs(UnmanagedType.Bool)> Boolean
    9. Delegate Function FDegat(A As IntPtr, B As IntPtr, C As IntPtr, D As Integer, E As Integer) As IntPtr
    10. Delegate Function GDegat(A As IntPtr, B As IntPtr, C As Byte(), D As UInteger, E As Integer) As Boolean
    11. Private GDegTest As Func(Of IntPtr, IntPtr, Byte(), UInteger, Integer, Boolean)


    Wie kann ich diese Zeile dann anpassen?


    VB.NET-Quellcode

    1. Dim Ap As GDegat = CIt(Of GDegat)("TEST", "hallo")


    Würde nämlich gerne GDegTest nutzen.
    @Kevin Hombre:
    Willst Du mit einer DLL kommunizieren? Da müssen beide Seiten schon kompatibel sein.
    Gugst Du hier.
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!