Calling NI objects from aa Afx thread

Hi,
I have a Dialog class in Visual c++ 2003 "TESTDlg.h and TestDlg.cpp"
In TestDlg.h i have publikc members:
public:
   CNiButton m_nbool1;
    CNiButton m_nbool2;
    CNiButton m_nbool3;
    CNiButton m_nbool4;
    CNiButton m_nbool5;
in TestDlg.cpp i have a worker thread: CWinThread* pThread = AfxBeginThread( MyFunc_, this, THREAD_PRIORITY_NORMAL, 0, 0,NULL);
MyFunc function gets the "this" pointer and obtains a reference to the Dialog.
I can access all the Public members within TestDlg but the NIButtons(although they are also public)
My code returns with error:
Unhandled exception at 0x7c812a5b in TestDlg.exe: Microsoft C++ exception: NI::CNiOleException @ 0x01bafb54.
How can i fix that?

I realise that this is some time ago, but I'm working on a similar project and need some MFC assistance.
I've created a DLL with MFC, but I need to use Multithreading to collect some data.
Since all the calls look similar to
_declspec(dllexport) HRESULT __cdecl OpenPort ( unsigned char DeviceID )
 return ( m_pBrickInput->OpenDevice ( DeviceID ) );
I haven't had any reason to create any instances of the class.
Now, when I try to do this...
static void StartRead(void)
 CBrickApp *MyApp;
  MyApp = new (CBrickApp);
  MyApp->StartReader();
void CBrickApp:tartReader(void)
CWinThread  *pReaderThread;
//  this->Data.SetSize(0);
  pReaderThread = AfxBeginThread (ReadThread, (void *)this, THREAD_PRIORITY_HIGHEST,
          0, 0, NULL );
the MFC Linker complains...
Any suggestions ?
DOK 

