all groups > dotnet compact framework > january 2008 >
You're in the

dotnet compact framework

group:

DirectoryInfo and Network Shares


DirectoryInfo and Network Shares Charles Teel
1/31/2008 9:31:07 AM
dotnet compact framework: I'm working on an app that will display a list of shared resources on
a PC connected to the TCP/IP network. I figured out how to get the
list of the shared folders and printers on a PC, but I can't figure
out how to differentiate between the two.

I'm using the DirectoryInfo.GetDirectories() method to get the list of
shared items (which returns the array of DirectoryInfo objects for the
shared items on the specified PC).

Any ideas?

Re: DirectoryInfo and Network Shares Charles Teel
1/31/2008 10:31:18 AM
On Jan 31, 11:53=A0am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
[quoted text, click to view]

Yes, this is a Compact Framework question, because the app is on a
Windows Mobile Device. Now, the PC that has the file and printer
shares is going to be a WinXP/Vista machine. But the code I'm writing
Re: DirectoryInfo and Network Shares Paul G. Tobey [eMVP]
1/31/2008 10:53:51 AM
Is this really a *Compact* Framework question? It sounds like you're
talking about desktop Windows. This group is about Windows CE/Windows
Mobile, *not* Windows XP/Windows Vista .NET...

Paul T.

[quoted text, click to view]

Re: DirectoryInfo and Network Shares Charles Teel
1/31/2008 11:43:57 AM
On Jan 31, 1:35=A0pm, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
[quoted text, click to view]


Re: DirectoryInfo and Network Shares Paul G. Tobey [eMVP]
1/31/2008 12:06:32 PM
OK. So you have a list of resources and the problem is to identify which
are printers and which are folders, yes? The underlying API for enumeration
of network resources is WNetEnumResource(). The structure returned by that
call includes a 'type' field which indicates either RESOURCETYPE_DISK or
RESOURCETYPE_PRINT. If the DirectoryInfo returns don't indicate a type, you
may have to P/Invoke directly to the WNet call to get the information. I'd
look at Attributes, but it's not clear whether that would tell you anything
or not.

Paul T.

[quoted text, click to view]

Yes, this is a Compact Framework question, because the app is on a
Windows Mobile Device. Now, the PC that has the file and printer
shares is going to be a WinXP/Vista machine. But the code I'm writing
is on the mobile device.

Re: DirectoryInfo and Network Shares Paul G. Tobey [eMVP]
1/31/2008 12:35:27 PM
At least on my CE5 device, DirectoryInfo doesn't indicate anything useful.
WNetEnumResources() gives the correct information for folders and printers.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
[quoted text, click to view]

Re: DirectoryInfo and Network Shares Paul G. Tobey [eMVP]
1/31/2008 12:39:07 PM
And, as usual, OpenNETCF has the enumeration calls for WNet in the Smart
Device Framework.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
[quoted text, click to view]

AddThis Social Bookmark Button