Re: Forms + MS Help ?
Date: 1996/06/05
Message-ID: <4p2jdr$e9_at_gossamer.itmel.bhp.com.au>
In article <1996Jun4.053653.14268_at_van.oz.au>, tim_at_van.oz.au (Tim Nguyen) says:
> >Anyone know how to call a MS Help file from within Forms but can still >working on the called form. If I use HOST command to call the external >winhelp.exe then it won't release the control back until I close the >Help program.
ORA_FFI may let you do it - I'm not sure.
The ORA_FFI package provides a foreign function interface for invoking
C functions in a dynamic library.
DDEs would also work, provided winhelp will allow itself to called as
a server, not just a client (read up on DDEs)
Anyway, I have the following code which may be of use, using ORA_FFI. I havent tried it, so no guarantees:
FROM: Mark Mason <mmason_at_c-s-p.com>
TO: Lee levy
SUBJECT: Re: Calling winhelp from Oracle Forms 4.5.6.3.3
Here's the WINHELP package that I just implemented. I wrote a "wrapper" procedure called "CALL_WINHELP" that made the interface for my system a little easier. The rest of the unreadable code is the ora_ffi calls to the real winhelp. Sorry in advance if theres a problem. Like I say, I just got it going this morning and tried it a few times with great success.
PACKAGE WinHelp IS
FUNCTION Help_Convert(command IN VARCHAR2)
RETURN PLS_INTEGER ; PROCEDURE call_winhelp ( ls_helpFile IN varchar2, ls_command IN varchar2, ls_context IN varchar2); FUNCTION WinHelp ( hwnd IN PLS_INTEGER, lpszHelpFile IN VARCHAR2, fuCommand IN PLS_INTEGER, dwData IN PLS_INTEGER )RETURN PLS_INTEGER;
END; PACKAGE BODY WinHelp IS
lh_USER ora_ffi.libHandleType;
fh_WinHelp ora_ffi.funcHandleType;
FUNCTION Help_Convert(command IN VARCHAR2)
RETURN PLS_INTEGERIS
BEGIN
/* The windows.h definitions for command */
/* HELP_CONTEXT 0x0001 */
/* HELP_QUIT 0x0002 */
/* HELP_INDEX 0x0003 */
/* HELP_CONTENTS 0x0003 */
/* HELP_HELPONHELP 0x0004 */
/* HELP_SETINDEX 0x0005 */
/* HELP_SETCONTENTS 0x0005 */
/* HELP_CONTEXTPOPUP 0x0008 */
/* HELP_FORCEFILE 0x0009 */
/* HELP_KEY 0x0101 */
/* HELP_COMMAND 0x0102 */
/* HELP_PARTIALKEY 0x0105 */
/* HELP_MULTIKEY 0x0201 */
/* HELP_SETWINPOS 0x0203 */
if command = 'HELP_CONTEXT' then return(1); end if; if command = 'HELP_KEY' then return(257); end if; if command = 'HELP_PARTIALKEY' then return(261); end if; if command = 'HELP_QUIT' then return(2); end if; /* If nothing else go to the contents page */ return(3);END;
-- procedure call_winhelp ( ls_helpFile IN varchar2, ls_command IN varchar2, ls_context IN varchar2 ) is nRetVal PLS_INTEGER; hWnd PLS_INTEGER; htype PLS_INTEGER; ln_command PLS_INTEGER; ln_context PLS_INTEGER; BEGIN if(UPPER(SUBSTR(ls_helpFile, -3, 3)) = 'HLP') then ln_command := help_convert ( ls_command ); if ls_context is not null then ln_context := TO_PLS_INTEGER ( to_number(ls_context)); end if; hWnd := TO_PLS_INTEGER(GET_ITEM_PROPERTY(NAME_IN('SYSTEM.CURSOR_ITEM'), WINDOW_HANDLE)); nRetVal := WinHelp(hWnd, ls_helpfile, ln_command, ln_context); Message('Return value :'||TO_CHAR(nRetVal), ACKNOWLEDGE); else fp_msg('Invalid help file name: '||ls_helpFile); end if; END; FUNCTION i_WinHelp ( funcHandle IN ora_ffi.funcHandleType, hwnd IN PLS_INTEGER, lpszHelpFile IN OUT VARCHAR2, fuCommand IN PLS_INTEGER, dwData IN PLS_INTEGER ) RETURN PLS_INTEGER; PRAGMA INTERFACE(C,i_WinHelp,11265); FUNCTION WinHelp ( hwnd IN PLS_INTEGER, lpszHelpFile IN VARCHAR2, fuCommand IN PLS_INTEGER, dwData IN PLS_INTEGER ) RETURN PLS_INTEGER IS hwnd_l PLS_INTEGER := hwnd; lpszHelpFile_l VARCHAR2(512) := lpszHelpFile; fuCommand_l PLS_INTEGER := fuCommand; dwData_l PLS_INTEGER := dwData; rc PLS_INTEGER; BEGIN rc := i_WinHelp ( fh_WinHelp, hwnd_l, lpszHelpFile_l, fuCommand_l, dwData_l ); RETURN (rc); END ; BEGIN BEGIN lh_USER := ora_ffi.find_library ( 'USER.EXE' ); EXCEPTION WHEN ora_ffi.FFI_ERROR THEN lh_USER := ora_ffi.load_library ( NULL, 'USER.EXE' ); END ; fh_WinHelp := ora_ffi.register_function ( lh_USER, 'WinHelp', ora_ffi.PASCAL_STD ); ora_ffi.register_parameter ( fh_WinHelp, ORA_FFI.C_INT ); ora_ffi.register_parameter ( fh_WinHelp, ORA_FFI.C_CHAR_PTR ); ora_ffi.register_parameter ( fh_WinHelp, ORA_FFI.C_INT ); ora_ffi.register_parameter ( fh_WinHelp, ORA_FFI.C_LONG ); ora_ffi.register_return ( fh_WinHelp, ORA_FFI.C_INT ); END WinHelp; --------------------------------------------------- Lee Levy, ISSD Technical Dream Team, Del Code (34) BHP Information Technology, ACN 006 476 213 PO Box 261, Warrawong, NSW 2502, Australia PH: +61 42 75-5485 Fax: -5500 Tie: 8855- Internet : levy.lee.ls_at_bhp.com.au --------------------------------------------------- Opinions expressed are mostly my own, so give me some credit.Received on Wed Jun 05 1996 - 00:00:00 CEST