Solved

Geting folders.

Posted on 2002-07-03
11
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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
 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…

739 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