//====START_GENERATED_PROLOG======================================
//
//
//   COMPONENT_NAME: odother
//
//   CLASSES: none
//
//   ORIGINS: 27
//
//
//   (C) COPYRIGHT International Business Machines Corp. 1995,1996
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//
//   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
//   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
//   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
//   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
//   OR PERFORMANCE OF THIS SOFTWARE.
//
//====END_GENERATED_PROLOG========================================
//
// @(#) 1.1 nt/src/samples/JavaPart/help.cpp, odjavapart, od96nt, odnt9712d 10/23/96 03:06:16 [ 3/21/97 17:41:04 ]

#ifndef IBMSample_HELP
#include "Help.h"
#endif

#ifndef IBMSample_JAVAPART
#include "IODJava.h"
#endif

#include <qprintf.h>

/*-------------------------------------------------------------------+
|                     HelpDialog::HelpDialog ()                      |
| ================================================================== |
|                                                                    |
| Function:    HelpDialog default constructor                        |
|                                                                    |
| Algorithm:   o  Set default values...                              |
|                                                                    |
+-------------------------------------------------------------------*/
HelpDialog::HelpDialog (HWND parentWindow) :
	Dialog (parentWindow, HelpDialogResource)
{
	;
}


/*-------------------------------------------------------------------+
|                        HelpDialog::Show ()                         |
| ================================================================== |
|                                                                    |
| Function:    Display the help information...                       |
|                                                                    |
| Parameters:  key - index into resource file for help text...       |
|                                                                    |
| Returns:     (0)  Successfull                                      |
|              (-1) An error occurred                                |
|                                                                    |
+-------------------------------------------------------------------*/
void HelpDialog::Show (long resourceKey)
{
	fResourceKey = resourceKey;

	Display ();
}


/*-------------------------------------------------------------------+
|                        HelpDialog::Init ()                         |
| ================================================================== |
|                                                                    |
| Function:    Initialize the properties dialog...                   |
|                                                                    |
+-------------------------------------------------------------------*/
void HelpDialog::Init (HWND window) 
{
	/*
	 *  Get a handle for the DLL in which our resource file lives...
	 */
	HMODULE module = GetModuleHandle (JavaPartDllName);
	if (module == NULL) return;

	/*
	 *  Determine the location of the resource information within our
	 *  DLL...
	 */
	HRSRC resInfo = FindResource (
				module,           	 // resource module
				(LPCSTR) fResourceKey,   // resource name
				(LPCSTR) RT_RCDATA);	 // resource type
	if (resInfo == NULL) return;

	/*
	 *  Load the resource into global memory...
	 */
	HGLOBAL	resData = LoadResource (module, resInfo);
	if (resData == NULL) return;

	/*
	 *  Lock the resource and obtain a pointer to the first byte of the
	 *  resource...
	 */
	char *data = (char*) LockResource (resData);
	if (data == NULL) {
		data = "Error occurred: Unable to load help information...";
	}

	SetDlgItemText (window, ID_HELP_TEXT, data);
}
