Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Check if there is access to shared folder


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Apr 17, 2015 9:26 AM Last Post By: Remy Lebeau (Te...
Martin Masci

Posts: 29
Registered: 4/3/04
Check if there is access to shared folder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 16, 2015 3:30 PM
I have 2 computers: computer A and computer B.
From computer A I need know if my application (running on computer A) have access to folder on computer B.
For example: is "\\COMPUTER-B\myfolder\" is accessible from computer A?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Check if there is access to shared folder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 16, 2015 4:02 PM   in response to: Martin Masci in response to: Martin Masci
Martin wrote:

I have 2 computers: computer A and computer B.

From computer A I need know if my application (running on computer A)
have access to folder on computer B.

For example: is "\\COMPUTER-B\myfolder\" is accessible from computer
A?

The best way is to simply try to access it and check if it succeeds or fails.

What are you trying to solve by doing such a check?

--
Remy Lebeau (TeamB)
Martin Masci

Posts: 29
Registered: 4/3/04
Re: Check if there is access to shared folder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 17, 2015 5:38 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Martin wrote:

I have 2 computers: computer A and computer B.

From computer A I need know if my application (running on computer A)
have access to folder on computer B.

For example: is "\\COMPUTER-B\myfolder\" is accessible from computer
A?

The best way is to simply try to access it and check if it succeeds or fails.

What are you trying to solve by doing such a check?

--
Remy Lebeau (TeamB)

On computer A I need call SelectDirectory('Select folder', aComputerBShareFolder, Folder) but only if computer A may access to aComputerBShareFolder, in alternative I want see an error message.

Now, if I call SelectDirectory('Select folder', aComputerBShareFolder, Folder) and aComputerBShareFolder is not accessible a normal SelectDirectory is open (with all the folders) after a software freezer.

How can I avoid it without freezer?
Robert Triest

Posts: 687
Registered: 3/24/05
Re: Check if there is access to shared folder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 17, 2015 5:45 AM   in response to: Martin Masci in response to: Martin Masci
Can't you use function DirectoryExists from SysUtils?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Check if there is access to shared folder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 17, 2015 9:26 AM   in response to: Martin Masci in response to: Martin Masci
Martin wrote:

How can I avoid it without freezer?

While the dialog is busy intializing itself, there is nothing you can do.
So either move the dialog to a worker thread with its own message loop,
or else just wait it out.

Otherwise, you have to validate the network share before you call SelectDirectory().
Maybe with WNetGetConnection() (https://msdn.microsoft.com/en-us/library/windows/desktop/aa385453.aspx).
But any validation is likely to cause a delay if the network is down or
the remote PC is not running. That is just the nature of remote connections.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02