This discussion is archived
0 Replies Latest reply: Mar 20, 2013 2:53 AM by Aver RSS

WEBUTIL_C_API work different than ORA_FFI

Aver Explorer
Currently Being Moderated
Hello!
I try to move my ORA_FFI code from Forms 6i to WEBUTIL_C_API code in Forms 10g.
This is a ORA_FFI code:
----------------------------------------START----------------------------------------
FUNCTION ACQUIRE_TO_MULTIFILE (P_FILE_NAME VARCHAR2) RETURN PLS_INTEGER IS
L_WIN_H VARCHAR2(2000) := NULL;
BEGIN
     /* Register the foreign function */
     LP_ACQUIRE := ORA_FFI.REGISTER_FUNCTION(scan_load_dll.EZ_LIB, 'TWAIN_AcquireMultipageFile', ORA_FFI.C_STD);
     
     /* Register both parameters of function */
     ORA_FFI.REGISTER_PARAMETER(LP_ACQUIRE, ORA_FFI.C_CHAR_PTR);
     ORA_FFI.REGISTER_PARAMETER(LP_ACQUIRE, ORA_FFI.C_CHAR_PTR);
     
     /* Register the return type */
     ORA_FFI.REGISTER_RETURN(LP_ACQUIRE, ORA_FFI.C_INT);
          
     /* invoke the C function TWAIN_AcquireMultipageFile from eztwain3.dll */
     L_RES_INT := FF_ACQUIRE(LP_ACQUIRE, L_WIN_H, P_FILE_NAME);
     
     RETURN(L_RES_INT);
EXCEPTION
WHEN OTHERS THEN
FOR i IN 1..Tool_Err.NErrors LOOP
MESSAGE(Tool_Err.Message);
PAUSE;
Tool_Err.Pop;
END LOOP;
END;
----------------------------------------END----------------------------------------

This is a WEBUTIL_C_API code:
----------------------------------------START----------------------------------------
FUNCTION ACQUIRE_TO_MULTIFILE (P_FILE_NAME VARCHAR2) RETURN PLS_INTEGER IS
L_WIN_H PLS_INTEGER := NULL;--GET_HWND;
L_PARAM1 WEBUTIL_C_API.PARAMETERHANDLE;
L_PARAM2 WEBUTIL_C_API.PARAMETERHANDLE;
BEGIN
     LP_FHANDLE := WEBUTIL_C_API.register_function(scan_load_dll.EZ_LIB,'TWAIN_AcquireMultipageFile');

     /* Create parameter list */
     LP_PLIST := WEBUTIL_C_API.CREATE_PARAMETER_LIST;

     /* Register both parameters of function */
     L_PARAM1 := WEBUTIL_C_API.ADD_PARAMETER(LP_PLIST,
                                             WEBUTIL_C_API.C_INT,
                                             WEBUTIL_C_API.PARAM_IN,
                                             L_WIN_H);      

     L_PARAM2 := WEBUTIL_C_API.ADD_PARAMETER(LP_PLIST,
                                             WEBUTIL_C_API.C_CHAR_PTR,
                                             WEBUTIL_C_API.PARAM_IN,
                                             P_FILE_NAME,
255);
     
     /* invoke the C function TWAIN_AcquireMultipageFile from eztwain3.dll */
     L_RES_INT := WEBUTIL_C_API.INVOKE_LONG(scan_load_dll.EZ_LIB,'TWAIN_AcquireMultipageFile',LP_PLIST);
     
     WEBUTIL_C_API.Destroy_Parameter_List(LP_PLIST);
     WEBUTIL_C_API.Deregister_Function(LP_FHANDLE);                                                                                     
     
     RETURN(L_RES_INT);
EXCEPTION
WHEN OTHERS THEN
FOR i IN 1..Tool_Err.NErrors LOOP
MESSAGE(Tool_Err.Message);
PAUSE;
Tool_Err.Pop;
END LOOP;
END;
----------------------------------------END----------------------------------------

When i run WEBUTIL_C_API code i get an exception:
ERROR>WUL-923 [WEBUTIL_C_API.ADD_PARAMETER] Missing or invalid value for parameters PARAM_IN or PARAM_INOUT

ORA_FFI code is working fine.

What can be a problem?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points