|
Hello everyone,
i wanted to know if there is any way to retrieve the default personal folders file path?
Regards,
Vijay.
God may not give us what we 'want', but he surely gives us what we 'need'.
|
|
|
|
|
|
Try using SHGetFolderLocation, SHGetFolderPath, SHGetSpecialFolderLocation, SHGetSpecialFolderPath with CSIDL_PERSONAL .
Regards,
Paresh.
|
|
|
|
|
well, i am sorry that i was not clear in asking what exactly i wanted. actually i am working on something that is related to Microsoft Outlook. All the outlook items are stored in a file called 'outlook' with '.pst' extension. That file is stored in a folder called 'Outlook' whose path is as shown below:
C:\Documents and Settings\UserName\Local Settings\Application Data\Microsoft\Outlook
and i want to access that path programatically. i wanted to know if there is any function that does that for me.
Regards,
Vijay.
God may not give us what we 'want', but he surely gives us what we 'need'.
|
|
|
|
|
Try using CSIDL_APPDATA with SHGetFolderPath . Refer this[^] for more information. I hope this will surve your purpose.
Regards,
Paresh.
|
|
|
|
|
I can see that no CSIDL value takes me to the outlook folder. i would like to know if there are any. else i may have to do something on my own to construct the path. Anyways, thanks for all the help.
Regards,
Vijay.
God may not give us what we 'want', but he surely gives us what we 'need'.
|
|
|
|
|
vijay7173 wrote: I can see that no CSIDL value takes me to the outlook folder.
Of course not, because it's application-specific.
vijay7173 wrote: i would like to know if there are any. else i may have to do something on my own to construct the path.
Use CSIDL_APPDATA to get you down to C:\Documents and Settings\UserName\Local Settings\Application Data, and then hard-code the rest.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Of course not, because it's application-specific.
sorry sir, i assumed the default Outlook folder to be one of the special folders and hence expected a built-in function for retriving the path to that folder. Thanks for the info.
DavidCrow wrote: Use CSIDL_APPDATA to get you down to C:\Documents and Settings\UserName\Local Settings\Application Data
No. The CSIDL_APPDATA will take us to C:\Documents and Settings\UserName\Application Data. Instead, I need to use CSIDL_LOCAL_APPDATA which will take me down to C:\Documents and Settings\UserName\Local Settings\Application Data.
DavidCrow wrote: and then hard-code the rest
yes, thats exactly what i have done now
And also, i used SHGetSpecialFolderPath() instead of SHGetFolderPath() . i dont know why, but SHGetFolderPath() did not work for me in a dialog based application though it worked fine in Console based application.
-- modified at 2:23 Wednesday 18th April, 2007
Regards,
Vijay.
God may not give us what we 'want', but he surely gives us what we 'need'.
|
|
|
|
|
vijay7173 wrote: And also, i used SHGetSpecialFolderPath() instead of SHGetFolderPath().
With Windows 2000, SHGetSpecialFolderPath() was superseded by ShGetFolderPath() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
BOOL SetupDiEnumDeviceInfo(HDEVINFO DeviceInfoSet,DWORD MemberIndex,
PSP_DEVINFO_DATA DeviceInfoData);
Is there any function to get "MemberIndex" straightway?
with regards
RYK
-- modified at 4:44 Tuesday 17th April, 2007
|
|
|
|
|
VC_RYK wrote: BOOL SetupDiEnumDeviceInfo(HDEVINFO DeviceInfoSet,DWORD MemberIndex,
PSP_DEVINFO_DATA DeviceInfoData);
Is there any function to get "MemberIndex" straightway?
MemberIndex is an input parameter - there's nothing to get. If you're asking if there is a way to get the number of items that the enumeration will return, the answer is no.
Judy
|
|
|
|
|
I have to make an older c++ project Vista Ready, and I run into some strange problems. When the code below is executed, I get a File search dialog with files which I cannot find in the Log directory with file explorer . When notepad is executed, it reports an error that it cannot find the selected file. I can see that the main program is writing to the Log files, because the size and date/time in the Serach dialog, but I cannot find the files with file explorer. The Log directory is in C:\Windows\Progam Files\SoftwareName. It works without problems on a Windows XP / 2000 system.
{
csPath.Format("..\\Log");
csPathAndFile.Format("%s", ShowFileSearchDialog(m_hWnd, m_pParentWnd, "Log files|;VltLog*.log||", csPath));
csExecute.Format("notepad %s", csPathAndFile);
WinExec(csExecute, SW_SHOW);
}
CString ShowFileSearchDialog(HWND hWindow, CWnd* pParent, char szFilters[], CString csInitDirectory)
{
CString csPath;
BOOL bOpen = TRUE;
CFileDialog* dlgFile;
OPENFILENAME ofnLocal;
dlgFile = new CFileDialog(bOpen, NULL, NULL, OFN_HIDEREADONLY, szFilters, pParent);
if (!csInitDirectory.IsEmpty())
dlgFile->m_pOFN->lpstrInitialDir = csInitDirectory.GetBuffer();
dlgFile->m_hWndOwner = hWindow;
if (dlgFile->DoModal() != IDOK)
return "";
ofnLocal = dlgFile->GetOFN();
csPath.Format("%s", ofnLocal.lpstrFile);
return (csPath.GetBuffer());
}
|
|
|
|
|
You need quotes around the filename being passed to notepad on the command line.
|
|
|
|
|
Don't you hate it when you're voted down for giving good advice? Anyway, I've given a balancing 5.
Steve
|
|
|
|
|
Quotes are not needed...
|
|
|
|
|
Here's a program I'll launch with WinExec (I put it in C:\):
#include "stdafx.h"
#include <iostream>
int main(int arvc, char* argv[])
{
using namespace std;
for (int i=0; i<arvc; ++i)
{
cout << "argv[" << i << "] = \"" << argv[i] << "\"" << endl;
}
return 0;
}
I use the following code to launch it:
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WinExec("cmd.exe /K C:\\Console.exe C:\\Path name with spaces", SW_SHOW);
WinExec("cmd.exe /K C:\\Console.exe \"C:\\Path name with spaces\"", SW_SHOW);
return 0;
}
Here's the output from the first WinExec call:
argv[0] = "C:\Console.exe"
argv[1] = "C:\Path"
argv[2] = "name"
argv[3] = "with"
argv[4] = "spaces"
And from the second:
argv[0] = "C:\Console.exe"
argv[1] = "C:\Path name with spaces"
It may not matter for notepad today but that could quite easily change as you're not following established parameter passing conventions. Michael's advice is sound.
Steve
|
|
|
|
|
Oké, you are right , it is a valid advice, but not a solution to my problem.
The problem is that the CFileDialog reports the path of the file as 'C:\program files\software', but because the file is in the Virtual store location, notepad cannot find the file. In my opinion both programs are run onder the same UAC, but probably not...
|
|
|
|
|
I never claimed it would solve all your problems – or even any of them – just that it was good advice.
Steve
|
|
|
|
|
Please check UAC for windows Vista.
Please refer this[^] for more information.
Regards,
Paresh.
|
|
|
|
|
I already thought it had to do with UAC, but why can I see the files from within my app, but when I run notepad from within app, it cannot find the files. There is only one user account create (administrator). If I start my program 'Run as Administrator', I see different files in the CFileDialog' box, and I can open them with notepad.
The files I was looking for are located in C:\Users\Username\AppData\Local\VirtualStore\Program Files, but why are they hidden for myself... The username is the same as I loged in with, but I cannot see the files...
Windows Vista has very strange behaviour...
|
|
|
|
|
Windows Vista has improved its security feature.
You can turn off the UAC by
"Control Panel | User Accounts | Turn User Account Control On or off".
Regards,
Paresh.
|
|
|
|
|
Oké, thank you very much ... That bypasses my problem for now... Still got some other UAC problems with restoring an MS-SQL database, but I'll first have look into that.
Thanks
|
|
|
|
|
Please check UAC for windows Vista.
Please refer this[^] for more information. Hope this would help you.
Regards,
Paresh.
|
|
|
|
|
Hi,
I want a tab in TabCtrl to be Grayed. Can anyone pls tell me how to do it?
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
Refer C++ Q & A[^] from MSJ , march 1998.
Prasad
MS MVP - VC++
|
|
|
|