Click here to Skip to main content
16,015,641 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Convert VB.NET sources into VB6 Pin
marsup5424-Jan-06 0:08
marsup5424-Jan-06 0:08 
GeneralRe: Convert VB.NET sources into VB6 Pin
marsup5424-Jan-06 0:41
marsup5424-Jan-06 0:41 
GeneralRe: Convert VB.NET sources into VB6 Pin
Joshua Quick24-Jan-06 6:56
Joshua Quick24-Jan-06 6:56 
AnswerRe: Convert VB.NET sources into VB6 Pin
Mekong River23-Jan-06 16:59
Mekong River23-Jan-06 16:59 
AnswerRe: Convert VB.NET sources into VB6 Pin
Kedar Potdar1-Feb-06 1:44
Kedar Potdar1-Feb-06 1:44 
GeneralRe: Convert VB.NET sources into VB6 Pin
marsup542-Feb-06 7:29
marsup542-Feb-06 7:29 
QuestionVB.NET , Grab networked drive name Pin
natdoggy223-Jan-06 4:41
natdoggy223-Jan-06 4:41 
AnswerRe: VB.NET , Grab networked drive name Pin
progload23-Jan-06 12:12
progload23-Jan-06 12:12 
Something like this:

Private Const NO_ERROR = 0
Private Const ERROR_MORE_DATA = 234

Private Declare Auto Function WNetGetUniversalName Lib "mpr.dll" ( _
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
ByVal lpLocalPath As String, _
ByVal dwInfoLevel As INFO_LEVEL, _
ByVal lpBuffer As IntPtr, _
ByRef lpBufferSize As Integer _
) As Integer

Private Structure REMOTE_NAME_INFO
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpUniversalName As String
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpConnectionName As String
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpRemainingPath As String
End Structure

Private Enum INFO_LEVEL As Integer
UNIVERSAL_NAME_INFO_LEVEL = 1
REMOTE_NAME_INFO_LEVEL = 2
End Enum

Public Function GetUniversalName( _
ByVal Path As String, _
ByRef UniversalName As String, _
ByRef ConnectionName As String, _
ByRef RemainingPath As String) As Boolean
' When successful, returns TRUE with UniversalName,
' ConnectionName, and RemainingPath data. If not
' successful, it may be the drive is local and not mapped.
Dim buffer As Integer
Dim ptrbuffer As IntPtr
Dim status As Integer
Dim rni As REMOTE_NAME_INFO
Dim Success As Boolean
Dim SafteyCount As Integer = 0

UniversalName = ""
ConnectionName = ""
RemainingPath = ""
buffer = 1024

ptrbuffer = Marshal.AllocHGlobal(buffer)
status = WNetGetUniversalName( _
Path, INFO_LEVEL.REMOTE_NAME_INFO_LEVEL, _
ptrbuffer, buffer)

Do While True
Select Case status
Case NO_ERROR
rni = Marshal.PtrToStructure(ptrbuffer, GetType(REMOTE_NAME_INFO))
UniversalName = rni.lpUniversalName
ConnectionName = rni.lpConnectionName
RemainingPath = rni.lpRemainingPath
Success = True
Exit Do
Case ERROR_MORE_DATA
If SafteyCount > 3 Then
Success = False
Exit Do
End If
SafteyCount += 1
Marshal.FreeHGlobal(ptrbuffer)
ptrbuffer = Marshal.AllocHGlobal(buffer)
status = WNetGetUniversalName(Path, _
INFO_LEVEL.REMOTE_NAME_INFO_LEVEL, ptrbuffer, buffer)
Case Else
Success = False
Exit Do
End Select
Loop
Marshal.FreeHGlobal(ptrbuffer)
Return Success
End Function

Hope that helps

progload
GeneralRe: VB.NET , Grab networked drive name Pin
topski11-Sep-08 4:35
topski11-Sep-08 4:35 
QuestionVB6 TreeView: how to prevent expand all Pin
Pete Burgess23-Jan-06 3:28
Pete Burgess23-Jan-06 3:28 
AnswerRe: VB6 TreeView: how to prevent expand all Pin
Mekong River23-Jan-06 17:10
Mekong River23-Jan-06 17:10 
GeneralRe: VB6 TreeView: how to prevent expand all Pin
Pete Burgess25-Jan-06 23:19
Pete Burgess25-Jan-06 23:19 
GeneralRe: VB6 TreeView: how to prevent expand all Pin
Mekong River26-Jan-06 14:50
Mekong River26-Jan-06 14:50 
GeneralRe: VB6 TreeView: how to prevent expand all Pin
Pete Burgess1-Feb-06 0:06
Pete Burgess1-Feb-06 0:06 
GeneralRe: VB6 TreeView: how to prevent expand all Pin
Mekong River2-Feb-06 12:34
Mekong River2-Feb-06 12:34 
GeneralRe: VB6 TreeView: how to prevent expand all Pin
Pete Burgess3-Feb-06 2:42
Pete Burgess3-Feb-06 2:42 
AnswerRe: VB6 TreeView: how to prevent expand all Pin
Pete Burgess3-Feb-06 2:40
Pete Burgess3-Feb-06 2:40 
QuestionCall By Reference in C++ DLL from VB Pin
PremalathaP23-Jan-06 1:52
PremalathaP23-Jan-06 1:52 
AnswerRe: Call By Reference in C++ DLL from VB Pin
Dave Kreskowiak23-Jan-06 3:04
mveDave Kreskowiak23-Jan-06 3:04 
QuestionRe: Call By Reference in C++ DLL from VB Pin
PremalathaP23-Jan-06 17:03
PremalathaP23-Jan-06 17:03 
AnswerRe: Call By Reference in C++ DLL from VB Pin
Dave Kreskowiak23-Jan-06 17:47
mveDave Kreskowiak23-Jan-06 17:47 
GeneralRe: Call By Reference in C++ DLL from VB Pin
PremalathaP23-Jan-06 17:55
PremalathaP23-Jan-06 17:55 
QuestionAdd User Custom Control in the Datagridview Column Pin
HemaRawat23-Jan-06 1:49
HemaRawat23-Jan-06 1:49 
QuestionRe: Add User Custom Control in the Datagridview Column Pin
Simmy723-Apr-06 22:13
Simmy723-Apr-06 22:13 
QuestionMask control Pin
microuser_200023-Jan-06 1:31
microuser_200023-Jan-06 1:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.