[wxMSW][wx3.0.2]Getting network path of directory

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Rudra
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 224
Joined: Fri Sep 13, 2013 2:59 pm

[wxMSW][wx3.0.2]Getting network path of directory

Post by Rudra »

Hi,

In my wx application, I browse for directory where user selects the directory which may be shared. I path to convert the selected path to network path,
(e.g E:\Shared\Doc to \\RUDRESH\Shared\Doc) if it is shared.

I couldn't figure to do so. Please suggest.

Thnaks,
R.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: [wxMSW][wx3.0.2]Getting network path of directory

Post by doublemax »

I assume you mean the situation when a remote share is mapped to a local drive letter? And then you want to find the "real" network path?

I don't think there is any wxWidgets function for this.

This Windows function looks promising, but i haven't tried it:
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
Use the source, Luke!
Rudra
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 224
Joined: Fri Sep 13, 2013 2:59 pm

Re: [wxMSW][wx3.0.2]Getting network path of directory

Post by Rudra »

Thanks for the reply.

If I shared a folder (i.e E:\\Shared) on my machine, I can access it as "\\RUDRESH\Shared" or "\\192.168.43.46\Shared" on same machine or from other machine on LAN. By network path I meant "\\RUDRESH\Shared" or "\\192.168.43.46\Shared".

When user selects "E:\\Shared" through browse of directory, I want to make it as "\\RUDRESH\Shared".

I tried the function you said but I always get ERROR_NOT_CONNECTED. It description says - "The device specified by the lpLocalPath parameter is not redirected." Not sure how to fix this. I can access that path from other machine.

Thanks,
R
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [wxMSW][wx3.0.2]Getting network path of directory

Post by ONEEYEMAN »

Hi,
What are you using to access that path? wxDirPicker? wxFileDialog? Or you are trying the hardcoded way?

Thank you.
Rudra
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 224
Joined: Fri Sep 13, 2013 2:59 pm

Re: [wxMSW][wx3.0.2]Getting network path of directory

Post by Rudra »

ONEEYEMAN wrote: What are you using to access that path? wxDirPicker? wxFileDialog? Or you are trying the hardcoded way?
Once the user selects the path (i. e E:\\Shared) through wxDirPickerCtrl. I use hardcoded way assuming it is shared. That's what I what to do through code. I want a function which gives me path like "\\RUDRESH\Shared" when "E:\\Shared" is passed if it is shared with in LAN.

Thank you
R.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: [wxMSW][wx3.0.2]Getting network path of directory

Post by doublemax »

I tested the code from the link i posted and it worked fine for me.

I have a remote PC named "W7X64" with a share "xx".
I map the share to the drive letter Y
I call the function with the path "Y:\" and it returns "\\W7X64\xx" as "Universal name".
Use the source, Luke!
Post Reply