
** Steps to do for Extendability of BrowseHelpFiles_PlugIn **

----------------------------------------------------------------------------------------------


The DLL can currently search and open ".chm" files and ".doc" files.

With a little change in the code, the functionality can be extended to search and open more types of files. 

Say you want to add a new type *.xxx. The steps for doing this are:

---------------------------

1. Add an Identifier for new type of file

In the header BrowseCHMDialog.h, there is an enumeration with one value for each file type.

    enum TypesOfHelpDocuments
    {
        eTypeCHM = 0,
        eTypeDOC = 1,
        eTotalTypes//KEEP IT LAST ALWAYS
    };

Add a new enum value for type *.xxx. So the enumeration now looks like:

    enum TypesOfHelpDocuments
    {
        eTypeCHM = 0,
        eTypeDOC = 1,
	eTypeXXX = 2,
        eTotalTypes//KEEP IT LAST ALWAYS
    };

NOTE: Please take care that all new types are added before the value "eTotalTypes". This should 	      be the last value in the enumeration.

---------------------------

2. Add the Search Pattern and the Application Type in the module BrowseCHMDialog.cpp

- You have to add the pattern to find this type of files in the PatternsToFind [eTotalTypes]     array.

CString CBrowseCHMDialog::PatternsToFind [eTotalTypes] = {"*.chm", "*.doc", "*.xxx"};

- Also, add the application with which this file can be opened in the   ApplicationsForHelpDocuments [eTotalTypes]. For this,

	a) Add the name of the file, say, "xxxOpener.exe" if this is a DEFAULT WINDOWS 				APPLICATION, i.e. comes bundled with Windows and doesn't need to installed separately. 			For example "notepad.exe".

	b) Add the path where this application registers itself in the Windows Registry (This is 		always same for an application on any machine). For example, add 					"SOFTWARE\\Classes\\Applications\\xxxOpener.EXE\\Shell\\open\\command" if this 				application registers itself in the above path.

Note: Code to find the application name from Windows Registry has been written with the
      assumption that the application has been registered in the "HKEY_LOCAL_MACHINE" and not for       any specific user. So, its path will be searched in "HKEY_LOCAL_MACHINE" only.

---------------------------

3. Call the Application Type when user presses the "Open" button

The application xxxOpener.exe has to be called with the selected file name when the user presses the "Open" command button. You need to mention this application name in different manner depending upon whether the application is a DEFAULT WINDOWS APPLICATION or a separately packaged application.

The handling has got be done in the function OnBnClickedButtonChmOpen().

a) If the application is a DEFAULT WINDOWS APPLICATION, there is apiece of code where the application name has to be specified. 

...

    if( 0 == strFileSelected.Right(LENGTH_OF_EXTENSION).CompareNoCase(PatternsToFind[eTypeCHM].Right(LENGTH_OF_EXTENSION)))
    {
        strcpy (chCommandLine, ApplicationsForHelpDocuments[eTypeCHM]);
    }//add cases with "else if" for files types which come with Microsoft Windows

...


Add another "else if" if the Application is a DEFAULT WINDOWS APPLICATION. For example, add

...

else if( 0 == strFileSelected.Right(LENGTH_OF_EXTENSION).CompareNoCase(PatternsToFind[eTypeXXX].Right(LENGTH_OF_EXTENSION)))
    {
        strcpy (chCommandLine, ApplicationsForHelpDocuments[eTypeXXX]);
    } 

...


b) If the Application is NOT A DEFAULT WINDOWS APPLICATION, there is a piece of code which reads the Application Path from the windows registry ("else" case of the "if" structure described at point (a) above):

...

if( 0 == strFileSelected.Right(LENGTH_OF_EXTENSION).CompareNoCase(PatternsToFind[eTypeDOC].Right(LENGTH_OF_EXTENSION)))
        {
            strApplicationName = ApplicationsForHelpDocuments[eTypeDOC];
        }
        //keep adding cases here with "else if" with types from "enum TypesOfHelpDocuments"
         
	lResult = Read_ApplicationPathFromRegistry(strApplicationName, strApplicationPath);

...


Add another "else if" to handle the new case. For example, add

...

if( 0 == strFileSelected.Right(LENGTH_OF_EXTENSION).CompareNoCase(PatternsToFind[eTypeXXX].Right(LENGTH_OF_EXTENSION)))
        {
            strApplicationName = ApplicationsForHelpDocuments[eTypeXXX];
        }
...

----------------------------------------------------------------------------------------------

Now the DLL will also search and open the new type "*.xxx" added by you.
