Shared documents folder on VISTA

Hello,

I have applications which use system variables, e.g. CSIDL_COMMON_DOCUMENTS 
for "C:\Documents and Settings\All Users\Documents". How can I transfer 
these for running on VISTA?

Thanks.

-- 
John
0
John
8/25/2008 9:01:11 AM
embarcadero.delphi.nativeapi 1236 articles. 1 followers. Follow

29 Replies
941 Views

Similar Articles

[PageSpeed] 55
Get it on Google Play
Get it on Apple App Store

John Schmidt wrote:
> I have applications which use system variables, e.g.
> CSIDL_COMMON_DOCUMENTS for "C:\Documents and Settings\All
> Users\Documents". How can I transfer these for running on VISTA?

John,

Just continue to use CSIDL_..... Vista supports these constants for 
backward compatibility.

Not sure, but I think CSIDL_COMMON_DOCUMENTS translates to
C:\users\public\documents on Vista. (I don't have Vista accessible 
right now)

Regards
Tom
0
Tom
8/25/2008 9:49:14 AM
John Schmidt wrote:
> I have applications which use system variables, e.g.
> CSIDL_COMMON_DOCUMENTS for "C:\Documents and Settings\All
> Users\Documents". How can I transfer these for running on VISTA?

John,
 Forgot to say: this link provides additional info:
http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx

Regards
Tom
0
Tom
8/25/2008 9:50:52 AM
> Not sure, but I think CSIDL_COMMON_DOCUMENTS translates to
> C:\users\public\documents on Vista. (I don't have Vista accessible
> right now)

Thanks Tom, I have found the document. As there is no word about the new 
physical path I'm very glad about your suggestion. I still don't use Vista 
for it's bugs, so I don't know anything about the new paths. Same time I 
need to make my applications Vista-enabled for clients who have Vista.

Regards,

-- 
John
0
John
8/25/2008 10:59:56 AM
> {quote:title=Tom Brunberg wrote:}{quote}
> John Schmidt wrote:
> > I have applications which use system variables, e.g.
> > CSIDL_COMMON_DOCUMENTS for "C:\Documents and Settings\All
> > Users\Documents". How can I transfer these for running on VISTA?
> 
> John,
>  Forgot to say: this link provides additional info:
> http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx
> 

