none
GetConsoleMode RRS feed

  • Frage

  • Hallo

    ich bekomme hier immer einen Fehler (Visual basic NEt4.7.2. Win10):

        <DllImport("kernel32.dll", SetLastError:=True)>
        Private Function GetStdHandle(ByVal nStdHandle As Integer) As IntPtr
        End Function
        Private STD_OUTPUT_HANDLE As Integer = -11
        Private STD_INPUT_HANDLE As Integer = -10
        Private STD_ERROR_HANDLE As Integer = -12

        <DllImport("kernel32.dll", SetLastError:=True)>
        Private Function GetConsoleMode(hConsoleHandle As IntPtr, lpMode As UInt32) As Boolean
        End Function

    Dim hStd As IntPtr, uMode As UInt32, bMode as Boolean

    hStdIn = GetStdHandle(STD_INPUT_HANDLE)

    bMode = GetConsoleMode(hStd, uMode)

    System.AccessViolationException
      HResult=0x80004003
      Message=Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.
      Source=<Cannot evaluate the exception source>
      StackTrace:
    <Cannot evaluate the exception stack trace>

    Was stimmt nicht?

    Vielen Dank.



    Mittwoch, 28. September 2022 13:00

Antworten

  • i found the answer myself:

    i modified

    Private Function GetConsoleMode(hConsoleHandle As IntPtr, lpMode As UInt32) As Boolean

    to

    Private Function GetConsoleMode(hConsoleHandle As IntPtr, ByRef lpMode As UInt32) As Boolean

    Mittwoch, 28. September 2022 13:56