tato
asked on
Problems w/WNetEnumResource
I have a prob. w/WNetEnumResource
anybody can help me, this example have a prob?
Dim f As Long, k As Long, n As NETRESOURCE
Dim g As NETRESOURCE
Dim lpcCount As Long, lpBufferSize As Long
f = WNetOpenEnum(RESOURCE_CONN ECTED, RESOURCETYPE_ANY, _
0, g, k)
lpBufferSize = Len(n)
If k Then f = WNetEnumResource(k, lpcCount, n, lpBufferSize)
If lpcCount Then
Debug.Print n.dwDisplayType
Debug.Print n.dwScope
Debug.Print n.dwType
Debug.Print n.dwUsage
Debug.Print n.lpComment
Debug.Print n.lpLocalName
Debug.Print n.lpProvider
Debug.Print n.lpRemoteName
else
Debug.Print f
End If
Debug.Print lpBuffer
If k Then f = WNetCloseEnum(k)
anybody can help me, this example have a prob?
Dim f As Long, k As Long, n As NETRESOURCE
Dim g As NETRESOURCE
Dim lpcCount As Long, lpBufferSize As Long
f = WNetOpenEnum(RESOURCE_CONN
0, g, k)
lpBufferSize = Len(n)
If k Then f = WNetEnumResource(k, lpcCount, n, lpBufferSize)
If lpcCount Then
Debug.Print n.dwDisplayType
Debug.Print n.dwScope
Debug.Print n.dwType
Debug.Print n.dwUsage
Debug.Print n.lpComment
Debug.Print n.lpLocalName
Debug.Print n.lpProvider
Debug.Print n.lpRemoteName
else
Debug.Print f
End If
Debug.Print lpBuffer
If k Then f = WNetCloseEnum(k)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear mdougan:
Your answer is good, but i need info to copy a pointer to string as long in string.
Declare Function lstrcpyn Lib "kernel32" Alias "lstrcpynA" (ByVal lpString1 As String, ByVal lpString2 As String, ByVal iMaxLength As Long) As Long
I try to use lstcpyn bu don have success.
Excuse my english bye
Your answer is good, but i need info to copy a pointer to string as long in string.
Declare Function lstrcpyn Lib "kernel32" Alias "lstrcpynA" (ByVal lpString1 As String, ByVal lpString2 As String, ByVal iMaxLength As Long) As Long
I try to use lstcpyn bu don have success.
Excuse my english bye
Hi,
Sorry, I tried to include all of the definitions with the routine, but I forgot these. These are the declarations of the API functions necessary to copy the long pointers into strings. The following snippet of code from the EnumContainers routine calls these two functions:
' -------------------------- -
' Get the strings from the
' string pointers
' -------------------------- -
p_lngLen = lstrlen(p_atypNetResAPI(p_ lngLoop).l pLocalName )
If p_lngLen > 0 Then
g_atypNetRes(g_NetResLastI ndex).sLoc alName = Space$(p_lngLen)
CopyMem ByVal g_atypNetRes(g_NetResLastI ndex).sLoc alName, _
ByVal p_atypNetResAPI(p_lngLoop) .lpLocalNa me, _
p_lngLen
End If
Public Declare Sub CopyMem _
Lib "kernel32" Alias "RtlMoveMemory" _
(pTo As Any, _
pFrom As Any, _
ByVal lCount As Long)
Public Declare Function lstrlen _
Lib "kernel32" Alias "lstrlenA" _
(ByVal sText As Any) As Long
Hope this helps
MD
Sorry, I tried to include all of the definitions with the routine, but I forgot these. These are the declarations of the API functions necessary to copy the long pointers into strings. The following snippet of code from the EnumContainers routine calls these two functions:
' --------------------------
' Get the strings from the
' string pointers
' --------------------------
p_lngLen = lstrlen(p_atypNetResAPI(p_
If p_lngLen > 0 Then
g_atypNetRes(g_NetResLastI
CopyMem ByVal g_atypNetRes(g_NetResLastI
ByVal p_atypNetResAPI(p_lngLoop)
p_lngLen
End If
Public Declare Sub CopyMem _
Lib "kernel32" Alias "RtlMoveMemory" _
(pTo As Any, _
pFrom As Any, _
ByVal lCount As Long)
Public Declare Function lstrlen _
Lib "kernel32" Alias "lstrlenA" _
(ByVal sText As Any) As Long
Hope this helps
MD
ASKER
thanks mdougan
Bought This Question.
ASKER