473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Shared folders.

Hello. How can I determine if a folder is shared? if it is shared, how can I
retrieve the resource shared name?

I have:
Folder name ==> C:\WORKS\DOCS
Resoure shared name ==> DOCUMENTS

With 'WNetOpenEnum()' and 'WNetEnumResource()' I can get '\\MYPC\DOCUMENTS'
but there is not relation with real name folder.

Thanks in advance,
William GS
Nov 17 '05 #1
5 1331
You can use SHGetFileInfo and look at the attributes in the SHFILEINFO
object. If SFGAO_SHARE is set then the file or folder or device is shared.

Tom

"William GS" <Wi*******@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
Hello. How can I determine if a folder is shared? if it is shared, how can
I
retrieve the resource shared name?

I have:
Folder name ==> C:\WORKS\DOCS
Resoure shared name ==> DOCUMENTS

With 'WNetOpenEnum()' and 'WNetEnumResource()' I can get
'\\MYPC\DOCUMENTS'
but there is not relation with real name folder.

Thanks in advance,
William GS

Nov 17 '05 #2
William,
Hello. How can I determine if a folder is shared? if it is shared, how can
I
retrieve the resource shared name?

I have:
Folder name ==> C:\WORKS\DOCS
Resoure shared name ==> DOCUMENTS

With 'WNetOpenEnum()' and 'WNetEnumResource()' I can get
'\\MYPC\DOCUMENTS'
but there is not relation with real name folder.


Having the shared name you can get the local folder path using
NetShareGetInfo(), but more useful in your case is WNetGetUniversalName(),
which can do the opposite. Here's an example of NetShareGetInfo(), btw:
http://win32.mvps.org/network/nsgi.cpp

--
Tomas Restrepo
to****@mvps.org
http://www.winterdom.com/
Nov 17 '05 #3
Hi Tomas, it works fine in Win2000/XP, but I need it in Win98/ME too.
'NetShareGetInfo()' in linked to 'netapi32.lib' in NT/XP and 'svrapi.lib' in
98/ME, 'NetApiBufferFree()' is linked to 'netapi32.lib'.

My app compiles fine in Win98, but it searches 'NetShareGetInfo()' in
netapi32.dll and my app does not run.

Please, some advice to solve this.
Thansk in advance.
William GS
"Tomas Restrepo (MVP)" wrote:
William,
Hello. How can I determine if a folder is shared? if it is shared, how can
I
retrieve the resource shared name?

I have:
Folder name ==> C:\WORKS\DOCS
Resoure shared name ==> DOCUMENTS

With 'WNetOpenEnum()' and 'WNetEnumResource()' I can get
'\\MYPC\DOCUMENTS'
but there is not relation with real name folder.


Having the shared name you can get the local folder path using
NetShareGetInfo(), but more useful in your case is WNetGetUniversalName(),
which can do the opposite. Here's an example of NetShareGetInfo(), btw:
http://win32.mvps.org/network/nsgi.cpp

--
Tomas Restrepo
to****@mvps.org
http://www.winterdom.com/

Nov 17 '05 #4
William,
Hi Tomas, it works fine in Win2000/XP, but I need it in Win98/ME too.
'NetShareGetInfo()' in linked to 'netapi32.lib' in NT/XP and 'svrapi.lib'
in
98/ME, 'NetApiBufferFree()' is linked to 'netapi32.lib'.

My app compiles fine in Win98, but it searches 'NetShareGetInfo()' in
netapi32.dll and my app does not run.


Check http://win32.mvps.org/network/net_win9x.html
and
http://msdn.microsoft.com/library/de..._95_98_me_.asp
--
Tomas Restrepo
to****@mvps.org
http://www.winterdom.com/
Nov 17 '05 #5
Thank you so much :-)

William GS
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Glenn Venzke | last post by:
I have several folders on a test web server that are not visible in the directory structures of several programs, including Visual Interdev and Stac ReachOut. All these folders have one thing in...
5
by: Dan Lorenz | last post by:
When trying to use the function CreateDirectory on my local machine everything works fine but when I upload the page to my webhost I get an issue that it can't find path on D:\, though D:\ is what...
0
by: Dennis | last post by:
I have tried to use the IWshRuntimeLibrary and ManagementObjectSearcher("SELECT * FROM Win32_LogicalDisk") to get all Logical Drives, Mapped Network Drives, Shared Folders and Shared Drives with...
1
by: nuggies | last post by:
I'm developing an ASP.NET 2.0 (C#) application in which I need to display the available shared folders on the server. The shared folder paths need to be in UNC format (i.e., \\servername\share)...
3
by: sva | last post by:
Using C# for an application in which I am working on, I need to display the available shared folders on the computer that's running the application. The shared folder paths need to be in UNC format...
1
by: lecnac | last post by:
Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group The...
1
by: lecnac | last post by:
Sorry for the repost. I must have done something wrong when I tried to post my reply (I can't seem to find it). Anyway, I'd really appreciate any help that anyone could provide. My issue is...
0
by: NoWhereMan | last post by:
Hello, I'm trying to get the list of shared folders of a network computer and add them to a combo box. I'm using the bellow code in VB .NET. Code ==== Private Sub EnumShares(ByVal Machine As...
2
by: Daniel Knöpfel | last post by:
Hi In my application i need to do the following things concerning shared folders: - check if a folder is shared - share a folder - unshare a folder It seems to me that .net does not...
14
by: Betray | last post by:
We have a AD running on win2k3. We have many shared folders. Ive noticed that once in a while users will call up and report the folders missing. To fix the issue i would reboot the system. And vola...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.