There are a few pitfalls with regards to these (diiference in behaviour between XP, Server 2003 and Vista).
[http://lists.runrev.com/pipermail/use-revolution/2007-February/094217.html|http://lists.runrev.com/pipermail/use-revolution/2007-February/094217.html]
which also points to: http://msdn.microsoft.com/en-us/library/ms995853.aspx

--
http://Lars.Fosdal.com - There are no stupid questions
0
Lars
8/25/2008 12:26:22 PM
"Tom Brunberg" <nospam@to.me> wrote in message 
news:6311@forums.codegear.com...

> Just continue to use CSIDL_..... Vista supports these constants
> for backward compatibility.

Only to an extent, since CSIDL is deprecated in Vista.  Vista uses 
KNOWNFOLDERID now, complete with a new set of API functions for working with 
KNOWNFOLDERID values.  Not all CSIDLs have a 1-to-1 KNOWNFOLDERID 
equivilent.


Gambit
0
Remy
8/25/2008 6:25:24 PM
Remy Lebeau (TeamB) wrote:
> "Tom Brunberg" <nospam@to.me> wrote in message
> news:6311@forums.codegear.com...
>
>> Just continue to use CSIDL_..... Vista supports these constants
>> for backward compatibility.
>
> Only to an extent, since CSIDL is deprecated in Vista.  Vista uses
> KNOWNFOLDERID now, complete with a new set of API functions for
> working with KNOWNFOLDERID values.  Not all CSIDLs have a 1-to-1
> KNOWNFOLDERID equivilent.

So, in the context of the OP, what is your recommendation?

In addition to the pitfalls that Lars pointed out in this same thread, 
are there other matters to consider?

I'm still using D2005, so a few practical questions:
From which version of Delphi is the known folder system available?
Will an application, that is developed with that Delphi version and 
using the known folder system, be compatible with WinXP, Win2003 and 
Win2k?

Regards
Tom
0
Tom
8/25/2008 10:28:55 PM
Lars Fosdal wrote:

> There are a few pitfalls with regards to these (diiference in
> behaviour between XP, Server 2003 and Vista).
> [http://lists.runrev.com/pipermail/use-revolution/2007-February/094217.html|http://lists.runrev.com/pipermail/use-revolution/2007-February/094217.html]
> which also points to:
> http://msdn.microsoft.com/en-us/library/ms995853.aspx

Lars,

Thank you for filling up with this info.

Regards
Tom
0
Tom
8/25/2008 10:30:27 PM
"Tom Brunberg" <nospam@to.me> wrote in message 
news:6627@forums.codegear.com...

> So, in the context of the OP, what is your recommendation?

    KNOWNFOLDERID
    http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx

    FOLDERID_PublicDocuments
    GUID: {ED4824AF-DCE4-45A8-81E2-FC7965083634}
    Display Name: Public Documents
    Folder Type: COMMON
    Default Path: %PUBLIC%\Documents
    CSIDL Equivalent: CSIDL_COMMON_DOCUMENTS
    Legacy Display Name: Shared Documents
    Legacy Default Path: %ALLUSERSPROFILE%\Documents

> From which version of Delphi is the known folder system available?

None.  You will have to declare the types and link to the new API functions 
manually.


Gambit
0
Remy
8/25/2008 11:05:01 PM
Remy Lebeau (TeamB) wrote:
> "Tom Brunberg" <nospam@to.me> wrote in message
> news:6627@forums.codegear.com...
>
>> So, in the context of the OP, what is your recommendation?
>
>    KNOWNFOLDERID
>    http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx
>
>    FOLDERID_PublicDocuments
>    GUID: {ED4824AF-DCE4-45A8-81E2-FC7965083634}
>    Display Name: Public Documents
>    Folder Type: COMMON
>    Default Path: %PUBLIC%\Documents
>    CSIDL Equivalent: CSIDL_COMMON_DOCUMENTS
>    Legacy Display Name: Shared Documents
>    Legacy Default Path: %ALLUSERSPROFILE%\Documents
>
>> From which version of Delphi is the known folder system available?
>
> None.  You will have to declare the types and link to the new API
> functions manually.
>

My third question fell out of scope since the answer to the second was 
"none"
So, let me refrace it:
Will this solution run on anything before Vista?

Tom
0
Tom
8/25/2008 11:55:29 PM
"Tom Brunberg" <nospam@to.me> wrote in message 
news:6658@forums.codegear.com...

> Will this solution run on anything before Vista?

No. KNOWNFOLDERID, and the corresponding APIs, are new to Vista.


Gambit
0
Remy
8/26/2008 12:18:41 AM
Remy Lebeau (TeamB) wrote:
> "Tom Brunberg" <nospam@to.me> wrote in message
> news:6658@forums.codegear.com...
> 
>> Will this solution run on anything before Vista?
> 
> No. KNOWNFOLDERID, and the corresponding APIs, are new to Vista.
> 

Thank you Gambit, for the info.
I guess I'm stuck with the CSIDLs then, as so many others.

Regards
Tom
0
Tom
8/26/2008 12:51:46 AM
You could query for the OS version and have a set of calls for XP and 
earlier and another set for Vista.

-- 

-----Jon-----


"Tom Brunberg" <nospam@to.me> wrote in message 
news:6676@forums.codegear.com...
> Remy Lebeau (TeamB) wrote:
>> "Tom Brunberg" <nospam@to.me> wrote in message
>> news:6658@forums.codegear.com...
>>
>>> Will this solution run on anything before Vista?
>>
>> No. KNOWNFOLDERID, and the corresponding APIs, are new to Vista.
>>
>
> Thank you Gambit, for the info.
> I guess I'm stuck with the CSIDLs then, as so many others.
>
> Regards
> Tom
>
0
Jon
8/26/2008 2:47:29 AM
Jon Springs wrote:
> You could query for the OS version and have a set of calls for XP 
> and
> earlier and another set for Vista.

Jon,

And what would be the benefit from doing that?

Well, in article
http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx
it is stated:
----
CSIDL
Note  In Windows Vista, these values have been replaced by 
KNOWNFOLDERID values. See that topic for a list of the new constants 
and their corresponding CSIDL values. For convenience, corresponding 
KNOWNFOLDERID values are also noted here for each CSIDL value.
The CSIDL system is supported under Windows Vista for compatibility 
reasons. However, new development should use KNOWNFOLDERID values 
rather than CSIDL values.
----
Looking through the list all CSIDL values have a corresponding 
KNOWNFOLDERID value.


The relevant articles on msdn for
SHGetFolderLocation Function and
SHGetFolderPath Function
states:
----
Note  As of Windows Vista, this function is merely a wrapper for 
SHGetKnownFolderPath. The CSIDL value is translated to its associated 
KNOWNFOLDERID and then SHGetKnownFolderPath is called. New 
applications should use the known folder system rather than the older 
CSIDL system, which is supported only for backward compatibility.
----


So, if the application should run on both XP and Vista, there's no 
point in checking the OS and provide different calls because
- The CSIDL system is supported on both
- On Vista the OS translates the CSIDL call to a KNOWNFOLDERID call so 
the effect is the same as you would be using different calls.


The article that Lars pointed out in another branch of this thread was 
not actually about using the CSIDL system on a Vista machine, but 
rather which CSIDL to use to be able to read/store files on a Server 
2003. To use a special KNOWNFOLDERID call (on Vista) would not have 
solved the problem mentioned.
In fact, after changing the wrong CSIDL (CSIDL_COMMON_APPDATA) to the 
correct one (CSIDL_COMMON_DOCUMENTS) for the purpose they used it, 
they say "I tested it on 2000, XP and VISTA and our install worked 
excellent." Unfortunately then, this did not work on Server 2003.


Regards
Tom
0
Tom
8/26/2008 7:02:05 AM
You could retain your current code and expect it to continue working while 
also adjusting to the new methodology of Vista.

-- 

-----Jon-----


"Tom Brunberg" <nospam@to.me> wrote in message 
news:6726@forums.codegear.com...
> Jon Springs wrote:
>> You could query for the OS version and have a set of calls for XP
>> and
>> earlier and another set for Vista.
>
> Jon,
>
> And what would be the benefit from doing that?
>
> Well, in article
> http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx
> it is stated:
> ----
> CSIDL
> Note  In Windows Vista, these values have been replaced by
> KNOWNFOLDERID values. See that topic for a list of the new constants
> and their corresponding CSIDL values. For convenience, corresponding
> KNOWNFOLDERID values are also noted here for each CSIDL value.
> The CSIDL system is supported under Windows Vista for compatibility
> reasons. However, new development should use KNOWNFOLDERID values
> rather than CSIDL values.
> ----
> Looking through the list all CSIDL values have a corresponding
> KNOWNFOLDERID value.
>
>
> The relevant articles on msdn for
> SHGetFolderLocation Function and
> SHGetFolderPath Function
> states:
> ----
> Note  As of Windows Vista, this function is merely a wrapper for
> SHGetKnownFolderPath. The CSIDL value is translated to its associated
> KNOWNFOLDERID and then SHGetKnownFolderPath is called. New
> applications should use the known folder system rather than the older
> CSIDL system, which is supported only for backward compatibility.
> ----
>
>
> So, if the application should run on both XP and Vista, there's no
> point in checking the OS and provide different calls because
> - The CSIDL system is supported on both
> - On Vista the OS translates the CSIDL call to a KNOWNFOLDERID call so
> the effect is the same as you would be using different calls.
>
>
> The article that Lars pointed out in another branch of this thread was
> not actually about using the CSIDL system on a Vista machine, but
> rather which CSIDL to use to be able to read/store files on a Server
> 2003. To use a special KNOWNFOLDERID call (on Vista) would not have
> solved the problem mentioned.
> In fact, after changing the wrong CSIDL (CSIDL_COMMON_APPDATA) to the
> correct one (CSIDL_COMMON_DOCUMENTS) for the purpose they used it,
> they say "I tested it on 2000, XP and VISTA and our install worked
> excellent." Unfortunately then, this did not work on Server 2003.
>
>
> Regards
> Tom
0
Jon
8/26/2008 3:59:21 PM
Jon Springs wrote:
> You could retain your current code and expect it to continue working
> while also adjusting to the new methodology of Vista.

Yes, I can agree with that, in a time frame of a few years.
The utmost concern for my clients and me, is anyway compatibility over 
2-3 latest OS generations.

Best regards
Tom
0
Tom
8/26/2008 4:43:37 PM
"Jon Springs" <jspringsATjontandsheDOTorg> wrote in message 
news:6693@forums.codegear.com...

> You could query for the OS version and have a set of
> calls for XP and earlier and another set for Vista.

It is generally not a good idea to rely on version numbers like that.  It is 
better to dynamically load the desired functions at runtime instead.  They 
will either exist or they won't, and you can act accordingly.  This also 
allows you the oppurtunity to write compatibility DLLs if you want to 
manually expose newer API functions in older OS versions, for instance.


Gambit
0
Remy
8/26/2008 5:56:31 PM
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:6955@forums.codegear.com...
> "Jon Springs" <jspringsATjontandsheDOTorg> wrote in message 
> news:6693@forums.codegear.com...
>
>> You could query for the OS version and have a set of
>> calls for XP and earlier and another set for Vista.
>
> It is generally not a good idea to rely on version numbers like that.

> Gambit

Why would you say that is?

-----Jon-----
0
Jon
8/26/2008 6:10:34 PM
"Jon Springs" <jsprings@jontandshe.org> wrote in message 
news:6964@forums.codegear.com...

> Why would you say that is?

Because:

1) It is not necessary to do that, as dynamic loading accomplishes the same 
goal in a more reliable and stable manner

2) Microsoft says not to do it anyway:

    GetVersionEx Function
    http://msdn.microsoft.com/en-us/library/ms724451(VS.85).aspx

    "Identifying the current operating system is usually not the best way to 
