Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » C++CLI / VB .Net / .Net-Framework » Verbindung zu FTP-Server

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: > 1 <
000
04.03.2009, 15:10 Uhr
Angelika_25



Hallo, ich habe in einem Modul folgenden Code:

Code:
Public Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" _
   (ByRef lpNetResource As NETRESOURCE, ByVal lpPassword As String, _
   ByVal lpUserName As String, ByVal dwFlags As Integer) As Integer

    Public Declare Function WNetCancelConnection2 Lib "mpr" Alias "WNetCancelConnection2A" _
  (ByVal lpName As String, ByVal dwFlags As Integer, ByVal fForce As Integer) As Integer

    Public Structure NETRESOURCE
        Public dwScope As Integer
        Public dwType As Integer
        Public dwDisplayType As Integer
        Public dwUsage As Integer
        Public lpLocalName As String
        Public lpRemoteName As String
        Public lpComment As String
        Public lpProvider As String
    End Structure

    Public Const ForceDisconnect As Integer = 1
    Public Const RESOURCETYPE_DISK As Long = &H1

    Public Function MapDrive(ByVal UNCPath As String) As Boolean

        Dim nr As NETRESOURCE
        Dim strUsername As String
        Dim strPassword As String

        nr = New NETRESOURCE
        nr.lpRemoteName = UNCPath
        ' nr.lpLocalName = DriveLetter & ":"
        strUsername = Server_Benutzer()
        strPassword = Server_Kennwort()
        nr.dwType = RESOURCETYPE_DISK

        Dim result As Integer
        result = WNetAddConnection2(nr, strPassword, strUsername, 0)

        If result = 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Public Function UnMapDrive(ByVal DriveLetter As String) As Boolean
        Dim rc As Integer
        rc = WNetCancelConnection2(DriveLetter & ":", 0, ForceDisconnect)

        If rc = 0 Then
            Return True
        Else
            Return False
        End If

    End Function


In meiner Form habe ich folgendes:

Code:
''.txt in .sav umbenennen auf dem Server
                        MapDrive(Server_Ordner())
                        Dim oFile As System.IO.FileInfo
                        ' Directory-Object erstellen
                        Dim oDir As New System.IO.DirectoryInfo(Server_Ordner())
                        Dim oFiles As System.IO.FileInfo()

                        ' alle Dateien des Ordners
                        oFiles = oDir.GetFiles("*.txt")
                        For Each oFile In oFiles
                            IO.File.Move(oFile.FullName, oFile.FullName)
                            IO.File.Move(oFile.FullName, oFile.FullName & ".sav")
                        Next


Damit möchte ich .txt Files vom Server in .sav Files verwandeln, aber der Code in meiner Form funktioniert nicht, ich weiß nicht warum.
Ich würde mich über eine Hilfe sehr freuen!!!


Liebe Grüße
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: > 1 <     [ C++CLI / VB .Net / .Net-Framework ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: