Mega Search
23.2 Million


Sign Up

Make a donation  
Opening a network file  
News Group: borland.public.cppbuilder.language.cpp

I mapped a drive on a remote computer to a drive letter.

When I start my C++ program, it cannot access the drive (with
findfirst()).
I open the Windows Explorer and I click on the network drive. This
solves the problem until the computer is rebooted.

Is there a permanent solution?
-- 
José

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 7-Jan-2008, at 2:14 PM EST
From: José
 
Re: Opening a network file  
News Group: borland.public.cppbuilder.language.cpp
On Mon, 7 Jan 2008 16:16:55 -0500, "dhoke"
 wrote in
borland.public.cppbuilder.language.cpp:

>Then you may wish to try adding an arbitrary WNetCancelConnectionQQQ(), 
>maybe ignoring any errors, and hope for the best...
>
>Or take a look at the WNetOpenEnum, WNetEnumResource(), etc. - you may be 
>able to tell whether your connection is already there and accessible or not. 
>(Sorry to not be more helpful, but its been a long time, since I messed with 
>any of these, and I no longer have access to the code where I did.)

Even if it works for me, I feel that this is not the right way. The
call I tried was:

WNetAddConnection("\\\\meriadoc\\Folder",NULL,"X:");

And this has a parameter too many. How is my program to know that the
Explorer mapped X: to \\Meriadoc\Folder? The answer is easy: there is
no need for my program to know it, since the Explorer takes care of
it. It should be sufficient to call something like:

ActivateNetworkConnection ("X:");
-- 
José

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 8-Jan-2008, at 8:45 AM EST
From: José
 
Re: Opening a network file  
News Group: borland.public.cppbuilder.language.cpp
Then you may wish to try adding an arbitrary WNetCancelConnectionQQQ(), 
maybe ignoring any errors, and hope for the best...

Or take a look at the WNetOpenEnum, WNetEnumResource(), etc. - you may be 
able to tell whether your connection is already there and accessible or not. 
(Sorry to not be more helpful, but its been a long time, since I messed with 
any of these, and I no longer have access to the code where I did.)

"José"  wrote in message 
news:9rg4o3ddbq3sm62tssm92o1107hamo9i8h@4ax.com...
> On Mon, 7 Jan 2008 09:02:50 -0500, "dhoke"
>  wrote in
> borland.public.cppbuilder.language.cpp:
>
>>You can probably use one of the WNetAddConnection() (maybe
>>WNetAddConnection3()) routines to make sure you always have a valid, 
>>active,
>>connection to use.
>
> The former says that is is obsolete, but it appears simpler. I tried
>
> WNetAddConnection("\\\\meriadoc\\Folder",NULL,"X:");
>
> This succeeded at first, but it fails when the connection already
> happens to exist. Furthermore it is a bit of nonsense to call the
> function with these parameters, since the Explorer has already mapped
> X: to \\Meriadoc\Folder.
>
> Another problem is that I must reboot to test it again.
> -- 
> José 



Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 7-Jan-2008, at 4:16 PM EST
From: dhoke
 
Re: Opening a network file  
News Group: borland.public.cppbuilder.language.cpp
On Mon, 7 Jan 2008 09:02:50 -0500, "dhoke"
 wrote in
borland.public.cppbuilder.language.cpp:

>You can probably use one of the WNetAddConnection() (maybe 
>WNetAddConnection3()) routines to make sure you always have a valid, active, 
>connection to use.

The former says that is is obsolete, but it appears simpler. I tried

WNetAddConnection("\\\\meriadoc\\Folder",NULL,"X:");

This succeeded at first, but it fails when the connection already
happens to exist. Furthermore it is a bit of nonsense to call the
function with these parameters, since the Explorer has already mapped
X: to \\Meriadoc\Folder.

Another problem is that I must reboot to test it again.
-- 
José

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 7-Jan-2008, at 4:25 PM EST
From: José
 
Re: Opening a network file  
News Group: borland.public.cppbuilder.language.cpp
Hi Jos 
 
 Jos says:
> I mapped a drive on a remote computer to a drive letter.
> 
> When I start my C++ program, it cannot access the drive (with
> findfirst()).
> I open the Windows Explorer and I click on the network drive. This
> solves the problem until the computer is rebooted.

Try and download this program to see if that can get acces to
Your mapped remote drives.
http://asger-p.dk/Checker.rar
(just unpack to a folder and run) 

If that program can acces Your drives, I can show You 
how I have done. (the program uses Pidls)

Kind regards
Asger

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 7-Jan-2008, at 3:18 PM EST
From: Asger Joergensen
 
Re: Opening a network file  
News Group: borland.public.cppbuilder.language.cpp
You can probably use one of the WNetAddConnection() (maybe 
WNetAddConnection3()) routines to make sure you always have a valid, active, 
connection to use.  (It's been a while since I've played with mapped drives, 
but think that should work - of course your program has to cache any needed 
credentials, or present dialogs to obtain them if you don't.

If any further questions about that, should probably be directed to the 
..nativeapi group.

"José"  wrote in message 
news:n794o39dj9ajr7rqcpbn06o7eh53i67msm@4ax.com...
>I mapped a drive on a remote computer to a drive letter.
>
> When I start my C++ program, it cannot access the drive (with
> findfirst()).
> I open the Windows Explorer and I click on the network drive. This
> solves the problem until the computer is rebooted.
>
> Is there a permanent solution?
> -- 
> José 



Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 7-Jan-2008, at 9:02 AM EST
From: dhoke