04-21-2011 03:51 AM
I'm still fighting with folders in deployment tool and what is available in runtime in TS.
I couldn't create c:\subfolder using deployment tool and destination personal directory. personal directory refers always to user's my documents and destination subfolder path in deployment tool is treated as <user>\my documents\c\subfolder. Can I somehow define destination subfolder c:\ in deployment tool ? (for some reason TS2010 deployment tool removes : from e.g. path c:\ )
I succeeded to deploy the installation using personal directory as mentioned above. How I can get the path to user's my documents in my sequence file in runtime ? I searched around and couldn't find any direct TS API call to get that path information. I can program CVI DLL in worst case, but I couldn't find any direct support in CVI either. Is the last way to get this information from Windows SDK ?
TS API supports to get path for TS public document directory. This can be easily changed to windows public document path with some string manipulation. Proposal to NI would be to add in deployment tool destination option to windows public document folder.
Best Regards,
Petri
04-21-2011 09:44 AM
Not sure if that helps, but it is relatively easy to get environment variables into TestStand by doing a call to
DWORD GetEnvironmentVariable(
LPCTSTR lpName, // address of environment variable name
LPTSTR lpBuffer, // address of buffer for variable value
DWORD nSize // size of buffer, in characters
);
in kernel32.dll (actually you have to use GetEnvironmentVariableA for the ASCII version, GetEnvironmentVariableW for the Unicode version).
Here http://en.wikipedia.org/wiki/Environment_variable#Default_Values_on_Microsoft_Windows is a list of the environment variables used in XP and Vista/7. Something like %PUBLIC%, %HOMEPATH% or so could give you the starting point for the path you need.
Regards
Peter
DWORD GetEnvironmentVariable(
LPCTSTR lpName, // address of environment variable name
LPTSTR lpBuffer, // address of buffer for variable value
DWORD nSize // size of buffer, in characters
);
04-21-2011 10:05 AM
Microsoft has a function you can use to get the mydocuments file path:
http://msdn.microsoft.com/en-us/library/bb762181%28v=vs.85%29.aspx
Use it with the CSIDL_PERSONAL constant.
Hope this helps,
-Doug
05-09-2011 03:33 AM
Thanks for support. I programmed a function in to my DLL. More elegant solution would have been call Windows DLL directly from TS, but I couldn't succeed with that.
Below function source code if someone face same challenge with deployment tool destination restriction and/or resolving my documents path in runtime as I did.
#include <ShlObj.h>
/*****************************************************************************/
/* Function: CVIGetWindowsMyDocumentsPath */
/* Purpose: This function returns windows my documents path */
/*****************************************************************************/
HRESULT __declspec(dllexport) CVIGetWindowsMyDocumentsPath(char WindowsMyDocumentsPath[])
{
HRESULT status;
status = SHGetFolderPathA(NULL,CSIDL_PERSONAL,NULL,SHGFP_TYPE_CURRENT,WindowsMyDocumentsPath);
return status;
}
Regards,
Petri