How to Create a User Exit For Oracle Forms 9.x/10.x Running on MS Windows

How to Create a User Exit For Oracle Forms 9.x/10.x Running on MS Windows

How to Create a User Exit For Oracle Forms 9.x/10.x Running on MS Windows

Titleimage

Posted by Patrick Hamou on 2017:09:11 17:55:43

PURPOSE

This article explains how to create the user exit in Forms 9.x/10.x.

Assumptions

Your IDS is installed in d:\ids

and your working directory is e:\dd\userexit

Copy all the files from d:\ids\forms90\userexit to e:\dd\userexit

or

Copy all the files from d:\ids\forms\userexit to e:\dd\userexit

 

1. Create a file

first.pc

#include 
#include 

EXEC SQL BEGIN DECLARE SECTION;

EXEC SQL END DECLARE SECTION;


EXEC SQL INCLUDE SQLCA;

first()

   {
      EXEC SQL WHENEVER SQLERROR STOP;

          EXEC IAF PUT EMP.COMMENT values ('Sample User Exit ');
          MessageBox(NULL,"Sample User Exit","Result",MB_OK);

          return (0);


   }

 

2. Create ue_xtb.c file with the following ,

Overwrite the previous file

#ifndef UE
# include "ue.h"
#endif /* UE */

#include "ue_samp.h"

int  first();

/* Define the user exit table */

exitr iapxtb[] =  {  /* Holds exit routine pointers */
   "FIRST", first, XITCC,
     (char *) 0, 0, 0         /* zero entry marks the end */
}; /* end iapxtb */

 

 

3.  Compile the pro*c file using pro*c 9.0.1.3 or 10.1.4.2/10.1.5

d:\ids\bin\proc first.pc

 

4. Create a  ue_samp.def file

Overwrite the previous file

; Copyright (c) ORACLE Corporation 1995.  All rights reserved 
; 
; NAME 
;   UE_SAMP.DEF 
; FUNCTION 
;   Definition file for UE_SAMP.DEF 
; NOTES 
;   Contains Oracle Forms User Exit Exports 
; 

DESCRIPTION   'Oracle FORMS user eXit TaBle: Copyright (c) Oracle Corporation 
1995.  All rights reserved.'

LIBRARY       first
 
 
EXPORTS 
; DO NOT alter these export statements in any way! 
        _UELOCATEB=ueLocateB            @1
        _UELOCATEP=ueLocateP            @2
        ueReportsExecute                @3
        ueGraphicsExecute               @4
        _UEFORMSEXECUTE=ueFormsExecute  @5
; DO NOT alter these export statements in any way! 
; Please begin your exports AFTER 100. We reserve the right to use @1-@100. 
 
       first                                   @101 

 

5.

Open VC++ 6.0 or 5.0 or 4.2.

Create a new workspace with the Project type as Win32 Dynamic Link Libary.

Add the following files to the libary.

e:\dd\userexit\first.c
e:\dd\userexit\ue_xtb.c
e:\dd\userexit\uez.obj
e:\dd\\userexit\ue_samp.def 

d:\ids9i\forms90\userexit\ifw90.lib
D:\ids9i\precomp\LIB\msvc\oraSQL9.LIB
D:\ids9i\precomp\LIB\msvc\oraSQX9.LIB

or

d:\ids\forms\userexit\frm.lib
D:\ids\precomp\LIB\msvc\oraSQL.LIB
D:\ids\precomp\LIB\msvc\oraSQX.LIB

Compile this project.

And now test this application.

 

6. Open the default.env file and

Add the following to the last line ,

FORMS90_USEREXITS=D:\ids\forms90\userexit\test.dll

or

FORMS_USEREXITS=D:\ids\forms\userexit\test.dll

After this restart the OC4J container and create a form

with

Create a block based on EMP (single row block) and a non base table

text item with the name as COMMENT.

 

Add the following trigger to when-validate-item on empno with the following code.

user_exit('FIRST');

 

Additional information

If using the VC++7 to create the DLL. It wont work

The reason could be

1) It may be messing up the function name structure

2) It may be using the C++ mode to compile the DLL

 

The tested version on Windows is VC++6. It was no tested with VC++7.

Posted by Patrick Hamou on 2017:09:11 17:55:43

Return to Blog