Solved

Geting folders.

Posted on 2002-07-03
11
269 Views
Last Modified: 2013-12-03
Hello experts...

Y need to know the name of the Start Menu folder.
I checked the MSN, I found GetSystemDirectory, GetWindowsDirectory, But no function to find the start menu folder or desktop folder...

For instances. My windows is in spanish, so the folder is named "C:\Windows\Menu inicio" But what if the computer where the program will be used is in english, or greek, german, french...
It could be worse... The Windows directory is not necesary named "C:\Windows"

How can I find this out?.
Thank you very much.

0
Comment
Question by:Marsc
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7127717
Use the SHGetFolderPath function and a CSIDL value of CSIDL_STARTMENU.
0
 
LVL 86

Expert Comment

by:jkr
ID: 7127799
Just a little correction - jhance probably meant 'SHGetSpecialFolderPath()'
0
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 7127820
No, actually I did mean SHGetFolderPath().  

Note that the SDK docs say:

"With Microsoft® Windows® 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable DLL, ShFolder.dll."

And also:

"This function is a superset of SHGetSpecialFolderPath, included with earlier versions of the Shell. It is implemented in a redistributable DLL, SHFolder.dll, that also simulates many of the new Shell folders on older platforms such as Windows 95, Windows 98, and Windows NT 4.0."

But, in this particular case, either will do the same thing.
0
 
LVL 1

Author Comment

by:Marsc
ID: 7127967
In conclusion.

Can I use SHGetSpecialFolderPath under W2000 without distributing any DLL?.

The idea is to make a simple installer that copies file to C:\myprogram\Program.Exe, Adds an icon in the start menu and some entries in the registry.
I can't afford a professional tool by now. And I didn´t find any freeware to do this.

0
 
LVL 86

Expert Comment

by:jkr
ID: 7127980
>>Can I use SHGetSpecialFolderPath under W2000 without distributing any DLL?.


Yes. It'd be different for Win9x, but it's OK with W2k.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:Marsc
ID: 7129912
Well....
I have to accept the first answer...

Just one question.
What header file should I include?.
The function I will use is SHGetSpecial.....


I will try SHFolder.h and SHFolder.lib
0
 
LVL 32

Expert Comment

by:jhance
ID: 7129935
You should get a copy of the SDK/MSDN docs.  For SHGetSpecialFolderPath() it says:

  Header: Declared in Shlobj.h.
  Import Library: Shell32.lib.

Again, I don't recommend SHGetSpecialFolderPath() in favor of SHGetFolderPath() but it's your call.
0
 
LVL 1

Author Comment

by:Marsc
ID: 7129996
>>Again, I don't recommend SHGetSpecialFolderPath() in favor of SHGetFolderPath() but it's your call.

The problem is... I need something simple (A simple EXE)that is capable to run under W9x.
If this funtion works under W9x And W2K is usefull to me....
But let me know if it will take me into troubles.


0
 
LVL 32

Expert Comment

by:jhance
ID: 7130119
Actually, you're going to run into some system that will not have EITHER of these.  Some Win95 and NT4 systems will not have SHGetSpecialFolderPath() and some Win95, Win98 and NT4systems will not have SHGetFolderPath().

Both of these are included in any system that has been updated to include IE4 and Microsoft's position is that it's not a "supportable" WIN32 platform w/o IE4's DLL updates.

The MOST compatible of these functions is SHGetSpecialFolderLocation().  The problem with this function, however, is that it does not return a string for the path but rather returns a PIDL.  It's a real pain to turn a PIDL back into an ASCII filename using SHGetPathFromIDList().  So there is just no 100% sure-fire way of doing what you want to do.

If you want it to bee foolproof, you must plan for any contingengy and use what you find available.  Otherwise, you'll either have to fail on some systems or force users to install at least IE4.

That's Microsoft for ya...  Good luck.
0
 
LVL 3

Expert Comment

by:aphillips
ID: 7275649
I was using SHGetSpecialFolderPath() under NT4 and got the expected message about it not being found in shell32.dll.  I installed IE5.5 and still had the same problem.

> included in any system that has been updated to include IE4 ...

If IE4 adds support why doesn't IE5.5?  Or is it becasue I didn't link with the right library -- I couldn't find a shfolder.lib anywhere.
0
 
LVL 3

Expert Comment

by:aphillips
ID: 7275657
I was using SHGetSpecialFolderPath() under NT4 and got the expected message about it not being found in shell32.dll.  I installed IE5.5 and still had the same problem.

> included in any system that has been updated to include IE4 ...

If IE4 adds support why doesn't IE5.5?  Or is it because I didn't link with the right library -- I couldn't find a shfolder.lib anywhere.

(I've been trying to resolve this problem for days.)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now