Seite 1 von 1

Erledigt: kompleten Pfad bei Nezlaufwerk erhalten

Verfasst: 17.08.2009 21:16
von Elektrolurch
Hallo

Ich habe mal wieder eine Frage, warscheinlich ist sie so banal aber mir fällt halt nichts ein.

Ich hole mir mit einem PathRequester den Pfad oder Laufwerksbuchstaben.
Wie kann ich bei einem Netzlaufwerk die IPadresse des Pfads also den kompletten Pfad herausbekommen?

BYe Andre

Verfasst: 17.08.2009 21:51
von ABBKlaus
WNetGetConnection könnte da helfen :

Code: Alles auswählen

Procedure.s WNetGetConnection(local$) 
;http://msdn.microsoft.com/library/Default.asp?url=/library/en-us/wnet/wnet/wnetgetconnection.asp
  If Len(local$)>0 
    local$=Mid(local$,1,1)+":" 
  Else 
    ProcedureReturn "" 
  EndIf 
  
  res=0 
  len=512 
  remotename$=Space(len) 

  ;Callfunction works
  ;mpr=OpenLibrary(#PB_Any,"mpr.dll") 
  ;If mpr<>0 
  ;  res=CallFunction(mpr,"WNetGetConnectionA",@local$,@remotename$,@len) 
  ;  CloseLibrary(mpr) 
  ;EndIf 
  
  ;API call in Purebasic 3.94 is not working : 
  ;WNetGetConnection_() is not a function, an array, or a linked list 
  res=WNetGetConnection_(@local$,@remotename$,@len) 
  
  If res<>0 
    remotename$="" 
  EndIf 
  
  ProcedureReturn remotename$ 
EndProcedure

Debug WNetGetConnection("Z:\")

Verfasst: 18.08.2009 21:21
von Elektrolurch
Hi ABBKlaus

Hat super funktioniert

Nochmal Besten Dank

BYe Andrè