Solved

Geting folders.

Posted on 2002-07-03
11
266 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
Comment Utility
Use the SHGetFolderPath function and a CSIDL value of CSIDL_STARTMENU.
0
 
LVL 86

Expert Comment

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

Accepted Solution

by:
jhance earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
>>Can I use SHGetSpecialFolderPath under W2000 without distributing any DLL?.


Yes. It'd be different for Win9x, but it's OK with W2k.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:Marsc
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

13 Experts available now in Live!

Get 1:1 Help Now