How do I pass a com object to a callback function

I am trying to program the PCI-6527 card within a COM object. With the DIG_Change_Message_Config command I'm setting the notification for when the input signal changes using a callback function. To make the callback function work I have to declare that function as a static member of the object class. This means that I have no access to the this pointer in this function. After I receive the notification, my actions in the callback function depend on settings in member variables in the class. MSDN gives as a solution to pass the this pointer as an argument to a static member function to have access to the class. I've tried this but the compiler keeps barfing at me.
The code used is:
stat = DIG_Change_Message_Config(
m_CardNum,1, msg,"",0,0, (unsigned long)DealWithInput );
with DealWithInput defined as: static void DealWithInput();
Is there a way of getting access to the class in DealWithInput either by passing it as an parameter or through some other ingenous trick that I can't find documentation for

The thing is that you cannot change the parameters of the callback functions. It is always :
void yourCallbackFunc (DAQEventHandle handle,
DAQEventMsg msg,
DAQEventWParam wParam,
DAQEventLParam lParam);
When yourCallbackFunc is called back, all the parameters get filled in the calling function in DAQ driver. What you have to do is pass the this pointer in message parameter in DIG_Change_Message_Config function, so that whatever you pass in message gets passed back in your callback function. Message can be any type.

Similar Messages

  • Pass a COM object across processes

    Hi,
    I need to pass a COM object from process A to B.  I didn't find a good code example for IMoniker.  So I am trying to test a simpler solution.  Please refer to the following snippet of code.  There is a problem.  When the execution
    reaches GetActiveObject in B, the system hangs.  "HRESULT h" in several places returns S_OK.   Does anybody have a clue?  Please help me out.  Thanks for your help in advance.
    // the definition of the COM object
    EXTERN_C const IID IID_IUniverse;
    #if defined(__cplusplus) && !defined(CINTERFACE)
        MIDL_INTERFACE("91CAF3F6-BD4D-4DDC-9C35-59F5DB20D570")
        IUniverse : public IDispatch
        public:
    // PROCESS A:
    HRESULT h = RegisterActiveObject (cwApp, IID_IUniverse, ACTIVEOBJECT_STRONG , &dwRegister);
    // PROCESS B:
    HRESULT h = CoInitialize(NULL);
    IUniverse *p = NULL;
    HRESULT h = GetActiveObject(IID_IUniverse, NULL, (IUnknown**)&p);
    if (p)
      CComPtr<IUniverse> cwApp(p);
    JD

    On 1/27/2015 7:43 PM, jdyng77 wrote:
    I did some research on this issue to help me better understand your comments here.  I still don't fully understand the problem.  Please help me out.  Or, if I can get around the problem by using IMoniker and IRunningObjectTable instead,
    I would be more than happy doing that.
    Unlikely. If, as I suspect, the problem is that the server thread blocks, then the client won't be able to obtain the interface pointer from it by any means. Any IPC mechanism you might want to use kind of assumes that both parties remain responsive.
    WaitForSingleObject() is the opposite of "responsive".
    The third party (3rd pty) provides a COM interface.  I write a COM server A
    In-process (a DLL) or out-of-process (an EXE)? From your description, I would assume in-proc.
    that has an implementation for this interface.  I believe the 3rd pty must have called CoInitialize(NULL) before it instantiates object A.
    It must have, yes. This is only significant if A is an in-proc server.
    The 3rd pty passes a COM object of IUniverse to A.  I can call IUniverse's methods in A without any problem.  The need here is to transfer the IUniverse object to another process B so that B can call IUniverse's methods.  The problem
    is that B hangs.
    My guess is, B hangs because A hangs. In one of your responses, you suggest that you are calling WaitForSingleObject (waiting on process B's handle, I presume). In so doing, you have created a deadlock. B is trying to communicate with A to retrieve the
    interface pointer, but A is waiting for B to exit.
    After A registers IUniverse pointer (whether in ROT or as active object), it should return to the caller. Said caller likely spins a message pump - but by blocking and not returning, you don't allow it to run.
    The thread where A sits is created in the 3rd pty.  If I understand you correctly, the 3rd pty must "retrieve and dispatch window messages in a timely manner".  I think it does because it calls A when a window button is clicked.
    3rd pty would, if only A would let it. By sitting in the message handler, A prevents the caller from retrieving messages in a timely manner.
    But I don't know whether I should use Class, File or Item IMoniker.
    Item moniker is the easiest to use by far. It just wraps a piece of text. You create one with CreateItemMoniker: pass L"!" (by convention) in the first parameter, and arbitrary string in the second. Both parties (one that registers in ROT, and
    one that picks up) should agree on and use the same string, of course.
    Igor Tandetnik

  • How can I call a COM object from a PL/SQL CODE

    Hi everyone,
    Does anyone know how to call a COM object from a stored procedure in oracle.
    a sample of code
    please help,
    Hilaire

    Are you familiar with external procedures? Basically, you can expose functions exported by a shared library (i.e. a DLL on Windows) to the Oracle database. My assumption is that you'd probably need to write a wrapper DLL around the COM object, since I believe you can only pass fundamental data types back and forth (i.e. no object references). You'd expose the method(s) of that wrapper DLL to the database via external procedures.
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com/askDDBC

  • How can I use a COM object that does not have a type library?

    Hello,
    I've created a com server in python for which I do not have a type library. I am able to call functions for this application in Python, TCL, I'm sure VB, etc. without the type library.
    Must I have a type library registered to use this COM object with Labview? I was hoping I could simply supply the name to the refnum (or the GUID) then call functions by passings strings to the invoke node. This does not seem to be possible - am I missing something?
    In the event that I cannot use a com server without a type library. Any recommendataions on how to create one? I'm wondering if I can use the same GUID and create a shell in LabWindows which generates the IDL/TBD file I need for Labview to see my
    com server.
    Any help is greatly appreciated.
    73,
    Timothy

    Timothy Toroni wrote:
    > Thanks for the info, however their example is labview server and
    > python client. I'm going the other way. It's good to know about
    > LabPython though...
    >
    > As of now, it seems to be there is no way to use a COM object without
    > a type library from inside LabView.
    Yes that is true. LabVIEW needs that to configure the Property and
    Methode Nodes correctly. Otherwise it would need to have a special
    Property and Method Node with a configuration dialog similar to the Call
    Library Node, but a LOT more complicated. Not sure many people could
    make use of that, and it would be a very tiring experience trying to get
    things setup in that way, by going through the edit, test, and crash
    cycle over and over again.
    Rolf Kalberm
    atter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Error passing a remote object in a rmi function call

    Hi,
    I've a problem passing an UnicastRemoteObject extended object in a rmi function call. I get the following error
    java.lang.IllegalArgumentException: argument type mismatch
    I've 2 Remote Objects: GalaxyRegistration and Station. I want to pass a Station Object as argument in a function from GalaxyRegistration. Does anyone know what the problem is?
    Here is the code:
    public class GalaxyRegistration
    extends UnicastRemoteObject
    implements GalaxyRegistrationInterface, Galaxy {
         public GalaxyRegistration() throws RemoteException {
         public void add(Station station) throws RemoteException {
              stations.addElement(station);
              System.out.println("Add Station " + station.getName());
    public class Station
    extends UnicastRemoteObject
    implements StationInterface {
         SystemInfo system;
         public Station(String name, String description, Coordinate position, Profile profile)
    throws RemoteException {
              system = new SystemInfo(name, description, position, profile);
    public class StationServer {
         Station station;
         public void run() {
              // create new Station
              System.out.println("Create new Station:");
              // register and bind new station
              try     {
                   station = new Station(name, descr, location, profile);
                   System.out.println("Station created ...");
                   GalaxyRegistrationInterface registry =
                             (GalaxyRegistrationInterface)
                             Naming.lookup
    ("//localhost/GalaxyRegistration");
                   System.out.println("Registry looked up ...");               
                   // >>>>>>>> NEXT LINE IS THE ERROR LINE <<<<<<<<<<<<<<     
                   registry.add(station);
              } catch(Exception e) {
                   System.out.println(e);
    }

    regardless of any other problems in your code, neither of the objects which you are subclassing from UnicastRemoteObject call the superclass constructor, which is a pretty basic flaw - in this case, it will lead to neither of these objects being exported properly.

  • How can I pass Recordsets as input parameter to a Function ?

    Hi Gurus,
    I want to create a function that receive recordsets as input parameter also returns recordsets as output.
    I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
    From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
    My question is : how to pass the recordsets as input parameter to that function ?
    (because I could have 75 rows item in one order number)
    Below is the DDL and the query :
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
    insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
    insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
    insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
    insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
    insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
    insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
    insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    The query for stock taking :
    select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
    from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
    from stocks s,order_detail o
    where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
    where (sm - qty_ord) < qty_available

    Hi,
    This my requirement :
    I have (simplified)Order_Detail as below :
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    Then I want to do stock taking from my STOCK table (described on my first post on this thread)
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    The rule is : The stok taking is on First In First Out basis, on expireddate.
    And I want to do it in single query.
    I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
    That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
    Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
    I hope this clear my requirement, is this possible ?
    Thank you,
    xtanto

  • How do I pass parameters modified by the SequenceFileLoad callback?

    I have some parameters in a sequence file that I want modified based on where the test station is located. I do not have that much experience with callbacks and have been reading up but wanted to reach out to the community as well. I know now that whatever is modified in the SequenceFileLoad callback is not passed onto the main sequence as it has not been started at this point. So what I am trying to do is have the operator choose a test facility once and have the parameters set and not have to choose everytime the sequence is initiated. I basically want the paramters set once, like when the fle is opened, and then it is done. Any help in how to implement this would be greatly appreciate.
    Thanks,
    Troy

    Happy to help out! I created an example which is attached to this message. This is what it does:
    In SequenceFileLoad, it first checks to see if StationGlobals.TestFacility exists, and if not, it creates that variable. 
    If the StationGlobal is set to "" (blank string), a prompt is displayed for the user to enter the facility. A post-expression on the Message Popup step sets the StationGlobals.TestFacility variable with this value.
    When you execute MainSequence after loading the file, the current TestFacility is displayed.
    The code could be simplified a bit if you can guarantee that StationGlobals.TestFacility will always exist as a variable. For example, the #NoValidation tags you see in some of the expressions are there because the StationGlobal may not exist prior to runtime. You could create the station global on your dev machine and deploy StationGlobals.ini to all test machines to ensure all machines have the variable and not need that part of the code, but I prefer the dynamic method because it won't cause an error if the station global is deleted for some reason.
    I hope this helps clarify things a bit, and let me know if you have any questions about it!
    Daniel E.
    TestStand Product Support Engineer
    National Instruments
    Attachments:
    TestFacility_2010.seq ‏8 KB

  • How can I pass a path to the FileReference upload function?

    i don't understand how can i upload a file from the browse
    function after you've selected a file. since FileReference.name
    returns
    only the filename w/extension and not the path, how can i
    work around this?
    i understand the security implications with a swf and the
    such, but what to do? and using an AIR app is not an option for me.
    i have a .net web service in place and it works with a hard
    coded string, such as in the snippet below, but how are people
    doing this by using the browse method as oppossed to a static
    string?
    i get an IO error with just the browse() returned filename,
    which makes sense when you think about it. path, path, path...ARGH!
    thanks folks...
    -fd

    i don't understand how can i upload a file from the browse
    function after you've selected a file. since FileReference.name
    returns
    only the filename w/extension and not the path, how can i
    work around this?
    i understand the security implications with a swf and the
    such, but what to do? and using an AIR app is not an option for me.
    i have a .net web service in place and it works with a hard
    coded string, such as in the snippet below, but how are people
    doing this by using the browse method as oppossed to a static
    string?
    i get an IO error with just the browse() returned filename,
    which makes sense when you think about it. path, path, path...ARGH!
    thanks folks...
    -fd

  • TO_DATE - How do I pass the date and time to the function

    Hi,
    I am writing a PL/SQL code. The code has a simple cursor,
    For the criteria, I am using a column called 'created' which is a date column, and the to_date function.
    I would like to pass the date and time to the to_date fuction as a parameter, date_value, as shown below.
    CURSOR opty is
    select a.name, a.id
    from s_opty a
    where a.created > to_date(date_value, 'DD/MM/YYYY HH24:MI:SS');
    I've tried declaring a bind variable,
    date_value date := '&1'
    but no joy.
    Any ideas would be welcomed.
    Thanks in antcipation
    Mukesh

    Can this help you?
    SQL> create or replace procedure sample_proc
      2  as
      3  cursor c1(v_value varchar2) is
      4          select 'YES' from dual
      5            where trunc(sysdate) = trunc(to_date(v_value, 'DD/MM/YYYY HH24:MI:SS'));
      6  v_char varchar2(10);
      7  begin
      8     open c1('08/03/2006 11:35:20');
      9     fetch C1 into v_char;
    10     dbms_output.put_line('Is it today''s date?> '||v_char);
    11     close c1;
    12  end;
    13  /
    Procedure created.
    SQL> begin
      2    sample_proc;
      3  end;
      4  /
    Is it today's date?> YES
    PL/SQL procedure successfully completed.
    SQL> If you are not very particular about the time, you can use TRUNC on both sides like :
    where trunc(a.created) > trunc(to_date(date_value, 'DD/MM/YYYY HH24:MI:SS'));Cheers
    Sarma.

  • How to pass the java object into the spring controller

    Hi Friends
    When I hit the url at the first time my call goes to the spring controller and sets the userDetails objects in the modelAndView.addObject("userDetails", userDetails.getUserDetails()) and returns the userDetails.html page. if I click any link in the same page i want to pass same (userDetails) object thru javascript or jquery and calls the another(controller) method and returns the same (userDetails.html) page.
    It means how can i pass the java object thru javascript or jquery and calls the controller. if i get the same object in my controller i can avoid calling the db again. please help me out to resolve this issue. i am tired of fixing this issue.
    Regards
    Sherin Pooja

    If you want to avoid calling the database again then cache the data.
    However before you do that make sure that calling the database, in the context of YOUR system, is going to be an actual problem.
    For example there is absolutely no point in caching a  User object when only one user an hour is actually using the system.

  • Passing a Vector object as a parameter to a method

    Hi,
    How can I pass a Vector object as a parameter to a method?
      void buttonAdd_actionPerformed(ActionEvent e) {
        Vector studentHobbies = new Vector();
          String[] items = listHobbies.getSelectedItems();
          for (int i=0; i<items.length; i++) {
            studentHobbies.addElement(items);
    newStudent = new Student(Name,StudentNumber,studentHobbies);
    studentenlist.addTo(newStudent);
    So I want to pass the Vector object 'studentHobbies'  to a method.
    Would I do something like this :import java.util.Vector;
    public Student(String Name, int StudentenNumber, Vector studentHobbies){
    this.Name = Name;
    this.StudentNumber = StudentNumber;
    this.studentHobbies = StudentenHobbies;

    yes, thats how you do it.
    maybe you should first try your idea and then ask people questions?
    also, use ArrayList instead of Vector, its better - google as to why if you care.

  • Connect to COM(OBJECTS/METHODS) FROM ABAP

    Dear all.
    How can I connect to COM objects/methods from abap?
    Could give me link to example.

    Yes this method raises and exception with this message
    Message ID:          FDT_CORE
    Message number:      085
    DO_IM_DATETIME is not in the context
    The method SET_VALUE corresponds to IF_FDT_CONTEXT. This is the method's calls
          lv_name = 'DO_IM_DATETIME'.
          TRY.
              o_context->set_value( iv_name =  lv_name
                                    ia_value = lv_element_tzone ).
            CATCH cx_fdt INTO lx_fdt.
              RAISE incorrect_parameter.
          ENDTRY.
    I reactivate the aplication, the function, the expression and the data objects.
    But the method is still giving this exception.
    I have only this exception when I try to set up this two parameters:
    DO_IM_DATETIM of type Timepoint
    DO_IM_LANGU which is binding to the element type LANGU
    But in my BRFPlus Function Context I do have this two parameters.
    Thanks !

  • Using a request scope object in a javascript function

    Hello,
    is there a way to obtain a reference to a request scope attribute in a javascript function?
    or after using <jsp:useBean id="myBean" ...>, how do I pass the "myBean" object to a javascript fuction?
    Thanks for any help.
    E-

    ok, thanks...this is working for a string property of a bean... but I get an 'invalid character' error when I want to create an actual reference to the bean object itself.
    here is the jist of what I need to get working... myBean has a property 'listItems' that is a Vector of listBeans.
    function buildList() {
    var myBean = <%=request.getAttribute("mybean")%> ;
    // get referenence to the Vector property listItems
    var list = myBean.getListItems();
    // now I want to iterate the list and use the properties of the list beans
    for (x = 0 ; x < list.size() ; x++ ) {
    var listBean = list[x];
    var foo = listBean.getFoo();
    // need to use foo to populate a hierarchical list
    can I do this in JavaScript??? do I need to cast the classes to the variables?

  • How to access new data in User Message Event Callback?

    I am using the Simple LabVIEW OI as the model for my TestStand user interface.
    The sequence sends a User Message to the OI to request the string array of tests to run.
    But I am having great difficulty making this string array data available to the event callback VI.
    I do not want to use a global variable and so my unsuccessful method so far has been as follows:
    1. Use a Refnum to the Array and pass it into the Config Event Callbacks VI via the cluster 
    2. The "Selected Tests" in the input cluster in the Config Event Callbacks VI is a generic Control Refnum
    3. This Selected Tests (at the bottom) is then bundled and passed into the User Parameter
    4. But how do I convert the Selected Tests Control refnum back into the original string array in the actual callback?
    Also if there is anyone that can suggest a better way of doing this then please let me know.
    The bottom line is - how to get the latest data into the event callback function when it is called?
    Many thanks,
    Ronnie
    TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
    Solved!
    Go to Solution.

    Hi Ray,
    The 'Selected Tests' array refnum is #4 in the cluster order and matches all the way through - so I think that's OK.
    In the final diagram above, I can get the Selected Tests cluster from the 'User Parameter', but it is still in the form of a refnum.
    My problem is a lack of understanding in how to convert this 'Selected Tests' refnum back to the original data type (a string array).
    Basically I want to get the string array from the 'Selected Tests' refnum.
    As you can see from above I tried to use a property node. I've also tried to 'cast' the refnum to a 'more specific class' by choosing 'Array' but it's still ends up as a refnum.
    I hope you see what I mean?
    Thanks,
    Ronnie
    TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009

  • XSLT - How to pass a Java object to the xslt file ?

    Hi ,
    I need help in , How to pass a java object to xslt file.
    I am using javax.xml.transform.Tranformer class to for the xsl tranformation. I need to pass a java object eg
    Class Employee {
    private String name;
    private int empId;
    public String getName() {
    return this.name;
    public String getEmpId() {
    return this.empId;
    public String setName(String name) {
    this.name = name;
    public String setEmpId(int empId){
    this.empId = empId;
    How can i access this complete object in the xsl file ? is there any way i can pass custom objects to xsl using Transformer class ?

    This is elementary. Did you ask google ? http://www.google.com/search?q=calling+java+from+xsl
    ram.

Maybe you are looking for

  • I home shared from my PC to my new Mac and now my iTunes can't locate the original files?

    It was working fine for about 12 hours but now my iTunes can't locate any of the files. None of my songs will play, even those I downloaded directly from a CD. Help?

  • I cannot get my new second isight to work on my titanium G 4 powerbook

    My situation is as follows: I have a macbook pro and Mac-Mini both with the intel chip and a 12 and 17 inch Powerbook G 4. and a Titanium G 4 Powerbook 15 inch. I have isight on the macbook pro and purchased a two isight devices to use on my other co

  • Import photos from iPad to iPhoto keeping album structure

    Hi All, I have an iPad 2 with a camera connect kit.  I've imported and organised several hundred photos using the kit and the iPad.  I just purchased a Macbook Pro and want to import those photos into iPhoto.  The photos all imported, but the album s

  • REALLY SLOW SHUT DOWN!

    I'm having trouble with shutting down my MacBook. Sometimes it takes forever to shut down. One night it took 10 minutes, sometimes half an hour can go by and it'll still be in the process of thinking about it. In the end I just have to hold down the

  • ICal service grayed out for users in Server Preferences

    In Server Preferences all the services are enabled and the buttons are green only on the home page of Server Preferences but, when I click on users, then Services, all the services are available to check and uncheck but the iCal service. iCal service