LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Setdir to my documents?

Hi all

 

I am trying to set the current directory to the users my documents.

How do i do this without know who the knowing who the user is?

 

The windows Enviroment Variable %HOMEPATH%.

I there a way i could implement this ?

 

Kind Regards

Shakeel

Help share your knowlegde
0 Kudos
Message 1 of 4
(3,354 Views)

try GetProjectDir and MakePathname 🙂

0 Kudos
Message 2 of 4
(3,344 Views)

Try this:

 

#include "shlobj.h"


    char    file[MAX_PATHNAME_LEN];


    SHGetFolderPath (NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, file);

 

You need to have SDK installed and add ShFolder.lib to your project.

Look into SDK documentation for a reference on the function and see this thread for some additional informations.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(3,328 Views)

Roberto,

 

the link you specified does not work for me... (probably I have a different page setting than you - Lithium bug?)

 

Here is the more general link without page information: http://forums.ni.com/t5/LabWindows-CVI/A-better-way-to-get-AppData-location/m-p/795070

0 Kudos
Message 4 of 4
(3,319 Views)