determine whether a particular operating system feature is present. This is 
because the operating system may have had new features added in a 
redistributable DLL. Rather than using GetVersionEx to determine the 
operating system platform or version number, test for the presence of the 
feature itself. For more information, see Operating System Version 
(http://msdn.microsoft.com/en-us/library/ms724832(VS.85).aspx)."


Gambig
0
Remy
8/26/2008 6:56:52 PM
Oh, seems a bit odd to me.

> Gambig
? ;-)

-- 

-----Jon-----
0
Jon
8/26/2008 9:00:24 PM
"Jon Springs" <jsprings@jontandshe.org> wrote in message 
news:7044@forums.codegear.com...

> Oh, seems a bit odd to me.

What is odd about it?  If you want to use a particular function, why should 
you care what specific version(s) have it?  You can test whether the actual 
function exists or not, without caring what the particular OS version is, 
and then act accordingly.  That is the correct way to handle it.


Gambit
0
Remy
8/27/2008 7:13:49 PM
Then why go to the trouble of providing version number functions?

-- 

-----Jon-----


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:7486@forums.codegear.com...
> "Jon Springs" <jsprings@jontandshe.org> wrote in message 
> news:7044@forums.codegear.com...
>
>> Oh, seems a bit odd to me.
>
> What is odd about it?  If you want to use a particular function, why 
> should you care what specific version(s) have it?  You can test whether 
> the actual function exists or not, without caring what the particular OS 
> version is, and then act accordingly.  That is the correct way to handle 
> it.
>
>
> Gambit
>
0
Jon
8/28/2008 1:46:47 AM
> What is odd about it?  If you want to use a particular function, why 
> should you care what specific version(s) have it?  You can test whether 
> the actual function exists or not, without caring what the particular OS 
> version is, and then act accordingly.  That is the correct way to handle 
> it.

