Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

vb.net - GetShortPathName

Empfohlene Antworten

Veröffentlicht

Hi Leute!

Versuch mir hier grade nen kleinen Mediaplayer zu basteln und verzweifel gerade an GetShortPathName...

Also was das gute Stück machen soll weiss ich ja, allerdings haperts hier an den Parametern. Wie im Titel schon angesprochen versuch ich das ganze in vb.net zu machen. Über MCI soll ne Audiodatei geöffnet werden.

Nachdem ich bisher keinen Plan hatte wie ich das ganze anstellen soll hab ich mir aus den Tiefen des Internets ein Beispiel besorgt allerdings wurde das für vb 6.0 geschrieben und wie solls auch anders sein haperts etz in vb.net...

Hier mal ein Auszug aus dem Code:

    Public Sub mciOpen(ByVal sFile As String, _

      Optional ByVal hwnd_Output As Long = 0)


        Dim sBuffer As String * 255

        Dim sType As String

        Dim nResult As Long

        Dim sExt As String

        Dim bVideo As Boolean


        On Error Resume Next


        ' kurzen Dateinamen ermitteln

        nResult = GetShortPathName(sFile, sBuffer, Len(sBuffer))

        sFile = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1)

So und mein Problem stellt hierbei sBuffer dar...

Wie ich von einem Freund erfahren hab bewirkt das "* 256" das die Länge von sBuffer festgelegt wird. Ich hab jetzt zum einen keinen Plan wie ich das in vb.net anstellen kann und beim Versuch das ganze ohne diese Begrenzung zu starten bekam ich folgende Fehlermeldung:

A call to PInvoke function 'MyMediaPlayer!WindowsApplication1.MCI::GetShortPathName' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Wenn mir jemand erklären könnte wieso das Ganze nicht geht und wie ich das ändern könnte, wäre ich sehr dankbar :D

So long,

Bogi

sBuffer ist in diesem Fall wohl ein einfaches char[] (wird in VB glaube ich einfach mit char(256) gemacht).

versuchs mal mit

Dim sBuffer As Char(255)

steht auch unter Galileo Computing: Einstieg in VB.NET – 2.18 Arrays (Datenfelder)

evtl. solltest Du Dir mal das gesamte Buch reinziehen ;)

MfG

MarkusLe

Ah super, danke :)

werd ich daheim gleich mal ausprobieren, buch denk ich mal wird auch zum einsatz kommen ^^

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.