none
Falscher Datentyp in VB.net / Verständnisproblem RRS feed

  • Frage

  • Hallo,

    wenn ich mein Script analysieren lasse, bekomme ich für die folgende Zeile 3 Warnungen, für die ich nicht weiß wie ich sie lösen soll:

     Private Declare Ansi Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Integer, ByRef lpdwProcessId As IntPtr) As IntPtr

    Hier die zugehörigen Warnungen:

    Because it is a P/Invoke method, 'ScriptMain.GetWindowThreadProcessId(Integer, ByRef IntPtr)' should be defined in a class named NativeMethods, SafeNativeMethods, or UnsafeNativeMethods.

    As it is declared in your code, parameter 'hWnd' of P/Invoke 'ScriptMain.GetWindowThreadProcessId(Integer, ByRef IntPtr)' will be 4 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 8 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Integer'.

    As it is declared in your code, the return type of P/Invoke 'ScriptMain.GetWindowThreadProcessId(Integer, ByRef IntPtr)' will be 8 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'IntPtr'.

    Ich habe dieses Script im Zuge der Migration von SQL Server 2008 nach 2016 geprüft.

    Da ich nicht der tiefe Kenner dieser Dinge bin stehe ich gerade vor einem Rätsel und komme nicht weiter.

    Gruß

    cheapy

    Freitag, 18. Juni 2021 10:59

Antworten

Alle Antworten