🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14221

Re: SHGetSpecialFolderLocation!

#14221
From: Safari
Date: Wed, 20 Aug 2003 14:39
51 lines
2296 bytes
Very thanks Rodolfo,
Safari

"Rodolfo Frino" <rodolfofrino@yahoo.com> wrote in message
news:3f42a46c@newsgroups.borland.com...
|
| Probably because you didn't include the shlobj.h header file
| Also modify GetPaths() as shown below
|
| Get rid of CoTaskMemFree function since you did not allocate with neither
| CoTaskMemAlloc nor CoTaskMemRealloc functions.
|
|
| #define NO_WIN32_LEAN_AND_MEAN
| #include <shlobj.h>
| #include <vcl.h>
|
| #pragma hdrstop
|
| #include "SHGetSpecialFolderLocation.h"
|
//--------------------------------------------------------------------------
| -
| #pragma package(smart_init)
| #pragma resource "*.dfm"
| TForm1 *Form1;
|
//--------------------------------------------------------------------------
| -
| __fastcall TForm1::TForm1(TComponent* Owner)
|         : TForm(Owner)
| {
| }
|
//--------------------------------------------------------------------------
| -
|
| AnsiString GetPaths(int Folder)
| {
|      LPITEMIDLIST List = NULL;
|
|      char Path[MAX_PATH + 1] = {0};
|
|      if (!SHGetSpecialFolderLocation(0, Folder, &List))
|         if (SHGetPathFromIDList(List, Path))
|            return String(Path);
|
|      return "";  // return an empty AnsiString in case of error
| }
|
| Rodolfo
Technical Details
Message-ID: <3f44ad7d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3F425543.9040507@alloymail.com> <3f42a46c@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7ce38efab0f8f813
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-21 04:34:20 PST
From: "Safari" <Safari@alloymail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3F425543.9040507@alloymail.com> <3f42a46c@newsgroups.borland.com>
Subject: Re: SHGetSpecialFolderLocation!
Date: Wed, 20 Aug 2003 19:09:44 +0430
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 194.225.63.249
Message-ID: <3f44ad7d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061465469 194.225.63.249 (21 Aug 2003 04:31:09 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail