🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

What is the Correct way to get a special folder location?

#15445
From: Zack
Date: Sat, 28 Jun 2003 02:07
62 lines
3543 bytes
Hi, Please help.

I have been using SHGetSpecialFolderPath() to get folders like the System,
Windows, Fonts etc.   Works great.

However, this  creates a dependency (from my COM server that calls this
function) to Shell32.dll.  Further this function was not implimented until
after version 4.71 of shell32.dll.

Now - users on NT4 and 95 are out of luck because no matter what they do -
they cannot update this system file to a version  beyond 4.0 and thus can
never register my COM server and use my software.  There are numerous posts
on the web about this topic and no nobody has a good answer on how to fix
this for the user.

Then, I found the following at MS which explains how no to be dependant on
this dll at all :

"
A-2. Use SHGetFolderPath To Determine Special Folder Paths
Whenever you access any of the special folders in the following list, your
application should use the Win32 APIs to dynamically obtain the proper
language-specific folder names. The preferred way to do this is using the
SHGetFolderPath API with the appropriate CSIDL constant. This function
behaves consistently across Windows 95, Windows 98, Windows NT 4.0, and
Windows 2000. This API is redistributable via the SHFOLDER.DLL. Software
vendors are encouraged to redistribute this component as much as possible to
enable this support on Windows operating systems prior to Windows 2000.
Windows 2000 includes this DLL as a protected system file and, as such, this
DLL cannot be replaced on Windows 2000 or greater.

Note   To ensure your application can run on Windows 9x, Windows NT 4.0 and
Windows 2000, always link to the SHGetFolderPath implementation in
SHFOLDER.DLL. Windows 2000 natively implements SHGetFolderPath in
SHELL32.DLL, but other versions of Windows do not include SHGetFolderPath in
SHELL32.DLL.

"

(Taken from MS Best Practices page: (link may wrap)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnw2ksrv/html/w2kserve_appa.asp



OK- Great - gotta link to shfolder instead.  But now, my problem is - even
when I comment out my inclusion of #include <shlobj.h> and add the inclusion
of #include "SHFOLDER.hpp"... I still link to shell32.dll!  And somehow - my
source can still see shlobj.h.

1) How to I force this linker to look at ShFolder.hpp first for this
function and Not use shlobj?

2) I also use ShellExecute which is in shell32.dll..... is there a version
of this function that lives in a dll that works across all OS's from 95, 98,
NT, 2K to XP ?



TIA

Zack.
Technical Details
Message-ID: <3efcf824@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!feeder.buzzardnews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,780217d415786dcd,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-27 19:14:05 PST
From: "Zack" <a@bv.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: What is the Correct way to get a special folder location?
Date: Fri, 27 Jun 2003 19:07:58 -0700
Lines: 74
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 24.84.53.212
Message-ID: <3efcf824@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1056765988 24.84.53.212 (27 Jun 2003 19:06:28 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!feeder.buzzardnews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail