Win95 Group Code
****************
1996 Chris Beach
****************
100436.172@compuserve.com

FREEWARE

This file contains 3 ways of getting at ALL of the Win95 program groups for use in Setup programs.  I say all becuase most of the setup utilites that I've seen will only get the first layer of groups, ie the ones directly beneath 'Start Menu\Programs\'.  I wanted to alter the VB4 Setup program so that I could let my users put my icons anywhere they choose.

*****************************************
This is what I mean by levels and groups:
Group:		Start Menu\Programs\Visual Basic v4.0\Reference Files
Level:    	    1		2	  3		   4
So this means:
4 is in 3 is in 2 is in 1, but 1 is above 2 is above 3 is above 4, and they are all IN 'My Computer', (well actually its not my computer at all, its my dads ;-)
Its even more confusing if you start think of them as folders or directories :)

After a bit of fiddling and research I have come up with 3 different approaches:

1)API Tree,	(32Bit) this approach uses API calls only (from shell32.dll) and I think is the prettiest and also more Win95 style.  The code is adapted from Brad Martinez's BrowseDlg example in the VBPJFO on CompuServe, and he got his information from MSDN.  This code also has an extra bit for determining which icons to install, for more info mail 100436,172

2)ShortCuts, 	(32Bit) this approach uses the treeview control (from COMCTL32.OCX) and the Dir function.  This one also looks good and works well BUT there is one potential problem I do not know if COMCTL32.OCX is on a defualt Windows 95 setup.  I think it probably is but I might be wrong, and I'm sorry but I don't have time to search through all the CAB files looking for one file.  If anyone knows different and if there is a way to 'setup' the setup program :) let me know.
This approach could be considered cheating when compared to (1) because it only knows the group level 1-3, and calculates any below that when the user makes a choice.  But my Dad pointed out that this could be a quicker approach.  To hide the fact that I have no idea whats under group 3, the treeview cannot be set to a style with +/-. If you did a plus would suddenly appear when you clicked on a group that contained more groups, and that would look worse than (3) ;->

3)List Tree,	(EveryBit) this approch uses only a list box and the dir function.  It is the worst of the three and also the hardest to code.  But it is portable between 32 and 16bit OS.  At the moment my code doesn't occumplish what the other two can do.  It will only get 4 levels of groups. 
It is also difficult to get the full path from a 4 level group.
The main problem in this method is that its difficult to include a heirachy in just text lines,  I have used the number of spaces before the group name to indicate the level.  And you also have the problem of releating a level 4 group to the level 3 group that its in, espically if there is more than 1 level 4 group.

**************************************
I wouldn't recommend this file to absolute beginners that are trying to use the treeview control and nodes collections.  It is commented but becuase the code has been changed a lot some of the comments don't mak nu senz

**************************************
I don't know if distributing the the 'setup1' directory files is allowed, so here is a very confusing description of how to use these 3 bits of code.

The 3 bits of code set public varibles:

GroupSelected	is a string contain just the group name, no path and no slashes
EXEIcon		is a boolean that indicates if the Main EXE icon should be created
HelpIcon	"  "    "      "      "     "  a icon for the help should be created
ReadIcon	"  "    "      "      "     "  a icon for README.TXT
ListIcon	"  "    "      "      "     "  a icon for a list of your other masterpieces

1)add one of the 3 methods to the setup1 project (you can't use two types the forms and modules have the same name)
2)edit the code the kit tells you (setup1 form_load I think)
3)find the code where it starts rambling about groups and icons, read the comments and make the changes it suggests.
4)there should be a line 'If fCreateGroup Then' after this line add 'frmShortCuts.Show 1'
5)now find the line 'CreateOSProgramGroup..........' and change to
'CreateOSProgramGroup frmSetup1, GroupSelected, strGrpPath'
6)Compile and that should be it.

Method (1) only
7)find the comment about adding additional icons.
8)uncomment the error check IF statment
9)add 4 tests based on the four boolean values above.

Then the next time you use Setup Wizard it will use you amazing new setup program.

Chris Beach
16:25, 11 July 96

DISCLAMIER/LEGAL CRAP
If you improve this code then by all means feel free to uploaded it anywhere as Freeware.  If you want to use this code in a shareware/commercial program then please let me know, its nice to know you can write something usefull.
Windows 95, VisualBasic are copyrights of MicroSoft
Thanks to Brad Martinez for the Shell API code