Similar Messages

  • Help calling JNI function from a java thread

    I am using the following code to call a JNI fuction from a java thread:
    public class CMSMessageHandler extends MessageHandler{
    static{
    System.loadLibrary("jastb");
    public native int cmsReadIt(ByteBuffer buff);
    private ByteBuffer dirbuf = null;
    /** Creates a new instance of CMSMessageHandler */
    public CMSMessageHandler() {
    // allocate to max size datagram
    dirbuf = ByteBuffer.allocateDirect(65536);
    public void readMessages(){
    /*Thread worker = new Thread(){
    public void run(){*/
    int count;
    while (true){
    try{
    count = cmsReadIt(dirbuf);
    } catch (Exception e){
    e.printStackTrace();
    worker.start();*/
    public static void main(String[] args) {
    CMSMessageHandler handler = new CMSMessageHandler();
    handler.readMessages();
    When I run this main method with the thread commented out, it works great. When I run the main method with the thread, it works great for a while, and then funny things start happening with the native library I am using. My native library uses shared memory, signals, and semaphores. It feels a bit like my java program is stomping on the resources that my native library is using, when a run the java program with a thread.
    Is there something I don't know about calling native code from a thread? Should I be doing something explicitly to protect my native library's shared memory, signals, or semaphores?
    Thanks,
    Lisa.

    Does the library do any initialization when loaded? Does it make a dangerous assumption that the thead calling cmdReadIt will always be the same thread that initially loaded it? Try loading the library in the worker thread instead of in the main thread via the static initializer.Yes. There is a call to another native method cmsOpenIt that does CMS initialization. I put cmsOpenIt as well as the System.loadLibrary("jastb") in the worker thread and I'm still experiencing the same problems.
    Incidently, the mere presence of another Thread in this program does not seem to cause problems. It's only when I run calls to cmsReadIt in a thread that I get into trouble.
    For example, this works fine:
    public class CMSMessageHandler extends MessageHandler{
        public native int cmsReadIt(ByteBuffer buff);
        public ByteBuffer dirbuf = null;
        static {
            System.loadLibrary("jastb");
        public CMSMessageHandler() {
            // allocate to max size datagram
            dirbuf = ByteBuffer.allocateDirect(65536);
        public void readMessages(){
            try{
                int count = 0;
                while (true){
                    count = cmsReadIt(dirbuf);
            } catch (Exception e){
        public static void main(String[] args) {
            CMSMessageHandler handler = new CMSMessageHandler();
            Thread worker = new Thread(){
                public void run(){
                    while (true){
                        try{
                            Thread.currentThread().sleep(1000);
                            System.out.println("sleep thread.");
                        } catch (Exception e){
                            e.printStackTrace();
            worker.start();
            handler.readMessages();  
        }Are there JVM flags that I should experiment with that might help mitigate/diagnose this problem?

  • Procedure to Call Workflow Object from ABAP program in Se38

    Hi All,
    I have one scenario like i have to call one Workflow object from ABAP program in SE38.The scenario is like below.....
    I have to select some records from database table.For example there are 100 records in the internal table.
    For all that records i have to invoke Workflow for getting approval from the authorized persons. Once Approval has come to program, It will post one document in SAP and process ends.
    Please suggest me how to move forward with this scenario.
    Regards
    Manas Ranjan Panda

    Hi,
    So you want to start a workflow from an ABAP, if an event exists for that particular workflow then the best way is to use fm SAP_WAPI_CREATE_EVENT,
    to start a workflow from an ABAP you can use fm SAP_WAPI_START_WORKFLOW.
    Kind regards, Rob Dielemans

  • Call view object from ViewController [SOLVED]

    I'm using a valueChangeListener method in a managed bean, which I'd like to use to call a method on a view object. How can I call the view object from a managed bean class?
    Regards

    Maik,
    It is best practice to create a method on your application module, and have this method manipulate VO's and call VO methods.
    See section 8.5.3.1 in ADF Developers Guide for more info o calling an AM method from a managed bean:
    http://download-west.oracle.com/docs/html/B25947_01/bcservices005.htm#sthref673
    Please use the JDeveloper forum in the future for question like this, that are not related to JHeadstart.
    Steven Davelaar,
    Jheadstart team.

  • CALLING BUSINESS OBJECT FROM AN ABAP REPORT

    Hi friends,
               I have a business object to which a Custom Function Module is assigned in one of its method.This Function Module calls a Bapi to update a Service Order.I need to capture the status of Idocs regarding success or failure from the function Module in the ABAP Report.I would like to know if there is any way to call this business object from my report and get the status of IDOC.
    Regards,
    Dev Reddy

    sorry I think i was not clear in explaining .I am calling a BAPI to update 'Priority' field of service orders in a custom function module(remote enabled) and I have assigned this bapi to a custom business object. Also I have developed an ALE interface thru BDBG transaction which automatically generates custom basic idoc type,messsage type ,Ale i/b and o/b function modules.
    Actually my requirement deals with a report where we have list of service orders in an internal table and pass each service order to update Priority field.
    Is there any way to create an IDOC from the report and update the priority field and pass back the status of IDOC.
    I have tried calling ALE O/B function function module generated thru BDBG transaction in my report but as a result i am unable to get any of the message whether idoc is created or not.
    Here is my report code.
    data: it_methods type table of BAPI_ALM_ORDER_METHOD with header line,
          it_header type table of BAPI_ALM_ORDER_HEADERS_I with header line,
          it_header_up type table of BAPI_ALM_ORDER_HEADERS_UP with header line,
          RECEIVERS TYPE TABLE OF BDI_LOGSYS WITH HEADER LINE.
    T_METHODS-REFNUMBER = '000001'.
    IT_METHODS-OBJECTTYPE = 'HEADER'.
    IT_METHODS-METHOD = 'CHANGE'.
    IT_METHODS-OBJECTKEY = '000004000768'.
    APPEND IT_METHODS.
    CLEAR IT_METHODS.
    IT_METHODS-REFNUMBER = '000000'.
    IT_METHODS-METHOD = 'SAVE'.
    APPEND IT_METHODS.
    IT_HEADER-ORDERID = '000004000768'.
    IT_HEADER-PRIORITY = '2'.
    APPEND IT_HEADER.
    IT_HEADER_UP-ORDERID = '000004000768'.
    IT_HEADER_UP-PRIORITY = 'X'.
    APPEND IT_HEADER_UP.
    CALL FUNCTION 'ZZ_FM_SM_ORD_PRIOR_UPDATE'
    EXPORTING
       OBJ_TYPE                      = 'ZBOSMPRUPD'
       SERIAL_ID                     = '0'
      TABLES
        ITMETHODS                     = IT_METHODS
        ITHEADER                      = IT_HEADER
        ITHEADERUP                    = IT_HEADER_UP
        RECEIVERS                     = RECEIVERS
      COMMUNICATION_DOCUMENTS       =
      APPLICATION_OBJECTS           =
    EXCEPTIONS
       ERROR_CREATING_IDOCS          = 1
       OTHERS                        = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Thanks,
    Dev Reddy

  • New to JavaFX--Calling Java objects from JavaFX

    Hello,
    I am a Java developer who is new to JavaFX. I am having no luck in finding a tutorial that exhibits more than just fun effects. I need to be able to call existing classes from a JavaFX GUI. Can anyone offer any assistance on this? It's very frustrating because this should be a simple task. If we are faced with having to rewrite existing code, we will probably be forced to abandon JavaFX. I hope this is not the case.
    Thanks!

    The answer is yes. The impementation is -
    If you have classes that you keep as library classes that you intend for use irrespective of the platform, then I suspect that you have already written them with no view content. For those, including them in your JavaFX is not really different to using them in Java. I am just learning JavaFX too and the most important lesson for us to learn is that 'JavaFX is Java with FX on the end of it'. I know the strickly come dancing set will say 'oh but what about types'. Well I have found no trouble at all with types, basic or my own, we are in object world so long as the compiler has the class object and we have all stuck to the rules then it has all it needs to act on your objects.
    So your non-View classes can be used as you always use them -
    import mylib'
    var somethingFromMyLibOfClasses = new mylib.ClassThatDoesSomethingVeryClever();
    It is then just a matter of arranging a FX trigger of some kind (trigger/event/timer/bind) to call the function in your library.
    Which triggers and when are the part I am still finding difficult. The basic GUI events are fine (onMouseClick etc), it is 'bind' that is troublesome.
    Binding something in your code to a 'property' of the display element is easy enough, but binding where you have no external variable that relates to 'Property' value is less clear. For example you may have to change a form contents due to a trigger sent from a remote database.
    You have some in the forum talking of 'resize your window a few pixels to force a redraw so that your code can be retriggered'. Others are using timers at high tick frequency to for an update. such as changing a property that you can't see.
    That is utter nonsense, if you look up the proper description of bind then it becomes obvious. Bind can be a two way thing, you can change a value in your element from outside, but you can also change a value outside of your element from within your element.
    Equally that trigger can be your own code. There is no need of trickery to update Scenes, the writters of JavaFX already have it sussed.
    The Sun web site has some great tutirials, but as a personal favourite that cleared up som of the junk about JavaFX that was building up in my mind I reccommend you spend a bit of time here [JavaFX Refference|http://openjfx.java.sun.com/current-build/doc/reference/JavaFXReference.html]
    Not the best layout you will ever see, but it is the best source I have found, then if you use that along side [Master Index|http://java.sun.com/javafx/1.2/docs/api/javafx.stage/javafx.stage.Stage.html] hopefully you will find, as I did, that you do not have to think differently to make use of the FX on the end of Java.

  • How do I access objects from the original Thread?

    I have this simple JApplet that just makes a circle bounce around the screen. Here it is:
    import java.awt.Color;
    import javax.swing.JApplet;
    import java.awt.Graphics;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class TestApplet3 extends JApplet implements MouseListener {
        private int lastX;          // x coordinate of circle
        private int lastY;          // y coordinate of circle
        private int d = 15;          // diameter of circle
        public void paint(Graphics g) {
        public void init() {
            addMouseListener(this);
        public void mouseClicked(MouseEvent event) {
            Graphics gx = this.getGraphics();
            for (int x = 0, y = 0, count = 0, horiz = 2, vert = 2, k = 2; count < 1000; x = x + horiz, y = y + vert, count++) {
                if ((x + d) >= 350) {
                    horiz = -horiz;
                if ((x <= 0) && (horiz < 0)) {
                    horiz = -horiz;
                if ((y + d) >= 200) {
                    vert = -vert;
                if ((y <= 0) && (vert < 0)) {
                    vert = -vert;
                gx.setColor(Color.WHITE);
                gx.fillOval(lastX, lastY, d, d);
                gx.setColor(Color.RED);
                lastX = x;
                lastY = y;
                gx.fillOval(lastX, lastY, d, d);
                try {
                    Thread.sleep(20);
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
        public void mouseEntered(MouseEvent event) {
        public void mouseExited(MouseEvent event) {
        public void mousePressed(MouseEvent event) {
        public void mouseReleased(MouseEvent event) {
    }But now I'd like to change it so that when the mouse is clicked a new Thread is spawned to run the code within the mouseClicked method..... this will allow multiple circles to bounce around and will also keep the applet responsive to new mouse clicks... so I've tried changing it below:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package runninggraph;
    * @author epuknol
    import java.awt.Color;
    import javax.swing.JApplet;
    import java.awt.Graphics;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class TestApplet3 extends JApplet implements MouseListener, Runnable {
        private int lastX;          // x coordinate of circle
        private int lastY;          // y coordinate of circle
        private int d = 15;          // diameter of circle
        public void paint(Graphics g) {
        public void init() {
            addMouseListener(this);
        public void run() {
            Graphics gx = this.getGraphics();
            for (int x = 0, y = 0, count = 0, horiz = 2, vert = 2, k = 2; count < 1000; x = x + horiz, y = y + vert, count++) {
                if ((x + d) >= 350) {
                    horiz = -horiz;
                if ((x <= 0) && (horiz < 0)) {
                    horiz = -horiz;
                if ((y + d) >= 200) {
                    vert = -vert;
                if ((y <= 0) && (vert < 0)) {
                    vert = -vert;
                gx.setColor(Color.WHITE);
                gx.fillOval(lastX, lastY, d, d);
                gx.setColor(Color.RED);
                lastX = x;
                lastY = y;
                gx.fillOval(lastX, lastY, d, d);
                try {
                    Thread.sleep(20);
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
        public void mouseClicked(MouseEvent event) {
            (new Thread(new TestApplet())).start();       
        public void mouseEntered(MouseEvent event) {
        public void mouseExited(MouseEvent event) {
        public void mousePressed(MouseEvent event) {
        public void mouseReleased(MouseEvent event) {
    }but this doesn't work - I think because the this.getGraphics() doesn't refer back to the same object ..... I've tried some other things too - like defining the Graphics gx as a class variable and initializing it before spawning the new Thread ... but I can't access gx using that technique either.
    Can somebody please help me get where I'm trying to go?
    Thanks.

    Aw heck, got bored. For instance, this draws a bunch of balls without a direct call to Thread anything:
    BouncingCircles.java
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.RenderingHints;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    * creates a JPanel that draws bouncing circles within it. 
    * @author Pete
    public class BouncingCircles {
      private static final int DELAY = 15;
      private static final int DIAMETER = 15;
      private static final int DELTA = 5;
      List<Ball> ballList = new ArrayList<Ball>(); // list of all balls
      private JPanel mainPanel = new JPanel() {
        @Override
        protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          myPaint(g);
      // Swing Timer that tells the balls to move and tells the JPanel to then draw them
      private Timer sTimer = new Timer(DELAY, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          timerAction(e);
      public BouncingCircles() {
        mainPanel.setPreferredSize(new Dimension(400, 400));
        mainPanel.addMouseListener(new MouseAdapter() {
          @Override
          // add new ball with each mouse press
          public void mousePressed(MouseEvent e) {
            ballList.add(new Ball(e.getPoint(), new Point(DELTA, DELTA)));
        sTimer.start();
      public JPanel getPanel() {
        return mainPanel;
      private void timerAction(ActionEvent e) {
        Dimension d = mainPanel.getSize();
        for (Ball ball : ballList) {
          if (ball.getPoint().x < 0) {
            ball.setXDirectionRight(true);
          } else if (ball.getPoint().x + DIAMETER > d.width) {
            ball.setXDirectionRight(false);
          if (ball.getPoint().y < 0) {
            ball.setYDirectionDown(true);
          } else if (ball.getPoint().y + DIAMETER > d.height) {
            ball.setYDirectionDown(false);
          ball.increment();
        mainPanel.repaint();
       * paintComponent method draws all balls in List
       * @param g
      private void myPaint(Graphics g) {
        g.setColor(Color.red);
        Graphics2D g2d = (Graphics2D) g;
        RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHints(rh);
        for (Ball ball : ballList) {
          g.fillOval(ball.getPoint().x, ball.getPoint().y, DIAMETER, DIAMETER);
      private class Ball {
        private Point point = new Point();
        private Point velocity = new Point();
        public Ball(Point point, Point velocity) {
          this.point = point;
          this.velocity = velocity;
        public Point getPoint() {
          return point;
        public Point getVelocity() {
          return velocity;
        public void increment() {
          point = new Point(point.x + velocity.x, point.y + velocity.y);
        public void setXDirectionRight(boolean right) {
          int newVelocityX = Math.abs(velocity.x);
          if (!right) {
            newVelocityX = -newVelocityX;
          velocity = new Point(newVelocityX, velocity.y);
        public void setYDirectionDown(boolean down) {
          int newVelocityY = Math.abs(velocity.y);
          if (!down) {
            newVelocityY = -newVelocityY;
          velocity = new Point(velocity.x, newVelocityY);
    }And this displays the JPanel produced above in a standard JApplet.
    BouncingCircApplet.java
    import java.lang.reflect.InvocationTargetException;
    import javax.swing.JApplet;
    import javax.swing.SwingUtilities;
    public class BouncingCircApplet extends JApplet {
      @Override
      public void init() {
        try {
          SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
              getContentPane().add(new BouncingCircles().getPanel());
        } catch (InterruptedException e) {
          e.printStackTrace();
        } catch (InvocationTargetException e) {
          e.printStackTrace();
    }

  • Error #2025:The supplied DisplayObject must be a child of the caller - Removing Object from Array

    Hi guys, I'm pretty new to as3 and I'm trying to make a game where the player supposedly clicks on the stage and 3 towers which I've spawned dynamically should shoot towards the area. Everything works in terms of tower rotation, etc, but the bullets will not be removed from the stage when I exit the level into another scene. The boundary checking is fine, too.
    Here's a part of the code in the Main.as file.
    private function clickTower1(e:MouseEvent):void
    for each (var tower1:mcTower1 in tower1Array)
    var newLaser1:mcLaser1 = new mcLaser1();
    newLaser1.rotation = tower1.rotation;
    newLaser1.x = tower1.x + Math.cos(newLaser1.rotation * Math.PI / 180) * 40;
    newLaser1.y = tower1.y + Math.sin(newLaser1.rotation * Math.PI / 180) * 40;
    newLaser1.addEventListener(Event.ENTER_FRAME, laser1Handler);
    tower1BulletArray.push(newLaser1); stage.addChild(newLaser1);
      private function laser1Handler(e:Event):void
    //Make laser move in direction of turret.
    var newLaser1:MovieClip = e.currentTarget as MovieClip;
    newLaser1.x += Math.cos(newLaser1.rotation * Math.PI / 180) * laser1Speed;
    newLaser1.y += Math.sin(newLaser1.rotation * Math.PI / 180) * laser1Speed;
    //Boundary checking if (newLaser1.x < -50 || newLaser1.x > 800 || newLaser1.y > 600 || newLaser1.y < -50)
    newLaser1.removeEventListener(Event.ENTER_FRAME, laser1Handler); stage.removeChild(newLaser1);
    tower1BulletArray.splice(0, 1);
    I have a function called exitLevel, which basically, as the name states, exits the level when a button is clicked. It worked perfectly before I started coding the bullets.
        private function exitLevel(e:MouseEvent):void
    stage.frameRate = 6;
    gamePaused = false;
    clearLevel();
    gotoAndStop(1, 'exitLevel');
    btnExitLevel.addEventListener(MouseEvent.CLICK, levelSelect1);
      private function clearLevel():void
    stage.removeEventListener(Event.ENTER_FRAME, update);
    stage.removeChild(buttonCreep1); stage.removeChild(buttonCreep2);
    for (var i = creep1Array.length - 1; i >= 0; i--)
    removeChild(creep1Array[i]);
    creep1Array.splice(i, 1);
    //trace ("Creep1 Removed");
    for (var j = creep2Array.length - 1; j >= 0; j--)
    removeChild(creep2Array[j]);
    creep2Array.splice(j, 1);
    //trace ("Creep2 Removed");
    for (var k = tower1Array.length - 1; k >= 0; k--)
    removeChild(tower1Array[k]); tower1Array.splice(k, 1);
    for (var l = tower1BulletArray.length - 1; l >= 0; l--)
      stage.removeChild(tower1BulletArray[l]);
    tower1BulletArray.splice(0, 1);
    After debugging, it says the error is at the end, where i try to remove the child from the stage. What is wrong? Sorry, I'm a beginner at as3 so any answers might have to be spoonfeeding... I'll try to learn and understand, though. Thanks!
    I did take some of the code off of a guide on the web, and I don't understand it totally, so can someone explain to me what this code does as well? What is e.currentTarget? Thanks!
    var newLaser1:MovieClip = e.currentTarget as MovieClip;
    Here's the full .as file if anybody wants to take a look. http://pastebin.com/5ff4BQa5

    Hi, I managed to solve the errors (kind of) by using this code.
    for (var i:int = tower1BulletArray.length - 1; i >= 0; i--)
    if (tower1BulletArray.parent)
    tower1BulletArray[l].parent.removeChild(tower1BulletArray[l]);
    tower1BulletArray.splice(i, 1);
    However, the problem still persists that the bullets stay in the screen after I change the scene. Any solution? Thanks!

  • Calling iBrowser Object from iframe inside iframe

    Hi,
    Normally i can get the selected value of iBrowser using this method.
    var myString =document.appletname.getBrowserObject().getSelectedDatalinkValue();
    But in my case i have iframe inside iframe. In 2nd iframe i am calling iBrowser.
    I need to get the selected value of iBrowser in an iframe inside another iframe.
    I tried iframe1.iframe2.document.appname.....
    But i didn't get any value. Can anybody suggest regarding this.
    Thanks & Regards,
    Giri

    Try the following:
    window.frames["TheIFrameName"].document.appletname.getBrowserObject().getSelectedDatalinkValue();
    This should work as long as both IFrames are sourced from the same server.  Cross-frame scripting when the sources are different servers is usually not permitted by the browser for security reasons.
    Edited by: Rick Bullotta on Nov 19, 2008 6:40 AM

  • Calling COM object from an Applet

    Hi,
    Can an applet communicate with Microsoft COM object?
    Thanx

    Check out some software called JIntegra (commercial). Also, I think there used to be some sun stuff... but it got dropped... and then got picked up again... but I don't know what the status is on it.

  • How to call Java Objects from ESB?

    I don't know whether its possible but if there is a way please let me know I'd really appreciate.
    I'm sending message to the JMS queue and I've created JMS adapter that I expect to be triggered when message gets into the queue. The message is an xml file that I read and look up some values that are Java classes and methods that I want to call. So how do I configure ESB to call Java Classes. I tried to look at the routing rules.
    Regards

    You could create the wsdl yourself and instead of the soap:binding use the java:binding
    not sure if this works...just a guess.

  • Is it possible to call COM objects from ABAP?

    Hi guys, is it possible?
    Can you also provide me a little sample code?
    Thanx a lot!
    Peter

    I think OLE is possible through ABAP
    as in
    INCLUDE OLE2INCL.
    DATA EXCEL TYPE OLE2_OBJECT.
    CREATE OBJECT EXCEL 'Excel.Application'.
    FREE   OBJECT EXCEL.
    i dnt know much about COM ..
    there maybe somthing similar to this
    hope this helps
    Award forum points to helpful answers

  • Calling a java object from a store procedure

    I have written a translation object in java that takes a $en_var in and returns its path.
    What I need to do is call that object from a PL/SQL store procedure. All the examples I have seen treat the store procedure as a wrapper around the java object.
    But in my store procedure calling the object is only one part of the procedures role:
    The store procedure code is :
    CREATE OR REPLACE PROCEDURE WRITE_TO_FILE(in_file_name IN VARCHAR, in_en_var IN VARCHAR)
    file_handle UTL_FILE.FILE_TYPE;
    file_location VARCHAR2(50)
    BEGIN
    I need to be able to call the javaobject translation here
    file_location = translation.translatePath(in_en_var)
    file_handle := UTL_FILE.FOPEN(file_location, in_file_name, 'w');
    dbms_output.put_line ('input file name opened file name' ||in_file_name ||'-->' ||in_file_location);
    UTL_FILE.put_line(file_handle,'Hello Tony);
    UTL_FILE.FCLOSE(file_handle);
    END WRITE_TO_FILE;
    I call the java class method translatePath with a string the en_var which returns the path as a string which is then passed as a parameter to UTL_FILE.FOPEN.
    Thanks for any help
    Tony

    No Longer the problem

  • Urgent - calling EJB methods from thread

    Dear all
    I am aware of EJB spec that does not permit developer managed threads within EJB components. However, I need to call EJB methods from my own thread. Hence, it there any way to to call EJB methods from developer managed thread ?? If yes, please advice me, thanks in advance and your help will be appriciated.
    Hava a nice day

    You can call EJB's from your threads. Your thread will act as the client and the call will to EJB will be same as any other client invoking EJB's. Hope I understand your question !.

  • Object corruption when retrieving object from List

    Hi,
    We have a batch program. There are muliple threads running which read data from database and then processes the data.
    In each thread. there is a call to fetch data from a table, create objects and populate a list and return it.
    This list is then given to another method which processes each item from the list
    This is a simplified version of what the code looks like.
    public class Manager{
         public void run(){
              Reader r = new Reader();
              Processor processor = new Processor();
              List list = reader.getItems();
              processor.processItem(list);
    public class Reader{
         public List getItems(){
              List list = new ArrayList();
              // Resultset rs = execute a query and get
    // a resultset object
              while(rs.next()){
                   Item item = new Item();
                   // set information from rs and set
    //into item
                   list.add(item);
              return list;
    public class Processor {
         public processItem(List list){
              Item item = null;
              while (!list.isEmpty()){
                   item = (Item)list.remove(0);
    In the processItem method of Processor class, when I retrieve item from the List
    it should return me an object of type Item. But very rarely what happens is that
    the object I return is not of type Item, but null or a junk class like [C@1309b55.
    Once this happens, i get a class cast exception when i am trying to cast this to
    Item class.
    Can anyone please tell me if you have encountered such a scenario before?
    The process is running in a 2 processor environment.
    It's mulithreaded, but method calls are done from within a thread.
    The ArrayList is not shared across multiple threads. It's life starts
    and ends within the run method of the thread.

    Item class is made up of three instances of three
    separate classes with corresponding getters and
    setters.
    All these 3 classes, have member variables of String,
    int and double.
    There are getter and setter methods for all of the
    variables as well as overridden equals and hashcode
    methodsYou have to show your code, inside [code] and [/code] tags.

Maybe you are looking for