Hi Gambit,

But how to handle style params like in the CreateParams, e.g.:

  if WinXPOrHigher then
    Params.WindowClass.Style := Params.WindowClass.Style or CS_DROPSHADOW;

How can I check for there existence?

Regards,
John
0
John
8/28/2008 9:20:03 AM
"Jon Springs" <jspringsATjontandsheDOTorg> wrote in message 
news:7634@forums.codegear.com...

> Then why go to the trouble of providing version number functions?

So you can report version numbers to the user, log files, etc.  The code 
shouldn't act on them, though.


Gambit
0
Remy
8/28/2008 11:40:55 PM
"John Schmidt" <schmidtjohn@yahoo.com> wrote in message 
news:7765@forums.codegear.com...

> But how to handle style params like in the CreateParams, e.g.:
>
>  if WinXPOrHigher then
>    Params.WindowClass.Style := Params.WindowClass.Style or CS_DROPSHADOW;
>
> How can I check for there existence?

That is a completely different issue.  We're talking about detecting the 
presense of API functions at runtime, not the availability of window styles. 
You can't query those dynamically like you can with functions.  So checking 
version numbers is the only way to do that.


Gambit
0
Remy
8/28/2008 11:46:04 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> "Jon Springs" <jspringsATjontandsheDOTorg> wrote in message 
> news:6693@forums.codegear.com...
> 
> > You could query for the OS version and have a set of
> > calls for XP and earlier and another set for Vista.
> 
> It is generally not a good idea to rely on version numbers like that.  It is 
> better to dynamically load the desired functions at runtime instead.  They 
> will either exist or they won't, and you can act accordingly.  This also 
> allows you the oppurtunity to write compatibility DLLs if you want to 
> manually expose newer API functions in older OS versions, for instance.
> 
> 
> Gambit

