Solved

Geting folders.

Posted on 2002-07-03
11
280 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

728 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