Page 1 of 1

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

Posted: Thu Jun 14, 2018 9:30 am
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.

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

Posted: Thu Jun 14, 2018 9:40 am
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

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

Posted: Wed Jun 20, 2018 6:42 am
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

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

Posted: Wed Jun 20, 2018 2:43 pm
by ONEEYEMAN
Hi,
What are you using to access that path? wxDirPicker? wxFileDialog? Or you are trying the hardcoded way?

Thank you.

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

Posted: Fri Jul 06, 2018 8:04 am
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.

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

Posted: Fri Jul 06, 2018 9:19 am
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".