From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing a folder on a windows machine using the netapi32.dll and the Call Library Function Node

I know this is a shockingly open question but can anyone provide an example of how to make this work?

 

I've been trying to wade through the help files and Google to build a working code snippet where I can specify a folder as a string and have windows share it but for the life of me I can't make any headway into getting it working.

 

Basically the app I'm writing needs to ensure a folder is shared, transfer a file across the network to the locally shared folder and then disable the share.

 

I've got the app generating the path structures OK and grabbing the file from the network share when I turn it on manually but getting the share turned on in the first place is just too much for my brain I fear.

 

I think this one is a step too far for me at my present stage of development into LabView programming 🙂

 

Thank you very much for any assistance you can give.

 

Cheers guys.

0 Kudos
Message 1 of 6
(2,507 Views)

Hi WhtKnight

 

Would you have administrator’s privileges in both computers?

 

Do you know which command that does this? Because if it is part of the windows dll library you should try to find a manual for the windows dll in order to find that command or function.

 

Could you attach your code or VI snippet to this forum? And also the functions of the dll that you are using in order to have them as a reference in case I am not able to run you code.

 

Regards

Esteban R.

0 Kudos
Message 2 of 6
(2,492 Views)

I believe the functions I'm trying to implement are NetShareAdd and NetShareDel. As for the admin rights, yes, I will have them for both systems 🙂

 

I've attached the two Sub VIs i'll be using with this new one...

 

The Spectrum Analyser Config VI tells the unit to create a new state file and save it to the folder specified.

The Path Conversion VI is used to pull the IP address of the machine the software is being run from and create a network path to the folder passed to it.

 

The main aim of these two Sub VIs was to take the working directory from the main app and allow the Specan to save the config file there. That was when i realised I needed the directory to be shared for the Specan to write into.

 

If I manually share the folder it works fine so If we can work out how to throw this Folder Sharing VI together I'd be stoked 🙂

 

Thanks for the help

 

Steve

Download All
0 Kudos
Message 3 of 6
(2,483 Views)

Can you keep the folder shared with an access password?

Or, if you have internet toolkit, try ftp.

 

George Zou
0 Kudos
Message 4 of 6
(2,480 Views)

Not really, this app will end up being run on various laptops on site which won't be configured for the test application...

 

I know it sounds stupid but I need it to be independent of the user so that all they have to do is run the app and it takes care of the configuration and all they get to see is the result 🙂

0 Kudos
Message 5 of 6
(2,473 Views)

You can hardcode the username/password in the code.

You user won't notice the difference.

 

George Zou
0 Kudos
Message 6 of 6
(2,463 Views)