---
title: Comment créer un user exit pour Oracle Forms 9.x/10.x sous MS Windows
description: Cet article explique comment créer un user exit dans Forms 9.x/10.x.
url: https://renaps.com/fr/blog/forms-and-java/how-to-create-a-user-exit-for-oracle-forms-9x10x-running-on-ms-windows
language: fr
translations:
  en: https://renaps.com/en/blog/forms-and-java/how-to-create-a-user-exit-for-oracle-forms-9x10x-running-on-ms-windows
date: 2017-09-11
updated: 2024-01-15
author: Patrick Hamou
tags:
- Oracle Forms
- Microsoft Windows
- Forms Builder
---

# Comment créer un user exit pour Oracle Forms 9.x/10.x sous MS Windows

## OBJECTIF

Cet article explique comment créer un user exit dans Forms 9.x/10.x.

## Hypothèses

Votre IDS est installé dans d:\\ids

et votre répertoire de travail est e:\\dd\\userexit

Copiez tous les fichiers de d:\\ids\\forms90\\userexit vers e:\\dd\\userexit

ou

Copiez tous les fichiers de d:\\ids\\forms\\userexit vers e:\\dd\\userexit

1\. Créez un fichier

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\. Créez le fichier ue\_xtb.c avec le contenu suivant,

en remplaçant le fichier existant

```
#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\. Compilez le fichier pro\*c avec pro\*c 9.0.1.3 ou 10.1.4.2/10.1.5

```
d:\ids\bin\proc first.pc
```

4\. Créez un fichier ue\_samp.def

en remplaçant le fichier existant

```
; 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\.

Ouvrez VC++ 6.0, 5.0 ou 4.2.

Créez un nouvel espace de travail avec le type de projet Win32 Dynamic Link Libary.

Ajoutez les fichiers suivants à la bibliothèque.

```
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
```

ou

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

Compilez ce projet.

Testez maintenant cette application.

6\. Ouvrez le fichier default.env et

ajoutez la ligne suivante à la fin,

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

ou

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

Redémarrez ensuite le conteneur OC4J et créez un formulaire

avec

un bloc basé sur EMP (bloc à un seul enregistrement) et un élément texte

hors table de base nommé COMMENT.

Ajoutez le code suivant au déclencheur when-validate-item de empno.

```
user_exit('FIRST');
```

## Informations complémentaires

Si vous utilisez VC++7 pour créer la DLL, cela ne fonctionnera pas

Causes possibles :

1\) VC++7 peut altérer la structure des noms de fonctions

2\) VC++7 peut compiler la DLL en mode C++

La version testée sous Windows est VC++6. Aucun test n'a été fait avec VC++7.