As a newbie to this stuff, I would very much appreciate a code snippet on how to do this the right way (function GetSharedDucomentsFolder: string).


Thanks in advance

Steen
0
Steen
9/26/2008 8:01:08 AM
Steen Albrechtsen wrote:
[]
> As a newbie to this stuff, I would very much appreciate a code
> snippet on how to do this the right way (function
> GetSharedDucomentsFolder: string).
>
>
> Thanks in advance
>
> Steen


Steen,

It might be something like this - adjust to suit your own requirements by 
changing CSIDL_PERSONAL:

uses
  ShlObj;

var
  PIDL: PItemIDList;
  MyDocumentsDirectory: array [0..MAX_PATH] of char;

begin
  SHGetSpecialFolderLocation (0, CSIDL_PERSONAL, PIDL);
  SHGetPathFromIDList (PIDL, MyDocumentsDirectory);
end;

Cheers,
David
0
David
9/26/2008 8:53:07 AM
David,

Thank you, I am sure your code will work in far the most cases.

Perhaps I was not clear enough, but I was thinking of a code example doing:

a) Check if OS supports KNOWNFOLDERID values as suggested by Gambit by checking if the function exists.
b) If yes then use KNOWNFOLDERID method else use CSIDL method.



Well, what I excatly need is the CSIDL_COMMON_APPDATA (or KNOWNFOLDERID equivivalent) and then create a subfolder to that.

In XP typically: C:\Documents and Settings\All Users\Application Data\MyFolder



A bit off topic I have a few additional questions (hope they make sence):

1) Any write access problems under Vista here?
2) Can I set that any user should have write access to MyFolder when I create it?
3) Will a Windows service have write acces to the MyFolder?

Steen
0
Steen
9/26/2008 12:38:03 PM
<Steen Albrechtsen> wrote in message news:21515@forums.codegear.com...

> Perhaps I was not clear enough, but I was thinking of a code example 
> doing:
>
> a) Check if OS supports KNOWNFOLDERID values as suggested
> by Gambit by checking if the function exists.
> b) If yes then use KNOWNFOLDERID method else use CSIDL method.

Something like the following:

    type
        KNOWNFOLDERID = TGuid;

    const
        FOLDERID_ProgramData: KNOWNFOLDERID = 
'{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}';

    var
        SHGetKnownFolderPathFunc = function(const rfid: KNOWNFOLDERID; 
dwFlags: DWORD; hToken: THandle; var ppszPath: PWideChar): HResult; stdcall;
        SHGetKnownFolderIDListFunc = function(const rfid: KNOWNFOLDERID; 
dwFlags: DWORD; hToken: THandle; var ppidl: PItemIDList): HResult; stdcall;

    function PathFromIDList(Pidl: PItemIdList): String;
    var
        Path: array[0..MAX_PATH] of Char;
    begin
        if SHGetPathFromIDList(Pidl, Path) then
            Result := Path
        else
            Result := '';
    end;


    function GetCommonAppDataPath: String;
    var
        Path: PWideChar;
        Pidl: PItemIdList;
    begin
        Result := '';
        if @SHGetKnownFolderPathFunc <> nil then
        begin
            if Succeeded(SHGetKnownFolderPathFunc(FOLDERID_ProgramData, 0, 
0, Path) then
            begin
                try
                    Result := Path;
                finally
                    CoTaskMemFree(Path);
                end;
                Exit;
            end;
        end
        else if @SHGetKnownFolderIDListFunc <> nil then
        begin
            if Succeeded(SHGetKnownFolderIDListFunc(FOLDERID_ProgramData, 0, 
0, Pidl) then
            begin
                try
                    Result := PathFromIDList(Pidl);
                finally
                    CoTaskMemFree(Pidl);
                end;
                Exit;
            end;
        end;

        if Succeeded(SHGetFolderLocation(0, CSIDL_COMMON_APPDATA, 0, 0, 
Pidl) then
        try
            Result := PathFromIDList(Pidl);
        finally
            CoTaskMemFree(Pidl);
        end;
    end;

    procedure InitVistaFunctions;
    var
        hShell32: THandle;
    begin
        hShell32 := GetModuleHandle('SHELL32');
        @SHGetKnownFolderPathFunc := GetProcAddress(Shell32, 
'SHGetKnownFolderPath');
        @SHGetKnownFolderIDListFunc := GetProcAddress(Shell32, 
'SHGetKnownFolderIDList');
    end;

    initialization
        InitVistaFunctions;

> 2) Can I set that any user should have write access to MyFolder when I 
> create it?

The Win32 API CreateDirectory/Ex() functions have an lpSecurityAttributes 
parameter for that purpose.  Allocate a SECURITY_ATTRIBUTES record and fill 
it in with details to provide write access to all users.

> 3) Will a Windows service have write acces to the MyFolder?

Yes, provided it runs in a user account that has the proper security rights 
assigned to it.

-- 
Remy Lebeau (TeamB)
0
Remy
9/26/2008 6:10:43 PM
Gambit,

Thank you so much! Now I know I am doing things right ;-)

