Link to home
Start Free TrialLog in
Avatar of Marsc
Marsc

asked on

Geting folders.

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.

Avatar of jhance
jhance

Use the SHGetFolderPath function and a CSIDL value of CSIDL_STARTMENU.
Avatar of jkr
Just a little correction - jhance probably meant 'SHGetSpecialFolderPath()'
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marsc

ASKER

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.

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


Yes. It'd be different for Win9x, but it's OK with W2k.
Avatar of Marsc

ASKER

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
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.
Avatar of Marsc

ASKER

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


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