Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to show help file (chm style) in modal form?
Message
From
12/12/2003 14:08:11
 
 
To
11/12/2003 08:12:55
Michale Chen
Shijiazhuang ZhiYuan Crop.
Shijiazhuang, China
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00858051
Message ID:
00858720
Views:
12
Michale

How about:
* Set up the help file.
* The title bar of the window created by my CHM is 'My help file'
SET HELP ON
SET HELP TO myhelp.chm

* Create and show myform
LOCAL myform
myform = CREATEOBJECT('mform')
WITH myform
	.Width	= 600
	.Height	= 400
	.TitleBar	= 1
	.Caption	= 'MyForm'
ENDWITH

IF myform.Help()
	myform.Show()
ELSE
	myform.Destroy()
ENDIF


DEFINE CLASS mform AS Form

	WindowType = 1	&& Modal
	
	PROCEDURE Help
	
		* Wait when needed
		DECLARE Sleep IN Win32API INTEGER
		
		* Find a window handle
		DECLARE	INTEGER FindWindow IN user32	 ;
			STRING lpClassName		,;
			STRING lpWindowName

		* Show the help in its own window
		HELP
		
		* Wait for the help window to be displayed
		FOR t = 1 TO 3
			=Sleep(500)
			hHelp = FindWindow(0, "My help file")
			IF hHelp > 0
				EXIT
			ENDIF
		ENDFOR
		IF hHelp = 0
			=MESSAGEBOX("'My help file' can not be found", 48, "Problem")
			RETURN .F.
		ELSE
			* Size and position the help window to fit inside this form
			* so that the help title bar is obscured
			DECLARE SHORT SetWindowPos IN USER32	 ;
				INTEGER hWnd		,;
				INTEGER hWndInsertAfter	,;
				INTEGER x			,;
				INTEGER y			,;
				INTEGER cx		,;
				INTEGER cy		,;
				INTEGER uFlags
			lnAdjHeight = 27
			lnAdjWidth  = 3
			= SetWindowPos(hHelp, 0, -lnAdjWidth, -lnAdjHeight, This.Width+lnAdjWidth, This.Height+lnAdjHeight, 0)

			* Change the parent window of the help window
			DECLARE INTEGER SetParent in Win32API	 ;
					INTEGER hWndChild	,;
					INTEGER hWndNewParent
			lnRetVal = SetParent(hHelp, This.hWnd)
			IF TYPE('lnRetVal') = 'N'
				RETURN .T.
			ELSE
				RETURN .T.
			ENDIF	

		ENDIF
	ENDPROC
ENDDEFINE
If you have the 'Hide' and 'Options' available in your help file, clicking on them causes problems, but its the best I can do.

HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform