         Additional viewer modules to view various types of file          
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~          

                      Information for developers                         
                      --------------------------                         

The viewer is a usual Win32 DLL. To allow FN use it, this DLL must export the 
functions described below and must interchange of messages with the FN main
window. Constants and function prototypes are declared in viewers.h and
viewers.pas. 


Exported functions
------------------

void WINAPI GetLastErrorText(LPSTR pszErrorText, DWORD cbErrorTextSize);

Must return the last error description.

Parameters
    pszErrorText      [out] Pointer to the buffer that will receive the text.
    cbErrorTextSize   [in] Specifies the maximum number of characters to copy
                      to the buffer, including the NULL character. If the text
                      exceeds this limit, it is truncated.


HWND WINAPI CreateViewerWindow(HWND hwndApp, HWND hwndParent, int nLangID, 
                               BOOL bFullView, HMENU* phMenu, HWND* phToolBar, 
                               HACCEL* phAccelTable);
Parameters
    hwndApp           [in] Handle of the FN main window.
    hwndParent        [in] Handle of the panel to embed the viewer into.  
    nLangID           [in] Language identifier of the current FN language. One
                      of the LANG_XXX constants declared in SDK.
    bFullView         [in] If this parameter is TRUE, the "full-window" mode
                      is used and both file panels are hidden. If this 
                      parameter is FALSE, the viewer is embedded in the Quick
                      View panel. 
    phMenu            [out] Pointer to the variable that will receive the
                      viewer main menu handle, if bFullView = TRUE.
    phToolBar         [out] Pointer to the variable that will receive the 
                      viewer toolbar handle, if bFullView = TRUE, or NULL,
                      if the viewer does not create a toolbar.
    phAccelTable      [out] Pointer to the variable that will receive the 
                      viewer accelerator table handle, or NULL if no
                      accelerators.
					  
Return value
    Handle of the created window or NULL on error.

Function must create a window with WS_CHILD style and parent window specified
in the "hwndParent" parameter. If the "bFullView" parameter is true, the main
menu must be created. Optionally the viewer may create a toolbar.
The toolbar's parent window is specified in the "hwndApp" parameter.
If an error is occured, its description must be available by using
the GetLastErrorText function. 			

After the viewer window is created FN replaces its own menu and toolbar with
the viewer's ones. FN will dispatch the WM_COMMAND message to the viewer
window. The correct handling of this message is the viewer task. In the quick
view mode menu and toolbar are not used.


BOOL WINAPI ShowFile(HWND hwndViewer, LPCSTR pszFilePath, LPSTR pszFileInfo);

This function must load and display a file, which path is specified in the
"pszFilePath" parameter. Also, it must provide FN with the brief information
about this file (for example, file format or version). This info will be shown
at the right side of the FN panel caption.

Parameters
    hwndViewer    [in] Handle of the viewer window.
    pszFilePath   [in] Full file path.
    pszFileInfo   [out] Pointer to the buffer that will receive the file info 
                  (not greater than 63 characters).

Return value
    TRUE if file is loaded successfully, FALSE otherwise. An error description
    must be available by using the GetLastErrorText function.


void WINAPI DestroyViewerWindow(HWND hwndViewer);

This function must close the viewer window, after that FN will restore the
previous panel mode.

Parameters
    hwndViewer    [in] Handle of the viewer window.


Messages that the viewer sends to the FN main window
----------------------------------------------------

VM_SET_FILE_INFO

This message used to update the FN panel caption if the viewer opens another
file. Use the SendMessage function. lParam must contain the pointer to the
following filled structure: 

struct VIEWER_FILE_INFO
{
 LPSTR pszFileName;  // pointer to the NULL-terminated string containing the
                     // file path 
 LPSTR pszFileInfo;  // pointer to the NULL-terminated string containing the
                     // file info
};


VM_CLOSE_QUERY

This message the viewer must send to be closed. After receiving this message
FN calls the DestroyViewerWindow function.


VM_SHOW_DIALOG

This message the viewer must send if it opens/closes a modeless dialog. Needed 
for correct processing of the keyboard messages.
Parameters
    wParam    1 - dialog is opened, 0 - dialog is closing.
    lParam    Dialog window handle.



Messages from FN
----------------

WM_IDLE

This message FN sends when becoming idle, i.e. no any messages in the queue.
