[API]
GetOpenFileNameA
GetOpenFileNameW

[INCLUDE]
OPENFILENAME

[CODE]
Public Function GetOpenFileName_MultiDataString(ByRef xType1 As OPENFILENAME) As String
  Dim xType2 As OPENFILENAME_Real
  Dim xLong1 As Long

  Call OPENFILENAME_Patch(xType1, xType2)
  xType2.Flags = &H81204
  If IsUnicode Then
    xLong1 = GetOpenFileNameW(xType2)
    Else
    xLong1 = GetOpenFileNameA(xType2)
    End If
  If Not xLong1 = 0& Then
    GetOpenFileName_MultiDataString = String(OPENFILENAME_DataSize, vbNullChar)
    If IsUnicode Then
      Call RtlMoveMemory(ByVal StrPtr(GetOpenFileName_MultiDataString), ByVal xType2.lpstrFile, OPENFILENAME_DataSizeW)
      Else
      Call RtlMoveMemory(ByVal GetOpenFileName_MultiDataString, ByVal xType2.lpstrFile, OPENFILENAME_DataSize)
      End If
    xLong1 = InStr(GetOpenFileName_MultiDataString, vbNullChar & vbNullChar)
    If xLong1 = 0& Then
      GetOpenFileName_MultiDataString = ""
      Else
      GetOpenFileName_MultiDataString = Left(GetOpenFileName_MultiDataString, xLong1 + 1&)
      End If
   End If
  Call OPENFILENAME_Free(xType2)
  End Function