I made it work using D2007 (still waiting to receive my ordered D2009) under XP. Anyone can check under Vista?

Since this is of general interest (can easily be modified/generalised to get any known folder) and a minor change was needed, here is my working unit:

EDIT: NOTE less than and greater than characters dissapear in the code.
EDIT2: Now found out how to display code in a better way (the upper characters are still missing though):

{code}
unit UKNOWNFOLDER;


interface

function GetCommonAppDataPath: String;


implementation

uses
  Windows, ShlObj, ActiveX;

type
  KNOWNFOLDERID = TGuid;

const
  FOLDERID_ProgramData: KNOWNFOLDERID = '{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}';

var
  SHGetKnownFolderPathFunc: function(const rfid: KNOWNFOLDERID;
  dwFlags: DWORD; hToken: THandle; var ppszPath: PWideChar): HResult; stdcall;
  SHGetKnownFolderIDListFunc: function(const rfid: KNOWNFOLDERID;
  dwFlags: DWORD; hToken: THandle; var ppidl: PItemIDList): HResult; stdcall;

function PathFromIDList(Pidl: PItemIdList): String;
var
  Path: array[0..MAX_PATH] of Char;
begin
  if SHGetPathFromIDList(Pidl, Path) then
    Result := Path
  else
    Result := '';
end;

function GetCommonAppDataPath: String;
var
  Path: PWideChar;
  Pidl: PItemIdList;
begin
  Result := '';
  if @SHGetKnownFolderPathFunc <> nil then
  begin
    if Succeeded(SHGetKnownFolderPathFunc(FOLDERID_ProgramData, 0, 0, Path)) then
    begin
      try
        Result := Path;
      finally
        CoTaskMemFree(Path);
      end;
      Exit;
    end;
  end
  else
    if @SHGetKnownFolderIDListFunc <> nil then
    begin
      if Succeeded(SHGetKnownFolderIDListFunc(FOLDERID_ProgramData, 0, 0, Pidl)) then
      begin
        try
          Result := PathFromIDList(Pidl);
        finally
          CoTaskMemFree(Pidl);
        end;
        Exit;
       end;
    end;

