ORA_FFI.LOAD_LIBRARY

Dear Oracle friends
I'm new to using of ORA_FFI package
I have a code which is doind an open ORA_FFI.LOAD_LIBRARY the name and path are ok
I'm getting ORA-304500 ?? please help ??
Thanks

ORA_FFI is a Forms library. Consequently you would be better off asking the question in Forms.
Cheers, APC
blog: http://radiofreetooting.blogspot.com

Similar Messages

  • Convert ORA_FFI to WEBUTIL_C_API to print locally

    I am trying to figure out how to convert this package to WEBUTIL_C_API to be able to print to a users local printer (EPSON slip printer)... ANY help would be appreciated...
    PACKAGE EPSON_SLIP_PRINTER_INTERFACE IS
    * This package provides functions to interact with the EPSON
    * TM-U295 slip printers.
    * The OPEN_PRINTER function must be called to obtain a printer ID.
    * This printer ID can then be used when calling other functions
    * that require a printer to be specified.
    * NOTE that the printer ID is only valid within the same thread
    * that called the OPEN_PRINTER function.
    * Brendan Rickey 2004-JAN-09
    -- AVAILABLE PRINTERS
    CHEQUE_PRINTER     VARCHAR2(50) := 'Generic / Text Only droite';
    INVOICE_PRINTER     VARCHAR2(50) := 'Generic / Text Only left';
    -- ERROR CODES
    -- Some of the provided functions return a NUMBER value that may hold
    -- an error code (negative number).
    -- These are the possible error codes:
    SUCCESS                    NUMBER := 0;     --no error
    ERR_TYPE               NUMBER := -10;     --parameter type error
    ERR_OPENED               NUMBER := -20; --printer already opened
    ERR_NO_PRINTER     NUMBER := -30;     --the printer driver does not exist
    ERR_NO_TARGET          NUMBER := -40;     --no printer found (could of off, faulty, unsupported)
    ERR_NO_MEMORY          NUMBER := -50;     --insufficient memory
    ERR_HANDLE               NUMBER := -60;     --invalid printer ID
    ERR_TIMEOUT               NUMBER := -70;     --time out error
    ERR_ACCESS               NUMBER := -80;     --cannot read/write to printer (printing in progress)
    ERR_PARAM               NUMBER := -90;     --parameter error
    ERR_OFFLINE               NUMBER := -110;     --printer was opened in offline state.  Status must be changed to online.
    ERR_NOT_EPSON          NUMBER := -120;     --printer is not an EPSON printer
    * INITIALIZE
    * Initializes the interface between Forms and the EPSON library (call before any other function in the package).
    * Returns:
    * TRUE if the library is registered successfully,
    * FALSE otherwise (library not found etc...)
    function INITIALIZE return BOOLEAN;
    * OPEN_PRINTER
    * Obtains a handle on the specified EPSON slip printer (either CHEQUE_PRINTER or INVOICE_PRINTER).
    * Returns:
    *           a printer ID for the specified printer (greater than 0)
    *           an error code on failure (less than 0):
    * ERR_TYPE, ERR_OPENED, ERR_NO_PRINTER, ERR_NO_TARGET, ERR_NO_MEMORY, ERR_PARAM
    function OPEN_PRINTER (p_printer_name IN VARCHAR2) return NUMBER;
    * CLOSE_PRINTER
    * Releases the handle on the specified printer.
    * Returns:
    *           0 on success
    *           ERR_HANDLE on failure
    function CLOSE_PRINTER (p_printer_id IN NUMBER) return NUMBER;
    * IS_PAPER_OUT
    * Tests if there is no paper in the printer.
    * Returns:
    *           1 if there is no paper in the printer, 0 if paper is in the printer
    *           ERR_HANDLE or ERR_PARAM on failure.
    function IS_PAPER_OUT (p_printer_id IN NUMBER) return NUMBER;
    * PRINT_TEXT
    * Prints the specified text to the specified printer.
    * Returns:
    *           0 on success
    *           ERR_HANDLE, ERR_ACCESS, ERR_OFFLINE, ERR_NOT_EPSON, or ERR_PARAM on failure.
    function PRINT_TEXT (p_printer_id IN NUMBER, p_text IN VARCHAR2) return NUMBER;
    * RELEASE_PAPER
    * Performs the Release function on the specified printer.
    * Returns:
    *           0 on success
    *           ERR_HANDLE, ERR_ACCESS, ERR_OFFLINE, ERR_NOT_EPSON, or ERR_PARAM on failure.
    function RELEASE_PAPER (p_printer_id IN NUMBER) return NUMBER;
    /* PRIVATE FUNCTIONS
    function BiOpenMonPrinter(arg0 in PLS_INTEGER,
    arg1 in out VARCHAR2)
    return PLS_INTEGER;
    function BiCloseMonPrinter(arg0 in PLS_INTEGER)
    return PLS_INTEGER;
    function BiGetStatus(arg0 in PLS_INTEGER,
    arg1 in out PLS_INTEGER)
    return PLS_INTEGER;
    function BiDirectIO(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER)
    return PLS_INTEGER;
    function BiDirectIOEx(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER,
    arg7 in PLS_INTEGER)
    return PLS_INTEGER;
    END;
    PACKAGE BODY EPSON_SLIP_PRINTER_INTERFACE IS
    v_msg_b VARCHAR2(20);
    v_EPSON_LIBRARY_OK BOOLEAN:= FALSE;
    --ORA_FFI function handles and library handle
    lh_EpsStmApi ora_ffi.libHandleType;                    --DLL library handle
    fh_BiOpenMonPrinter ora_ffi.funcHandleType;          --DLL function handle
    fh_BiCloseMonPrinter ora_ffi.funcHandleType;     --DLL function handle
    fh_BiGetStatus ora_ffi.funcHandleType;               --DLL function handle
    fh_BiDirectIO ora_ffi.funcHandleType;               --DLL function handle
    fh_BiDirectIOEx ora_ffi.funcHandleType;               --DLL function handle
    --constant
    ASB_SLIP_BOF     PLS_INTEGER := 4*power(16,5);     --BOF printer status flag 0x00400000
    c_release_code      CHAR(2) := CHR(27)||CHR(113);     --ESC+q, to release the paper
    -------PRIVATE FUNCTIONS--------
    * Brendan Rickey 2004-JAN-09
    * The following are functions that are required to interface with the
    * EPSON StatusAPI DLL (C library) though ORA_FFI.
    * The following describes the DLL functions that are made available
    * through this ORA_FFI implementation:
    Function Purpose
    BiOpenMonPrinter Get a handle on a printer.
    Parameters
    p_Type --int: 1 if p_Name is a port, 2 if a printer name.
    ,p_Name --varchar2: the port of printer name to open.
    Return printer identifier number (>0) on success, < 0 on failure.
    BiCloseMonPrinter Close the monitor on the printer.
    Parameters
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    Return 0 on success, < 0 on failure.
    BiGetStatus Returns the status of the printer.
    Parameters     
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    ,p_Status OUT --long: The status of the printer (use AND bitwise operator to test for statuses).
    Return 0 on success, < 0 on failure.
    BiDirectIO Sends data to and Reads data from the printer. Use BiDirectIOEx if more that 255 chars are to be written/read.
    Parameters
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    ,p_WriteLen --short: The length of the command/data being sent to the printer (max 255).
    ,p_WriteCmd --varchar2: The command/data to send to the printer.
    ,p_ReadLen --short: The length of the data to be read from the printer (max 255)
    (Use 0 if no data is to be read).
    ,p_ReadBuff OUT --varchar2: The buffer where the the data read from the printer is stored.
    ,p_Timeout --long: write/read time out in msecs.
    ,p_NullTerminate --short: 0 => reading of data from printer is performed until time out or length of p_ReadLen is reached.
    1 => reading is finished at thepoint when a NULL is received from the printer. ReadLen must have a value.
    Return 0 on success, < 0 on failure.
    BiDirectIOEx Sends data to and Reads data from the printer (handles larger quantities of write/read data).
    Parameters
    p_Handle --int: The numerical printer handle returned from BiOpenMonPrinter.
    ,p_WriteLen --long: The length of the command/data being sent to the printer.
    ,p_WriteCmd --varchar2: The command/data to send to the printer.
    ,p_ReadLen --long: The length of the data to be read from the printer (Use 0 if no data is to be read).
    ,p_ReadBuff OUT --varchar2: The buffer where the the data read from the printer is stored.
    ,p_Timeout --long: write/read time out in msecs.
    ,p_NullTerminate --short: 0 => reading of data from printer is performed until time out or length of p_ReadLen is reached.
    1 => reading is finished at thepoint when a NULL is received from the printer. ReadLen must have a value.
    ,p_Option --short: 0 => prevents Automatic Status Back (ASB) during execution of this function (as does BiDirectIO).
    1 => does not disable Automatic Status Back (ASB).
    Return 0 on success, < 0 on failure.
    function icd_BiOpenMonPrinter(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in out VARCHAR2)
    return PLS_INTEGER;
    pragma interface(c, icd_BiOpenMonPrinter, 11265);
    function BiOpenMonPrinter(arg0 in PLS_INTEGER,
    arg1 in out VARCHAR2)
    return PLS_INTEGER is
    begin
    return(icd_BiOpenMonPrinter(fh_BiOpenMonPrinter,
    arg0,
    arg1));
    end;
    function icd_BiCloseMonPrinter(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiCloseMonPrinter, 11265);
    function BiCloseMonPrinter(arg0 in PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiCloseMonPrinter(fh_BiCloseMonPrinter,
    arg0));
    end;
    function icd_BiGetStatus(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in out PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiGetStatus, 11265);
    function BiGetStatus(arg0 in PLS_INTEGER,
    arg1 in out PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiGetStatus(fh_BiGetStatus,
    arg0,
    arg1));
    end;
    function icd_BiDirectIO(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiDirectIO, 11265);
    function BiDirectIO(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiDirectIO(fh_BiDirectIO,
    arg0,
    arg1,
    arg2,
    arg3,
    arg4,
    arg5,
    arg6));
    end;
    function icd_BiDirectIOEx(funcHandle in ora_ffi.funcHandleType, arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER,
    arg7 in PLS_INTEGER)
    return PLS_INTEGER;
    pragma interface(c, icd_BiDirectIOEx, 11265);
    function BiDirectIOEx(arg0 in PLS_INTEGER,
    arg1 in PLS_INTEGER,
    arg2 in out VARCHAR2,
    arg3 in out PLS_INTEGER,
    arg4 in out VARCHAR2,
    arg5 in PLS_INTEGER,
    arg6 in PLS_INTEGER,
    arg7 in PLS_INTEGER)
    return PLS_INTEGER is
    begin
    return(icd_BiDirectIOEx(fh_BiDirectIOEx,
    arg0,
    arg1,
    arg2,
    arg3,
    arg4,
    arg5,
    arg6,
    arg7));
    end;
    --------PUBLIC FUNCTIONS--------
    function INITIALIZE return BOOLEAN IS
    BEGIN
    --When this is the first package function called, code in the package's
    --body is executed and sets v_EPSON_LIBRARY_OK.
    RETURN v_EPSON_LIBRARY_OK;
    END;
    function OPEN_PRINTER (p_printer_name IN VARCHAR2) return NUMBER IS
         v_printer                    PLS_INTEGER;
         v_printer_name     VARCHAR2(50) := p_printer_name;
         v_name_type           PLS_INTEGER := 2; --use printer Name to specify printer     
    BEGIN
         /* Open a monitor for the printer */
         v_printer := BiOpenMonPrinter(v_name_type,v_printer_name);
         RETURN v_printer;
    END;
    function CLOSE_PRINTER (p_printer_id IN NUMBER) return NUMBER IS
    v_return PLS_INTEGER;
    BEGIN
    /* CLOSE the printer monitor */
         v_return := BiCloseMonPrinter(p_printer_id);
         RETURN v_return;
    END;
    function IS_PAPER_OUT (p_printer_id IN NUMBER) return NUMBER IS
         v_return          PLS_INTEGER;
         v_status          PLS_INTEGER := -123456;
    BEGIN
         /* Test if paper is in the printer by first getting the status (a binary integer) */
         v_return := BiGetStatus(p_printer_id,v_status);
         IF v_return <> 0 THEN
              RETURN v_return;
         ELSE
         --Test for BOF status flag
         IF WIN_API_BITOP.BITWISE_AND(v_status,ASB_SLIP_BOF) = ASB_SLIP_BOF THEN
              RETURN 1; --paper out
         ELSE
              RETURN 0; --paper in
         END IF;
         END IF;
    END;
    function PRINT_TEXT (p_printer_id IN NUMBER, p_text IN VARCHAR2) return NUMBER IS
    v_return          PLS_INTEGER;
    v_text               VARCHAR2(2000) := p_text;
    v_text_len          PLS_INTEGER;                    --number of characters to be printed
    v_read_len      PLS_INTEGER := 0;               --number of characters to be read from the printer
    v_read_buff      VARCHAR2(255) := NULL;          --not used: holds characters read from the printer
    v_timeout      PLS_INTEGER := 1000;          --not used: amount of time to wait for response (msecs)
         v_nullTerm          PLS_INTEGER := 0;               --not used: 0 means read until reached v_read_len or v_timeout
         -- 1 means read until NULL received from printer
         v_option          PLS_INTEGER := 0;           --0 means do not answer other requests while printing
                                                                --1 means do not stop answering other requests while printing
    BEGIN
         --Get the number of chars to be printed and then print.
         v_text_len := length(p_text);
         v_return := BiDirectIOEx(p_printer_id,
         v_text_len,
         v_text,
         v_read_len,
         v_read_buff,
         v_timeout,
         v_nullTerm,
         v_option);
         --Ignore timeout(-70) errors, otherwise return error
         IF v_return = -70 THEN
              v_return := 0;     
         END IF;
         RETURN v_return;
    END;
    function RELEASE_PAPER (p_printer_id IN NUMBER) return NUMBER IS
    BEGIN
    /* Release the paper by sending the release escape code to the printer */
         RETURN PRINT_TEXT(p_printer_id, c_release_code);
    END;
    -----END OF FUNCTION IMPLEMENTATIONS-----
    BEGIN
    * Load the EPSON printer driver's StatusAPI library.
    * Create an ORA_FFI interface to the library by doing the following for each desired function:
    *          1- Create a handle on the function,
    *          2- Register the return value,
    *          3- Register the arguments/parameters in the correct order.
    lh_EpsStmApi := ora_ffi.load_library('', 'EpsStmApi.DLL');
    IF Ora_Ffi.Is_Null_Ptr(lh_EpsStmApi) THEN
         AFC_MESSAGES('I','MAIN-0020','E',v_msg_b);
         v_EPSON_LIBRARY_OK := FALSE;
    ELSE
    fh_BiOpenMonPrinter := ora_ffi.register_function(lh_EpsStmApi, 'BiOpenMonPrinter', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiOpenMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiOpenMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiOpenMonPrinter, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    fh_BiCloseMonPrinter := ora_ffi.register_function(lh_EpsStmApi, 'BiCloseMonPrinter', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiCloseMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiCloseMonPrinter, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    fh_BiGetStatus := ora_ffi.register_function(lh_EpsStmApi, 'BiGetStatus', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiGetStatus, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiGetStatus, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiGetStatus, ora_ffi.c_long_ptr, ora_ffi.pls_pls_integer);
    fh_BiDirectIO := ora_ffi.register_function(lh_EpsStmApi, 'BiDirectIO', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiDirectIO, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_short_ptr, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_long, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIO, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    fh_BiDirectIOEx := ora_ffi.register_function(lh_EpsStmApi, 'BiDirectIOEx', ora_ffi.c_std);
    ora_ffi.register_return(fh_BiDirectIOEx, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_int, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_long, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_long_ptr, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_char_ptr, ora_ffi.pls_varchar2);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_long, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    ora_ffi.register_parameter(fh_BiDirectIOEx, ora_ffi.c_short, ora_ffi.pls_pls_integer);
    v_EPSON_LIBRARY_OK := TRUE;
    END IF;
    EXCEPTION
         WHEN OTHERS THEN
              AFC_MESSAGES('I','MAIN-0021','E',v_msg_b);
              v_EPSON_LIBRARY_OK := FALSE;
    END;

    Hi Duncan,
    Thanks for the response. Beyond the problem you pointed out I found that the "open server" command is requiring a window handle parameter, even though it isn't used by the program. I talked with Oracle Support and it turns out that even if the window handle isn't used, it's existence makes it not work with the current version of webutil.
    The program I am working with also has a COM interface, so I decided to back up and redo the interface using webutil OLE2. I've got it working now, just a little more polishing to do.
    Thanks again for the help.
    Mark

  • Problem with ora_ffi

    Hi all
    I would know the current directory in my application with the employement of ora_ffi and I meet some problem like the return code not give the good result.
    I have whrite this code and I would know where is the error :
    PACKAGE BODY pkg_get_directory IS
              Libdirectory_lhandle Ora_Ffi.Libhandletype ;
    to_dir_fhandle Ora_Ffi.Funchandletype ;
    FUNCTION ff_to_dir(fhandle Ora_Ffi.Funchandletype,bufsz in number,lppath in out varchar2) RETURN NUMBER;
    PRAGMA interface(C, ff_to_dir, 11265);
    FUNCTION GetCurrentDirectory(bufsz in out number,lppath in out varchar2) RETURN NUMBER IS
    BEGIN
         RETURN(ff_to_dir(to_dir_fhandle,bufsz,lppath));
    END GetCurrentDirectory;
    BEGIN
         Libdirectory_lhandle := Ora_Ffi.Load_Library('C:\WINNT\SYSTEM32\','KERNEL32.dll');
         to_dir_fhandle := Ora_Ffi.Register_Function(Libdirectory_lhandle, 'GetCurrentDirectoryW', Ora_Ffi.C_Std);     
              Ora_Ffi.Register_Parameter(to_dir_fhandle, Ora_Ffi.C_DOUBLE_PTR);
              Ora_Ffi.Register_Parameter(to_dir_fhandle, Ora_Ffi.C_CHAR_PTR);
              Ora_Ffi.Register_Return(to_dir_fhandle, Ora_Ffi.C_DOUBLE);
    END;

    Noticed that I forgot to include the error. It comes from the "message" call I put in the exception block and reads:
    'Failure func_31_param: p31. Fatal Error: 304500: non-ORACLE exception'
    That 304500 isn't particularly informative. I've seen other posts of people getting this exception from ora_ffi.load_library

  • ORA_FFI Package

    I'm not familait with 'ORA_FFI' can someone give hi-level highlights of the 3 main functions and what do they do (ORA_FFI.LOAD_LIBRARY,ORA_FFI.REGISTER_FUNCTION,ORA_FFI.REGISTER_PARAMETER)
    Also a link for more details will be appreciated
    “ libhandle := ORA_FFI.LOAD_LIBRARY(dirname, libname);
    funchandle := ORA_FFI.REGISTER_FUNCTION(libhandle,'purchase',ORA_FFI.C_STD);
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --id
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --plan
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --v3careercreatedate
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --jurisdiction
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --membertype
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --transdate
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_INT_PTR); --warning
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --warningmsg
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_INT_PTR); --error
    ORA_FFI.REGISTER_PARAMETER(funchandle,ORA_FFI.C_CHAR_PTR); --msg

    I found a link
    http://www.oracle.com/webapps/online-help/reports/10.1.2/state/content/navId.3/navSetId._/vtTopicFile.htmlhelp_rwbuild_hs%7Crwrefex%7Cplsql%7Cbuiltins%7Coraffi%7Cpkg_ffi%7Ehtm/

  • Forms 11g: limit of 30 calls to ora_ffi.register_function

    Converting from Forms 10.2 to Forms 11.1.2 (and a 10g App Server to WebLogic 10.3.5) encountering a problem with ORA_FFI references to functions that have more than 30 parameters.
    The 31st call to ora_ffi.register_parameter for a function always fails.
    The code snippet below is from a sample I built to illustrate the problem to someone else. We have a similar library in our production code that registers many functions. Some of the functions have more than 30 paramteres some have less. No matter what order I register the functions in, the failiure always occurs in the first function to have a 31st parameter registered against it. All functions with 30 or fewer parameters register just fine.
    no problems loading the library of registering the first function, the return, or the parameters (only 3 parameters)
    also can register the second function, the return, and the first 30 parameters
    <pre>
    PACKAGE BODY TEST_FFI IS
    dbug_msg VARCHAR2(100);
    dll_loaded boolean := false;
    lh_dll_handle ORA_FFI.LIBHANDLETYPE;
    fh_short_list ORA_FFI.FUNCHANDLETYPE;
    fh_long_list ORA_FFI.FUNCHANDLETYPE;
    PROCEDURE init_ffi IS
    BEGIN
    if (dll_loaded) then
    message('success');
    else
    message('fail');
    end if;
    END init_ffi;
    BEGIN
    dbug_msg := 'load liboraffi.so';
    lh_dll_handle := ora_ffi.load_library (null, 'liboraffi.so');
    -- 3 Parameters
    dbug_msg := 'func_3_param: function';
    fh_short_list := ora_ffi.register_function (lh_dll_handle, 'func_3_param', ora_ffi.C_STD);
    dbug_msg := 'func_3_param: return';
    ora_ffi.register_return(fh_short_list, ora_ffi.c_long);
    dbug_msg := 'func_3_param: p1';
    ora_ffi.register_parameter(fh_short_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_3_param: p2';
    ora_ffi.register_parameter(fh_short_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_3_param: p3';
    ora_ffi.register_parameter(fh_short_list, ora_ffi.c_char_ptr);
    -- 31 Parameters
    dbug_msg := 'func_31_param: function';
    fh_long_list := ora_ffi.register_function (lh_dll_handle, 'func_31_param', ora_ffi.C_STD);
    dbug_msg := 'func_31_param: return';
    ora_ffi.register_return(fh_long_list, ora_ffi.c_long);
    dbug_msg := 'func_31_param: p1';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p2';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p3';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p4';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p5';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p6';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p7';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p8';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p9';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p10';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p11';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p12';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p13';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p14';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p15';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p16';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p17';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p18';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p19';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p20';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p21';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p22';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p23';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p24';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p25';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p26';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p27';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p28';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p29';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p30';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dbug_msg := 'func_31_param: p31';
    ora_ffi.register_parameter(fh_long_list, ora_ffi.c_char_ptr);
    dll_loaded := true;
    EXCEPTION
    WHEN OTHERS THEN
    message ('Failure ' || dbug_msg || '. Fatal Error: ' || sqlerrm);
    dll_loaded := false;
    raise;
    END test_ffi;
    </pre>

    Noticed that I forgot to include the error. It comes from the "message" call I put in the exception block and reads:
    'Failure func_31_param: p31. Fatal Error: 304500: non-ORACLE exception'
    That 304500 isn't particularly informative. I've seen other posts of people getting this exception from ora_ffi.load_library

  • How to use a custom.dll in forms 6i

    Hi,
    i have made a small dll using a icon-making software, that software has made a .dll of the icon I made in that software
    Now i want to use that .dll in my forms 6i. (client/server)
    the dll contains only one icon named 'Icon1'
    would any one please tell me how can I call that icon in that .dll to view in my forms button at run time..
    is this possible..??
    just for clarification, for security reasons I am not using the .ico of that icon diect from hardisk in my button thats why i made a .dll of that so that the user may not be able copy my icon
    thanks in advance,

    Here is the doc
    Doc ID:      Note:99824.1
    Subject:      How to Display User-Defined Cursors and Icons in Forms
    Type:      BULLETIN
    Status:      PUBLISHED
         Content Type:      TEXT/X-HTML
    Creation Date:      23-FEB-2000
    Last Revision Date:      30-OCT-2002
    PURPOSE
    The purpose of this note is to explain how to display customized
    cursors and icons in Forms 6.0 on Windows platform (32 bits).
    Assumption is made that resources are stored in a DLL, which is
    available in the path at runtime.
    It is mandatory to store the cursor in a DLL to make it available
    with Forms: .cur cursor files cannot be directly loaded from the
    file system.
    On the other hand, icons .cio files can directly be read from the
    filesystem by Forms Runtime. However we will focus on icons which are
    stored in a DLL.
    The article is divided into two main parts:
    - how to build a resource-only DLL with Visual C++ 5.0
    - how to display the cursor and the icon in Forms 6.0
    SCOPE & APPLICATION
    The intended audience needs to have basic knowledge in Forms Builder
    and also in Visual C++ (or any other Win32 compiler).
    A typical environment is Forms 6.0, Visual C++ 5.0 and Windows NT.
    WHAT IS A RESOURCE ?
    A resource can be considered as some extra binary information that can
    be added to an executable file. Windows resources are for example icons,
    cursors, menus, dialog boxes, keyboard-accelerator tables and much more.
    Resources are usually stored in a .rc file, which is compiled by the
    resource compiler in order to provide a .res file. These compiled resources
    can then be appended to a binary executable file or a DLL.
    For instance, Visual C++ 5.0 includes a resource editor which allows you to
    draw your icons and your cursors, and store them in a resource file.
    Part I - BUILDING A RESOURCE-ONLY DLL
    Consider the following setup:
    - myicon.ico: icon file
    - mycur.cur: cursor file
    The objective of this section is to build a DLL called proj.dll which
    contains both the icon and the cursor. This operation requires several steps.
    Step 1: Create a project
    In Visual C++, select menu File->New... In the dialog box, choose the Projects
    tab and pick "Win32 Dynamic Link-Library". Fill the project name (e.g. Proj)
    and the location (e.g. c:\MyProjects). Check 'Create new workspace', check
    Win32 as target platform and click on OK.
    This creates a directory c:\MyProjects\Proj, where necessary .rc and .cpp
    files can be stored. Place the .ico and .cur files in this directory too.
    Step 2: Add a resource file to the project
    Create a proj.rc file, edit it and make sure it contains the following lines:
    testcur CURSOR DISCARDABLE "mycur.cur"
    testico ICON DISCARDABLE "myicon.ico"
    This is the resource file. Using the Project->Add to Project->Files... menu,
    select the proj.rc file and add it to the current project.
    Step 3: Add a dummy C++ file to the project
    Create a proj.cpp file, edit it and make sure it contains the following lines:
    #include <windows.h>
    extern "C"
    BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
         return 1;
    This creates an entry-point in the DLL. This function does nothing but is mandatory
    to have a DLL after the build of the project.
    Add the proj.cpp file to the project as described in Step 2.
    Step 4: Choose the target type
    At this moment, you can choose if you need a 'DEBUG' or a 'RELEASE' flavour of
    the DLL. As there is not much to debug in this DLL, the 'RELEASE' flavour is
    recommended. Furthermore, it is much more compact.
    Using the Build->Set Active Configuration... menu, choose the Proj - Win32 Release
    as the active configuration.
    Step 5: Build the DLL
    Now, it is time to compile the resource file, compile the C++ file, link both
    together and build the proj.dll DLL. This operation is performed by using the
    Build->Rebuild All menu.
    After a short time, you should see "Proj.dll - 0 error(s), 0 warning(s)" in
    the Visual C++ message window. This means that the DLL was built successfully.
    Step 6: Place the DLL in the appropriate directory
    The proj.dll file is currently located under the c:\MyProjects\Proj\Release
    directory. Copy it in an appropriate directory which is reachable in the
    runtime environment path.
    Part II - USING THE ICON AND CURSOR IN THE FORM
    At this stage the DLL is created and can be used in the Form application.
    Again, this is a multi-step procedure.
    Step 1: Load the DLL in the Forms Runtime environment
    Assuming the proj.dll DLL is placed in a directory pointed by the
    PATH environment variable, below is the piece of PL/SQL code which loads
    the DLL into the Forms Runtime environment. This code can be placed in the
    WHEN-NEW-FORM-INSTANCE trigger for example:
    declare
         hDLL     ORA_FFI.LIBHANDLETYPE;
    begin break;
         --Preload the DLL so the cursor and Icons can be found.
         -- I'm assuming the DLL is in the path here
         hDLL := ORA_FFI.LOAD_LIBRARY(NULL,'proj.dll');
    exception
         when ORA_FFI.FFI_ERROR then
              for i in 1..TOOL_ERR.NERRORS LOOP
                   message(TOOL_ERR.MESSAGE(i));
              end LOOP;
    end;
    Step 2: Display the cursor stored in the DLL
    Now, you may want to change the cursor when the user clicks on
    a specific button. This is an example of code that could be set
    in the WHEN-BUTTON-PRESSED trigger:
    set_application_property(CURSOR_STYLE,'<proj>TESTCUR');
    <proj> refers to the proj.dll. Please note the < and > signs
    which are mandatory there. TESTCUR is the name of the cursor resource
    as defined in the proj.rc file.
    Step 3: Display the icon stored in the DLL
    You may also want to change the icon of an iconic button after
    some specific end-user action. The appropriate code for that is:
    set_item_property('IBUTTON',ICON_NAME,'<proj>TESTICO');
    IBUTTON is a PushButton, with the Iconic property set to Yes.
    TESTICO is the name of the icon resource as defined in the proj.rc file.
    Asim.

  • How to get the full path of the fmx's directory.

    Hi all,
    I will ship my project to a customer. So I must install forms runtime at the customer's machine.
    I put all of the fmx files of my project into a certain directory at the customer's machine, and I create a desktop shortcut of the forms runtime. In the "start in" field of the shortcut property I put the full path of the directory where I put the fmx files. And in the target field of the shortcut property I put after the ifrun60.exe the name of the fmx file which to call first.
    Now , in one of my forms file I want to get the full path of this directory because I must call Ora_Ffi.Load_Library. And the library which I want to load resides on that directory.
    So how to get programatically the directory where the fmx files reside.
    I know that there is the registry entry FORMS60_PATH, but we plan to ship many projects to that customer; so if I use the FORMS60_PATH variable then there will be an error because there will be many directories. And the customer can launch many of the projects at the same time.
    So how to get it.
    Thank you very much indeed.

    If you are using the d2kwutil library, then you can use the win_api_environment.Get_Working_Directory() function.
    If not, I doubt that there is anyway to get it since the get_application_property(current_form) does not return the full path of the form as it used to in prior versions of Oracle forms such as 4.5.

  • Changing mouse pointer

    I would like to be able to change my mouse pointer to something
    other that what set_application_property cursor_style can do for
    me. I would like to be able to call a mouse pointer from the
    file system and replace the the pointer in my forms app.
    Thanks in advance for any direction that can be given.
    Roland

    If your Mouse cursor is in a DLL you can do:
    Set_Application_Property(CURSOR_STYLE,'<DLLNAME>cursorname');
    For this to work you have to load the above DLL first using
    ORA_FFI.LOAD_LIBRARY().

  • Calling a dll from forms 6

    Hello,
    Sorry, I'm brazilian and my english isn't very good...
    I'm trying to call some functions from a dll invoked by a trigger on event WHEN-BUTTON-PRESSED. I make a package as this:
    ---- Package Spec ----
    PACKAGE anserlib IS
         function autoconnect(p_connport in number) return boolean;
    END;
    ---- Package Body ----
    PACKAGE BODY anserlib IS
         libhandle ora_ffi.libHandleType;
         autoconnect_fhandle ora_ffi.funchandletype;
         setprinton_fhandle ora_ffi.funchandletype;
         setprintoff_fhandle ora_ffi.funchandletype;
         res varchar2(200);
         commport number;
         function ff_autoconnect(fhandle ora_ffi.funchandletype, p_commport in number) return boolean;
         pragma interface(C, ff_autoconnect, 11265);
         function autoconnect(p_connport in number) return boolean is
         begin
              return(ff_autoconnect(autoconnect_fhandle,p_connport));
         end;
    begin
         libhandle := Ora_Ffi.Load_Library('C:\Juarez\Anser\','Anser712.dll');
         autoconnect_fhandle := ora_ffi.register_function(libhandle,'AutoConnect');
         ora_ffi.register_parameter(autoconnect_fhandle, ora_ffi.C_INT);
         ora_ffi.register_return(autoconnect_fhandle, ora_ffi.C_INT);
         setprinton_fhandle := ora_ffi.register_function(libhandle,'SetPrintOn');
         ora_ffi.register_return(setprinton_fhandle, ora_ffi.C_INT);
         setprintoff_fhandle := ora_ffi.register_function(libhandle,'SetPrintOff');
         ora_ffi.register_return(setprintoff_fhandle, ora_ffi.C_INT);
         ora_ffi.generate_foreign(libhandle, 'anser');
    exception
         when ora_ffi.ffi_error then
              --message(:bloco_teste.mensagem, acknowledge);
              message(tool_err.message, acknowledge);
    END;
    and the trigger is:
    declare
         v_res boolean;
         v_commport number;
    begin
         v_commport := 3;
         v_res := anserlib.autoconnect(v_commport);
    end;
    When I run the form and press button appears the message (it appears in portuguese to me, maybe the text is not the same in english, but i'll try to translate):
    FRM-40734: Internal Error: occours a PL/SQL error.
    Someone have an idea to help me...?
    Thanks vry much!!! :)

    In my opinion this error is something like 'General Protection Fault error' in Windows. I sow this error when my DLL worked with memory incorectly or called OCI functions which don't work under Forms Runtime.
    I think the problem might be caused by a mistake inside the DLL. The other problem may be that you use incorect calling conversion. For instance, the default calling conversion in Borland C Builder or Delphi is fastcall, not cdecl.
    p.s.
    1. Sorry for my English too :).
    2.
    ora_ffi.generate_foreign(libhandle, 'anser');I'm not sure what ora_ffi.generate_foreign does exactly, because I have never used it. As far as I know it isn't needed for this code. I'd recomend you to remove this line from your program.

  • Setting widows environment variable like "path "

    I want to set a new value for windows environment variable path. Is there any way to set change the varibale.

    You could also use ORA_FFI package to call Windows API function SetEnvironmentVariable. There is an example below.
    See also:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setenvironmentvariable.asp
    kernel_lhandle Ora_Ffi.Libhandletype;
    GetEnvironmentVariable_fhandle Ora_Ffi.Funchandletype;
    SetEnvironmentVariable_fhandle Ora_Ffi.Funchandletype;
    FUNCTION ff_GetEnvironmentVariable(
    fhandle Ora_Ffi.funchandletype,
    lpName varchar2,     -- address of environment variable name
    lpBuffer varchar2,     -- address of buffer for variable value
    nSize      pls_integer -- size of buffer, in characters
    ) RETURN pls_integer;
    PRAGMA interface( C, ff_GetEnvironmentVariable, 11265 );
    FUNCTION ff_SetEnvironmentVariable(
    fhandle Ora_Ffi.funchandletype,
    lpName varchar2,     -- address of environment variable name
    lpValue varchar2     -- address of variable value
    ) RETURN pls_integer;
    PRAGMA interface( C, ff_SetEnvironmentVariable, 11265 );
    function SetEnvironmentVariable(lpName varchar2, lpValue varchar2) return pls_integer IS
    BEGIN
    return ff_SetEnvironmentVariable( SetEnvironmentVariable_fhandle, lpName, lpValue );
    END;
    function GetEnvironmentVariable(
    lpName varchar2
    ) return varchar2 as
    lpBuffer char(2000);     -- address of buffer for variable value
    nSize      pls_integer; -- size of buffer, in characters
    res pls_integer;
    begin
    lpBuffer:='*';
    nSize:=2000-1;
    res:=ff_GetEnvironmentVariable(
    GetEnvironmentVariable_fhandle,
    lpName,
    lpBuffer,
    nSize );
    if res>0 then
    return substr( lpBuffer, 1, res );
    else
    return null;
    end if;
    end;
    -- Initialization
    /* Load the library */
    kernel_lhandle:=Ora_Ffi.Load_library
    ( '', 'kernel32.dll' );
    /* GetEnvironmentVariable */
    GetEnvironmentVariable_fhandle:=Ora_Ffi.Register_Function
    ( kernel_lhandle, 'GetEnvironmentVariableA', Ora_Ffi.C_Std );
    Ora_Ffi.Register_Parameter
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Parameter
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Parameter
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_INT );
    Ora_Ffi.Register_Return
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_INT );
    /* SetEnvironmentVariable */
    SetEnvironmentVariable_fhandle:=Ora_Ffi.Register_Function
    ( kernel_lhandle, 'SetEnvironmentVariableA', Ora_Ffi.C_Std );
    Ora_Ffi.Register_Parameter
    ( SetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Parameter
    ( SetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Return
    ( SetEnvironmentVariable_fhandle, Ora_Ffi.C_INT );
    To change the variable PATH you could use something like the following code:
    s:=dll_path||';'||WIN32.GetEnvironmentVariable( 'PATH' );
    res:=WIN32.SetEnvironmentVariable( 'PATH', s );

  • Need to Call VB DLL from Oracle forms 6i.  Please help.

    Dear Friends,
    I am having a DLL which is created in VB. DLL having one function, that function having some IN parameters and it will return Char or Number.
    Please tell me how to call, send IN Parameter and Get out value.
    Advance Thanks.
    Best Regards,
    S.Mariappan.

    I am using ORA_FFI to register the library sucessfully, but getting error "PDE-DFF004 Can't find function clstest.ShowPopup in library C:\temp\testdll.dll", when register the function.
    Has anyone successfully call a VB DLL using ORA_FFI.
    Thanks.
    -- Register the library
    dll_handle := ora_ffi.load_library('C:\temp\','testdll.dll');
    -- Register the function and parameters
    test_handle := ora_ffi.register_function(dll_handle, 'clstest.ShowPopup', ora_ffi.C_STD);
    ora_ffi.register_return(test_handle, ora_ffi.C_INT);

  • Forms hanging after multiple calls to Foreign Function Interface

    Hi,
    Can anyone help me with this problem. I'm getting a 'FRM-92100:
    Your connection to the server was interrupted ... Details ...
    Java Exception:java.io.EOFException' error message when i make
    two calls to a c share object file using the ORA_FFI package.
    Forms will hang with that error message when I call the foreign
    function more than once and when the ORA_FFI.LOAD_LIBRARY
    function is executed twice.
    I've tried using the ORA_FFI.UNLOAD_LIBRARY function at the end
    straight after the load library plus my processes and it still
    hangs with that error message.
    I've got a temporary work around which is not ideal but it
    works. I've made another copy of the C shared object file and
    renamed it and made my second call to load this library.
    I would prefer to have one shared object file and make multiple
    calls to it from forms. Any suggestions?
    note : running forms 6.0 on three tier architecture with web
    browser.

    "Mush15" <[email protected]> wrote in
    message
    news:g7hela$flo$[email protected]..
    > Ok the issue is a stack overflow caused by calling the
    function
    > recursivly.
    >
    > I have tried creating 2 functions and have each call the
    other but still
    > recieve a stack overflow.
    >
    > Any ideas help??
    Try incrementing a counter every time you call the function
    and decrementing
    it on the way out. When you hit 2640 times, stop calling it.

  • Creating an messagebox in forms with look and feel of Windows

    I wanted to create an message box in my form with look and feel of windows.For this i used the package ORA.FFI...but i am getting an error....and i am not bale to clear it...the code is as follows
    Package Specification: -
    PACKAGE messagebox IS
    /*Function message_box calls windows MessageBox function. */
    FUNCTION message_box(plptext IN VARCHAR2,plpcaption IN VARCHAR2)
    RETURN PLS_INTEGER;
    END;
    Package body : -
    PACKAGE BODY messagebox IS
    lh_window ORA_FFI.LIBHANDLETYPE;
    fh_mb ORA_FFI.FUNCHANDLETYPE;
    lh_forms ora_ffi.libHandleType;
    /* Function i_mbx acts as the interface to the Messagebox
    function in windows
    FUNCTION i_mbx(funchandle IN ORA_FFI.FUNCHANDLETYPE,
    plptext IN OUT VARCHAR2,
    plpcaption IN OUT VARCHAR2)
    RETURN PLS_INTEGER;
    PRAGMA interface(C,i_mbx,11265);
    FUNCTION message_box(plptext IN VARCHAR2,
    plpcaption IN VARCHAR2)
    RETURN PLS_INTEGER IS
    ltext VARCHAR2(500) := plptext;
    lcaption VARCHAR2(500) := plpcaption;
    BEGIN
    RETURN(i_mbx(fh_mb,ltext,lcaption));
    END;
    BEGIN
    lh_window := ORA_FFI.LOAD_LIBRARY('d:\','DclMsgBox.dll');
    fh_mb := ORA_FFI.REGISTER_FUNCTION(lh_window,'DclMsgBox',ORA_FFI.C_STD);
    ORA_FFI.REGISTER_RETURN(fh_mb,ORA_FFI.C_CHAR_PTR);
    ORA_FFI.REGISTER_RETURN(fh_mb,ORA_FFI.C_CHAR_PTR);
    --ORA_FFI.REGISTER_RETURN(fh_mb,ORA_FFI.C_INT);
    END;
    Now when i call this function in When-New-Form-Instance as
    declare
    p number;
    begin
    p:=messagebox.message_box('hello','test');
    end;
    I had created an dll for message box and placed the .dll and .lib files in the d:\ of my system.
    I get an error message when i run the app. The error is:
    The instruction at "0x005a3b24" referenced memory at "0x00000006".The memory could not be "read".
    Can anybody please tell me where have i gone wrong....

    Colin Martin wrote:
    I agree the leather look is horrible. It's just not a reflection of the cutting edge modern design we have all got to love over the years. If it has to be there at least give us a choice of looks.
    There is a word for this (not that one) - skeuomorph. Wikipedia defines this as 'a derivative object that retains ornamental design cues to a structure that was necessary in the original. Skeuomorphs may be deliberately employed to make the new look comfortably old and familiar'.
    Common examples are found in audio software with pictures of actual knobs that you turn, as here; and the leather-bound tear-off look of calendar and contacts on the iPad is the same principle: the intention is to make it familiar and friendly to people who might otherwise be frightened off by a modern look because they are not used to modern technology. The whole concept and look of the iOS operating system is being brought into use on Macs for the same reason, to encourage non-tech-savvy people not to be frightened of them.
    This is all very well in its way, but in these two particular cases the result is unfortunate, particularly for experienced users, and it really ought to be possible to choose between the looks (as you can with the Mail layouts), even if the skeuomorph is the default.

  • Migrating Apps from NT to unix

    Hi:
    I am currently investigating and change in operating systems for Oracle applications 11.0.3. The current system runs under Nt4 and we are looking at moving to unix (either sco or Compaq).
    What types of issues need to be adressed in order to accomplish this? We are running AP/GL/AR/PA.
    TIA

    Sorry, this is the code that is falling down:
    lh_GbNRT := ORA_FFI.LOAD_LIBRARY (NULL, 'C:\WINNT\system32\GBNRTI32.DLL');
    for the Win 2000 call
    lh_GbNRT := ORA_FFI.LOAD_LIBRARY('/opt/gb/imtk/', 'gbnrtiobj.so');
    for the Unix call - this is falling down.
    HELP!!!
    null

  • FFI wrapping Kernel32.dll

    PACKAGE BODY RER_UTILITY IS
    /* Declare the library and function handles. */
    kernel32_lhandle                Ora_Ffi.Libhandletype ;
    computernamea_fhandle      Ora_Ffi.Funchandletype ;
    /* Create the PL/SQL function that will actually */
    /* invoke the foreign function. */
    FUNCTION ff_computer_name(
         fhandle IN Ora_Ffi.Funchandletype,
    strName IN OUT VARCHAR2,
    lenName IN OUT NUMBER)RETURN NUMBER;
    PRAGMA interface(C, ff_computer_name, 11265);
    /* Create the PL/SQL function that is defined in */
    /* the package spec. This function simply */
    /* passes along the arguments it receives to */
    /* ff_computer_name (defined above), prepending the */
    /* foreign function handle to the argument List. */
    PROCEDURE rer_computer_name(
         strName OUT VARCHAR2,
         lenName OUT NUMBER)
    IS
              errNum     NUMBER;
    BEGIN
         errNum := 1;
         MESSAGE('Before' || errNum);          
         errNum := ff_computer_name(computernamea_fhandle, strName, lenName);
    MESSAGE('After' || errNum);          
    EXCEPTION
         WHEN OTHERS THEN
              MESSAGE('Error: ' || SQLCODE || ' Desc: ' || SQLERRM);
              RAISE;     
    END rer_computer_name;
    /* Define the body of package RER_UTILITY */
    BEGIN
         /* Load the library. */
         kernel32_lhandle := Ora_Ffi.Load_Library('C:\TEMP\', 'kernel32.dll');
         /* Register the foreign function. */
         computernamea_fhandle := Ora_Ffi.Register_Function(kernel32_lhandle, 'GetComputerNameA', Ora_Ffi.PASCAL_STD); -- Ora_Ffi.C_Std
         /* Register the return type. */
         Ora_Ffi.Register_Return(computernamea_fhandle, Ora_Ffi.C_LONG);
         /* Register both parameters of function GetComputerNameA. */
         Ora_Ffi.Register_Parameter(computernamea_fhandle, Ora_Ffi.C_CHAR);
         Ora_Ffi.Register_Parameter(computernamea_fhandle, Ora_Ffi.C_LONG);
    EXCEPTION
              WHEN OTHERS THEN
              MESSAGE('Error: ' || SQLCODE || ' Desc: ' || SQLERRM);
              RAISE;
    END; /* Package Body RER_UTILITY */
    Forms 6i running on a XP Pro box pointing toward an 8i database.
    Running the code will kick me out with no error.
    Running in debug mode, I get a ORA-304500 error.
    Any ideas?
    Much thanks!

    1. You can use the D2KWUTIL library to get the computer name. There is
    the WIN_API_ENVIRONMENT.Get_Computer_Name function there.
    2. I believe the following code works too:
    ---- cut here ----
    PACKAGE BODY W IS
    kernel32_lhandle Ora_Ffi.Libhandletype;
    GetComputerName_fhandle Ora_Ffi.Funchandletype;
    FUNCTION ff_GetComputerName(
    fhandle Ora_Ffi.Funchandletype,
    lbBuffer varchar2,
    nSize pls_integer ) RETURN pls_integer;
    PRAGMA interface(C, ff_GetComputerName, 11265);
    FUNCTION GetComputerName RETURN varchar2 IS
    buf varchar2(1000);
    nSize pls_integer;
    ret pls_integer;
    BEGIN
    -- You have to initialize the buffer for a received information
    -- before you call the WinAPI function
    -- Allocates 1000 bytes for the buffer
    buf:=RPAD( '*', 1000, '*' );
    nSize:=length(buf)-1;
    ret:=ff_GetComputerName( GetComputerName_fhandle, buf, nSize );
    if ret=0 then
    -- If the function fails, the return value is zero.
    return NULL;
    end if;
    return substr( buf, 1, nSize );
    END;
    PROCEDURE Init IS
    BEGIN
    -- Load the library.
    kernel32_lhandle := Ora_Ffi.Load_Library( '', 'kernel32.dll' );     
    -- BOOL GetComputerName(
    -- LPTSTR lpBuffer, // address of name buffer
    -- LPDWORD nSize // address of size of name buffer
    GetComputerName_fhandle := Ora_Ffi.Register_Function(
    kernel32_lhandle,
    'GetComputerNameA',
    Ora_Ffi.C_Std );
    Ora_Ffi.Register_Parameter( GetComputerName_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Parameter( GetComputerName_fhandle, Ora_Ffi.C_INT_PTR );
    Ora_Ffi.Register_Return( GetComputerName_fhandle, Ora_Ffi.C_INT );
    END;
    BEGIN
    Init;
    END;
    ---- cut here ----

Maybe you are looking for

  • Ipod video problems (no audio)

    when I export a video through quick time to my ipod, it plays great but has no audio. I was told that is b/c it's muxed. What is a good mpeg converter program & once you get the program how do you "unmux" the file?

  • Boot Camp 4 to Boot Camp 3

    How to move from BootCamp 4 BootCamp 3?

  • BDLS - Client Independent Table

    Hi All, When I execute BDLS, there are two options there, one is conversion of client dependent and independent tables and the second is conversion of client dependent only. In a BW system, what are the differences of these two options and which one

  • FDM not able to register with shared services

    Hi I am installing FDM v 11.1.2.1 on window 2008 server. While running configuration, it fails to register with shared services. Shared services is up and running. The configtool.log file gives the following information [2011-10-09T02:59:59.476-04:00

  • Regular expressions for URLs

    Hi everyone, I have a question about regular expressions. Let's say I want my program to extract last 10-digits from any URL that will be found (every found URL will end up on 10digit number!) and insert that number in the middle of other URL. Would