(*  Changed:
  if Succeeded(SHGetFolderLocation(0, CSIDL_COMMON_APPDATA, 0, 0, Pidl)
 To:
*)

  if Succeeded(SHGetSpecialFolderLocation(0, CSIDL_COMMON_APPDATA, Pidl)) then
    try
      Result := PathFromIDList(Pidl);
    finally
      CoTaskMemFree(Pidl);
    end;
end;

procedure InitVistaFunctions;
var
  hShell32: THandle;
begin
  hShell32 := GetModuleHandle('SHELL32');
  @SHGetKnownFolderPathFunc := GetProcAddress(hShell32, 'SHGetKnownFolderPath');
  @SHGetKnownFolderIDListFunc := GetProcAddress(hShell32, 'SHGetKnownFolderIDList');
end;

initialization
  InitVistaFunctions;
end.
{code}


Greetings

Steen

Edited by: Steen Albrechtsen on Sep 26, 2008 3:37 PM

Edited by: Steen Albrechtsen on Sep 27, 2008 6:34 PM

Edited by: Steen Albrechtsen on Sep 27, 2008 6:41 PM

Edited by: Steen Albrechtsen on Sep 27, 2008 6:43 PM
0
Steen
9/28/2008 1:44:39 AM
Reply:

Similar Artilces:

Shared folders and rights to shared documents
Guys, (GW8 SP2) I had to create a share folder and give access (add, edit, remove) for it to a handful of users. Working as designed. Now if one of them adds a file to this shared folder they explicitely have to share this file instead of it inheriting the rights from the folder's configuration... Enhancement request, anyone? "Fixed in SP3?" ... Peter Peter Schwindt wrote: > Now if one of them adds a file to this shared folder they explicitely have to > share this file instead of it inheriting the rights from the folder's > configuration... ...

Share Documents Folder ?
Can you "Share" the Documents folder within Delphi , so that you can tranfers documents etc from the Application "Shared" folder within Itunes? Anyone knows what setting to change, in order to have the Documents folder available for sharing? On Thu, 4 Jul 2013 18:53:43 -0700, Perry Kappetein <pkappetein@charter.net> wrote: >Can you "Share" the Documents folder within Delphi , so that you can tranfers documents etc from the Application "Shared" folder within Itunes? ...

shared folders and document
When i put a mail, notes in a shared folders, other people who have full rights can do what they want. With documents, it is not the same case. I must put share rights after putting a word by example. Is there a tips to make than automatically, a document which is put in the shared filder inherits rights of the folder ? Nope, the DMS rights are completely separate from shared folder rights, all a shared folder gives you is an implicit View right Cheers Dave -- Dave Parkes [NSCS] Occasionally resident at http://support-forums.novell.com/ Thank you for your answer. a...

Shared Folders And Library Documents
Need some confusion cleared up over Shared folders and Library documents Do rights given to a shared folder flow onto a Library document placed in that shared folders or do I need to give the user account specific rights to the document as well?? Placing a document reference in a shared folder gives implicit view rights, that's all. So yes, you usually need to add explicit rights to the document itself Cheers Dave -- Dave Parkes [NSCS] Occasionally resident at http://support-forums.novell.com/ ...

Vista/64: Shared folders
In setting up the hard drive in my Vista/64bit system to be accessible from my other computers, I've run into a bit of a snag whose only work-around I'm not happy with. I'm sharing the entire C: drive because I do not want to have to configure a zillion individual shares to be able to access everything on the disk from my other machines. In the Permissions section, the only provided option is "Everyone". If I click on "Add", the given Location is for the machine itself. So I click on the "Locations..." button to select one of the other mac...

8503 Retrieving documents from shared folders
We are having trouble accessing documents via shared folders. The clients are signing into various Post Offices and the documents are stored in Libraries owned by other Post Offices. If the client logs in to a PC or laptop inside our district WAN, accessing documents in shared folders is not a problem. If the client is signing in from outside the district WAN, they receive the following error: "8503: the post office agent is not running or cannot be found at the specified IP address and IP port" Messages that contain attachments are not affected and can be retrieved f...

Error opening documents from a shared folder...
We're in the process of upgrading our clients to 8.0.2. We've found on the machines that have made the move to GW8 client, that every time they attempt to open a document that is in a shared folder (or the document library). We get an error: Windows cannot find 'C:\Documents and settings\<username>\Local Settings\Temp\XPgrpwise\<filename>'". Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click search. The file IS in the location, however it can't open the file. We've noti...

SHARE SHARE SHARE
Name: Sarah M. Keating Email: sarahmkdotuioatgmaildotcom Product: Firefox Summary: SHARE SHARE SHARE Comments: Hey! I just donated money to the cause of saving Lemurs (yes I can't spell) in Madagascar...and I really wish you had a share app on that page so that I could post it on my facebook page. Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (no...

Shared Folder / Shared to a group
Hi, We want to create a shared folder with all the useful information in it. For this, the folder should be shared to a group. I can of course share it, but when I share it with a group, the members are beinx expanded. The problem in this situation is now, that whenever the group changes, the share does not reflect that change. Is there a possibility to not expand the groups? If not: does anybody know of a CLI Program that can grant additional share rights to a shared folder? s all the user creation is done with a batch file, I could easily incorporate this feature in plus....

Shared Folders with Sub-folders
Can folders with sub-folders be shared by just selecting the parent folder OR is it just like GW6.5 - every folder has to be shared ? If each folder has to be shared individually, is there a 3rd party solution ? Steve Steve Babcock wrote: > Can folders with sub-folders be shared by just selecting the parent folder > OR is it just like GW6.5 - every folder has to be shared ? It's the same as GW6.5. > If each folder has to be shared individually, is there a 3rd party > solution ? Treecast is one - http://www.open-net.biz/ -- Danita Zanre Novell ...

Shared Folders with Sub-Folders
On GW 6.5sp1 we need to transfer all of one user's data to another. We just share the needed folders from one user to the other and copy/move the data from the shared folder into the destination user's mailbox into another folder then remove the shared folder. This works good except that when we share a folder, the user cannot access any sub-folders under the shared folder, only the items directly under the folder that was shared. This is ok for some users because they have very little data. But some users have several folders with a sub-folder tree structure that would sca...

Delphi 2009 Images Folder Location In Vista
I have been looking to see if there is a Delphi 2009 images folder but can not find it. Where is it in Delphi 2009 on Vista? Has the glyphs been updated? Bill On Tue, 16 Sep 2008 15:04:25 -0700, Bill Miller wrote: > I have been looking to see if there is a Delphi 2009 images folder but can > not find it. Where is it in Delphi 2009 on Vista? Has the glyphs been > updated? The folder is usually under program files\common files\codegear shared. -- Marc Rohloff [TeamB] marc -at- marc rohloff -dot- com ...

shared folder not showing folders
Using Groupwise 6.5.7. User A creates a shared folder with User B. User B can move individual messages into the shared folder and User A can see the messages. But when User B moves a folder into the shared folder, User A cannot see it (although User B can see it is in the shared folder). The folder rights are setup correctly. As a test I tried to do the same process but in reverse order. It is still the same user that cannot see any shared folders. So it doesn't matter who is the owner of the shared folder, User A cannot see any folders. Folders have to be individuall...

SHared folders and sub-folders
I have a user A who shared her folder to another user B. User B can only see the files in that folder but none of the sub-folders. Does each indivdual sub-folder need to be redundantly shared?? TIA. correct. -- Michael J. Bell Novell Support Connection Volunteer Sysop PLEASE: Do not e-mail me privately unless specifically asked. I'm a volunteer, not a Novell employee! All opinions and advice provided are MINE alone and NOT Novell's unless specifically identified as such. Novell does not officially monitor these forums. Enhancement requests for all Novel...

Web resources about - Shared documents folder on VISTA - embarcadero.delphi.nativeapi

Identity document - Wikipedia, the free encyclopedia
An identity document (also called a piece of identification or ID , or colloquially as one's 'papers') is any document which may be used to verify ...

'Mad house of emotions': Defence documents reveal long-held concerns about drug linked to depression ...
Previously classified documents show the Australian Defence Force kept giving soldiers a harmful drug for at least 14 years after first becoming ...

Police review claims a Canberra plumber provided false documents to the TURC
Lawsuit claims that falsified documents were handed to the unions royal commission at the instruction of a Canberra plumbing boss.

National Archives to put nation's founding document, Constitution Act, on show
Australia's strictly preserved founding documents will again go on display for selected days as the nation nears another birthday on January ...

Exclusive: Islamic State sanctioned organ harvesting in document taken in US raid
The ruling says taking organs from a living captive to save a Muslim's life, even if it is fatal for the captive, is permissible.

For the first time, declassified documents reveal United States’ nuclear weapons strategy
... weapons strategy back at the height of the Cold War. Originally put together in 1956 by the Strategic Air Command (SAC), the 800 page document ...

Hacker group Anonymous helps 'Making a Murderer' convict, plans to release new documents
It appears that hacking group Anonymous is trying to help Steven Avery, the subject of the new Netflix documentary series "Making a Murderer." ...

Off day doesn't figure in Modi's lexicon - Business Standard News New Document Widgets Magazine Widgets ...
Prime Minister Narendra Modi, who once called himself the "Pradhan Sewak", is walking the talk, and how. He has not taken a single day off after ...

Prince William ‘occasionally receives copies of confidential cabinet documents’
... a kerfuffle in the British press about William and what he has access to. It’s well-known that the Queen receives extensive government documents ...

Laquan McDonald court documents show teen hoped for better life
Chicago Tribune Laquan McDonald court documents show teen hoped for better life Chicago Tribune Photos: Follow developments in the 2014 fatal ...

Resources last updated: 12/28/2015 10:34:11 PM