CALLBACK functions in cvi

hi,
Need a simple clarification on working with callback function.
i have 3 different callback buttons function as start test, stop test, quit.
Whenever Start test button is pressed by EVENT_COMMIT, it calls some functions and executes the same. in the middle of this function execution i need to stop the test by pressing stop test button or i need to quit the interface. How can i do this?
i am facing problem like once i press the start button i am not getting controls to other button until the all functions available inside start button gets completed.
Thanks in advance
Solved!
Go to Solution.

The sleep (1000) and not calling ProcessSystemEvents () are the reasons!
Sleep () completely blocks the program until the time has expired. It is advisable that you dont call it for long intervals!
If you don't call ProcessSystemEvents () you cannot get stop button press
Try modifying the code this way:
int    requestToStop;    // Define this at module level
int CVICALLBACK Btn_Start_Test (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
switch (event)  {
 case EVENT_COMMIT:
   requestToStop = 0;    // Clear stop flag and start the test
   if (Tree_getselectedChilditems())
       MessagePopup ("Info", "Operator stopped the test!");
   else
       MessagePopup("Info","TEST COMPLETED SUCCESSFULLY");
   break;
 return 0;
int CVICALLBACK btn_stop_test (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
 switch (event)  {
  case EVENT_COMMIT:
    requestToStop = 1;
//  XL_KillWindowsProcess("EXCEL.EXE");//not exactly excel file,it may be any file which is running 
    break;
 return 0;
int Tree_getselectedChilditems (void)     //double testcaseno)
 int noOfItems;int val,i;  //int index;
 int noOfChild,index=1;
 char treelabel[500]={0};
 char charval;char TCno[100];
 int select;  char testno[100]={0};
 double tini;
  for(error = GetTreeItem (panelHandle, PANEL_TREE, VAL_CHILD, 0, VAL_FIRST, VAL_NEXT_PLUS_SELF, VAL_MARKED, &index);
          index >= 0&&error<=0;error = GetTreeItem(panelHandle, PANEL_TREE, VAL_ALL, 0,
                index, VAL_NEXT, VAL_MARKED, &index))
         GetTreeCellAttribute(panelHandle, PANEL_TREE,
            index, 0, ATTR_LABEL_TEXT, treelabel);
   Scan(treelabel,"%s",TCno);
   strcpy(testcaseno,TCno);
//   Sleep(1000);     // Substitute this line with the following code
     tini = Timer ();
     while (Timer () - tini < 1.0) {
        ProcessSystemEvents ();
        if (RequestToStop) break;     // Operator stoo
   readTestcasesheet(ExcelWorkbookHandle, ExcelWorksheetHandle,testcaseno);
   Fmt(treelabel,"%s",""); 
   if (RequestToStop) break;     // Operator stop
  return requestToStop;
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • External Function with a Pointer to a Callback Function Inside a DLL

    Hi.
    I'm loading a DLL and trying to call a function with the following prototype:
    Func1(HANDLE, hHandle, LPVOID (*pCallback)(UINT, UINT LPVOID), CHAR* sPath)
    Now, I have no problem with the variable types, because CVI 9.0.1 recognizes all of them and I have no problem with LoadLibrary() nor with GetProcAddress().
    But, how do I pass a pointer to a callback that is inside the DLL I'm trying to use.
    I've tried to declare the callback like this:
    LPVOID (CALLBACK Callback)(UINT iDevNo, UINT evEvent, LPVOID pData);
    and call the function Func1 like this:
    (Func1)(hHandle, &Callback, NULL);
    but this gets me:
     Undefined symbol '_Callback@12' referenced in "source.c".
    Hope I can get some help.
    I appreciate your time on this issue.
    Regards.
    Daniel Coelho
    VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
    Controlar - Electronica Industrial e Sistemas, Lda
    Solved!
    Go to Solution.

    Hi Daniel,
    First, you have to make sure that the callback function is exported by the DLL, so that the program that uses the DLL can access the function name identifier. Then, you have to make sure that you call GetProcAddress not just on Func1, but also on the exported callback function. You need to store both function address values in their respective function pointers. You then can pass the callback function pointer as an argument to the Func1 call.
    It's probably cleaner if you define typedefs for all your function pointers, in the calling program:
    typedef LPVOID (__stdcall *CallbackType) (UINT , UINT, LPVOID);
    typedef ??? (__stdcall *Func1Type) (HANDLE, hHandle, CallbackType, CHAR*);
    CallbackType     CallbackPtr;
    Func1Type        Func1Ptr;
    dllHandle = LoadLibrary ("...");
    CallbackPtr = (CallbackType)GetProcAddress (dllHandle, "Callback");
    Func1Ptr = (Func1Type)GetProcAddress (dllHandle, "Func1");
    Func1Ptr (..., hHandle, CallbackPtr, NULL);
    Boa Sorte!
    Luis

  • Control array of callback functions?

    Apologies for my basic question.
    I am experimenting with control arrays and so far am able to collect data in string controls that are inside control arrays.  Works well.  Naturally, none of these controls need callback functions.
    Now I have need of some momentary command buttons in a control array as well.  So my question is, should I use a single callback function for all of the button controls in that single array?  And if so, how do I go about identifying which element in the control array called the function?  From reading on the forums, it seems as if use of the callback data parameter might get me there.
    Just wanted to ask before I get off track.  Thanks!
    Solved!
    Go to Solution.

    Yes, callbackData can be of help in such a situation, but if you can limit to switch on array index to discriminate what to do your button callback could be something on this line:
    int CVICALLBACK BtnAttayCallback (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
    int handle, index;
    switch (event) {
    case EVENT_COMMIT:
    handle = GetCtrlArrayFromResourceID (panel, control);
    GetCtrlArrayIndex (handle, panel, control, &index);
    switch (index) {
    // Your code here
    return 0;
     (No CVI install here so I cannot test it: double check the code but it should reasonably work)
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • ProcessSystemEvents & callback functions

    Hello.
    I have a question about the ProcessSystemEvents() and callback functions. If I have the following "strange" callback function with the follwoing code inside:
    int func(...) {
      while(true) {
       ProcessSystemEvents();
    Could this code create a crash in the underlying run-time lib (cvirte.dll etc), with to many calls to ProcessSystemEvents?
    And will this code stop any other callback function from execution, since we are in an infinite while loop?
    Best regards,
    Christian G.

    A fuction like that should be called only once, if this is what you intend. While sitting in the loop, ProcessSystemEvents permits the system to react to events like the user pressing a button or something like this. You must explicitly avoid dangerous events like calling the function again and again, as well as all user actions that can cause problems (like modifying critical parameters while the function is running, improperly exiting the program and so on). To obtain this you may either disable unwanted buttons on the GUI or set a global flag 'system running' tested on all callbacks and functions to protect the system from unwanted operations.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to create a callback function module

    Hi all,
    I am working in a requirement where we need to call a function module at a 'after change' event. So how to create a callback function module and register it with the crmvevent ?_
    I created a sample function module and try to create entries in table crmv_event_cust, but i got an error message saying that the function module name I provided is not in table CRMC_FUNC_ASSIGN. When I try to create entry there, I got a message that function module is not in CRMC_OBJ_FUNC and that table is a standard table with no maintanance options !!
    looks like i am going in wrong way ... can any one please help ??

    Looking at my system all you need to do is create the entry for the callback function in maint view: CRMV_FUNC_ASSIGN.
    Your entry should be as simple as Z-function name Object Function - <same as others in the segment you are assigning>
    IE for the partner it would be CRM_PARTNER as object function, for general order processing CRM_ORDER
    Take care,
    Stephen

  • Calling a method from a callback function under ARC

    Hi All
    I previously wrote some HIDManager software. The HIDManager references were done in a Objective C class so within this object you have the code:
        IOHIDManagerRegisterDeviceMatchingCallback( k8055HIDManager, k8055BoardWasAdded, (__bridge void*)self );
    Which registers with the HIDManager
    The Callback function which is outside the class was as follows:
    static void k8055BoardWasAdded(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef k8055HIDDevice)
        IOHIDDeviceOpen(k8055HIDDevice, kIOHIDOptionsTypeNone);
        CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
        [k8055 setHardwareConnectionStatus : YES];
    Any how my problem is in converting the code to ARC as under OS X 10.9 SDK and 64bit I'm now getting a EXC_BAD_ACCESS (Code=EXC_I386_GPFLT) at this line
        CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
    although removing the method
    [k8055 setHardwareConnectionStatus : YES];
    will alow it to build but then obviously the app won't work as required.
    Could someone suggest a ARC safe way of accessing the passed instance so I can again call methods on it.
    Cheers
    Steve

    Try using blocks instead. This is the callback I am using for libcurl.
    static size_t callback(
      void * contents, size_t size, size_t nmemb, void * context)
      size_t (^block)(void *, size_t) =
        (__bridge size_t (^)(void *, size_t))context;
      size_t result = block(contents, size * nmemb);
      return result;

  • How to change the Callback function of a GUI button?

    I would like to change the callback function associated with a GUI button dynamically in the programming way.
    Here is the code piece I tried, but it does not seem to work:
    const char* pstrLabelSaveJpeg = "SaveJpegCb";
    SetCtrlAttribute(pahel_id, ctrl_id ,ATTR_LABEL_TEXT, pstrLabelSaveJpeg);
    int CVICALLBACK SaveJpegCb(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
    Solved!
    Go to Solution.

    The attribute you used is about the "label" of the button.
    It is just an appearence attribute. You can write your own name on it, but that does not change the callback function.
    You should change the ATTR_CALLBACK_FUNCTION_POINTER attribute, and you should not pass the function name as a string.
    So your function call will look like this:
    SetCtrlAttribute(pahel_id, ctrl_id, ATTR_CALLBACK_FUNCTION_POINTER, SaveJpegCb);
    Of course, you have to declare the SaveJpegCb function somewhere above that line.
    I think you have already done that.
    S. Eren BALCI
    www.aselsan.com.tr

  • Queue with callback function not dequeuing

    Hi,
    I would like to ask you for help or for a hint regarding our problem with the queue:
    A trigger is enqueuing to a queue. This works fine, but the callback function is never called. The queue already worked for a while, but since i changed something at the procedure called by the callback it does not work anymore.
    I already have tried the following:
    -Stopping and restarting
    -Dropping and recreating (with the scheduler having no jobs anymore)
    -Dropping, restarting the database and recreating
    None of these worked. Where do I fail, when considering that the queue with the same scripts worked already? I post the script for creating the queue and adding the subscriber:
    CREATE OR REPLACE TYPE pat_history_queue_payload_type AS OBJECT
    ( TSTAMP VARCHAR2(22 CHAR),
    TYP VARCHAR2(10 CHAR),
    DELTA_MENGE NUMBER,
    ORIGIN VARCHAR2(1 CHAR),
    TEXT VARCHAR2(1000 CHAR),
    QL_TSTAMP VARCHAR2(22 CHAR)
    BEGIN
    DBMS_AQADM.CREATE_QUEUE_TABLE (
    queue_table => 'pat_history_queue_table',
    queue_payload_type => 'pat_history_queue_payload_type',
    multiple_consumers => TRUE
    END;
    BEGIN
    DBMS_AQADM.CREATE_QUEUE (
    queue_name => 'pat_history_queue',
    queue_table => 'pat_history_queue_table',
    max_retries => 10
    DBMS_AQADM.START_QUEUE (
    queue_name => 'pat_history_queue'
    END;
    BEGIN
    DBMS_AQADM.ADD_SUBSCRIBER (
    queue_name => 'pat_history_queue',
    subscriber => SYS.AQ$_AGENT(
    'pat_history_queue_subscriber',
    NULL,
    NULL )
    DBMS_AQ.REGISTER (
    SYS.AQ$_REG_INFO_LIST(
    SYS.AQ$_REG_INFO(
    'pat_history_queue:pat_history_queue_subscriber',
    DBMS_AQ.NAMESPACE_AQ,
    'plsql://PAT.HISTORY_QUEUE_DISTRIBUTION.CALLBACK',
    HEXTORAW('FF')
    1
    END;
    The function CALLBACK which is called by the queue, is never called, I checked that with log messages. Also the package that contains the function is compiled ok.
    Thanks.
    Roland

    Hi,
    Does the subscription show up correct in sys.reg$ ?
    Regards,
    Harry
    http://dbaharrison.blogspot.com/

  • TCP Callback function passing data to teststand

    Hi,
    I'm trying to pass data via a TCP Callback function to teststand using the TCP steptype that I downloaded from Ni.
    When I open a connection, container data is passed to the dll on which it creates a connection, the dll in part creates a TCP Callback function.
    The handle obtained from the connection is then passed back through the container data, and the dll returns back to the sequence editor which will execute the next steps.
    The problem is that when the TCP Callback function gets an TCP_READY event it can not pass data to TestStand because it can not access the container data.
    How can this TCP Callback function pass/alter data to/in Testand?
    Thank you...

    Yes ThiCop,
    That's exactly what I want to establish!
    Here is the example code:
    //Function needed by the TCP functions
    int CVICALLBACK MsgHandler (unsigned handle, int event, int error, void *callbackData)
        char receiveBuf[256] = {0};
        char displayBuf[7] = {0};
        char * tempLookup;
        int  dataSize = sizeof (receiveBuf) - 1;
       switch (event)
          case TCP_CONNECT:
             break;
          case TCP_DISCONNECT:
             break;
          case TCP_DATAREADY:
             if ((dataSize = ClientTCPRead (handle, receiveBuf, dataSize, 1000)) > 0)
                   //  Send data from receiveBuf to a variable in teststand ????
                   //  TS_PropertyGetValString (HandleObject, NULL, "Step.Result.Data", 0, &tempLookup);
                   //  TS_PropertySetValString (HandleObject, NULL, tempLookup, 0, receiveBuf);
             else
                   receiveBuf[dataSize] = '\0';
            break;  
     return 0;
    void __declspec(dllexport) TX_TEST TCPConnectF(tTestData * testData, tTestError * testError)
        int                 error = 0;
        int                 TCPerror;
        double           Port;
        double           Timeout;
        char              *HandleLookup;
        char              *ServerAdd;
        char              *CallbackData;
        ErrMsg           errMsg = {'\0'};
        ERRORINFO   errorInfo;
        tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.Handle", 0, &HandleLookup));
        tsErrChk (TS_PropertyGetValNumber (testData->seqContextCVI, &errorInfo, "Step.Result.Port", 0, &Port));
        tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.IP", 0, &ServerAdd));
        tsErrChk (TS_PropertyGetValNumber (testData->seqContextCVI, &errorInfo, "Step.Result.Timeout", 0, &Timeout));
        tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.Data", 0, &CallbackData));
        TCPerror = ConnectToTCPServer (((unsigned int *) &ConnectionHandle), ((unsigned int) Port), ServerAdd, MsgHandler, 0, Timeout);
        if (TCPerror != 0)
         //Get TCP Error Message
           sprintf(errMsg,"%s",GetTCPErrorString ( TCPerror ));
           error = TCPerror;
           goto Error;
        tsErrChk (TS_PropertySetValNumber (testData->seqContextCVI, &errorInfo, HandleLookup, 0, ((double) ConnectionHandle)));
    Error: 
        // FREE RESOURCES
        CA_FreeMemory(HandleLookup);
        CA_FreeMemory(ServerAdd);
        // If an error occurred, set the error flag to cause a run-time error in TestStand.
        if (error < 0)
            testError->errorFlag = TRUE;
            testError->errorCode = error;
            testData->replaceStringFuncPtr(&testError->errorMessage, errMsg);
        return;   

  • MIDI in using DLL callback function

    I am trying to get MIDI into LV. The dll used is winmm.dll and the function midiinopen (plus others) is described here:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midiinopen.asp
    The main problem is I don't know how to program the Call Library Function Node properly in order to perform the call
    plus set it to start receiving callback data, being midi messages. I have tried creating and registering a User Event and
    passing the Event ref to the dll's "dwCallback" and then trapping the callback in an Event Structure, but nothing happens.
    I have studied the "Communicating with a Windows MIDI Device in LabVIEW" example but it gives no hint since midi out
    does not require the use of callbacks.
    Please advice,
    Stefan

    Vedeja wrote:
    I am trying to get MIDI into LV. The dll used is winmm.dll and the function midiinopen (plus others) is described here:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midiinopen.asp
    The main problem is I don't know how to program the Call Library Function Node properly in order to perform the call
    plus set it to start receiving callback data, being midi messages. I have tried creating and registering a User Event and
    passing the Event ref to the dll's "dwCallback" and then trapping the callback in an Event Structure, but nothing happens.
    Damn! Need to make this post shorter as this message
    board just silently told me that it needs to be shorter than 5000 words
    and ate up my lengthy repsonse with no way to get it back.
    You can't configure a Call Library Node to pass a Callback function to
    another function. Callback functions have been alien to LabVIEW for a
    long time with good reasons and what it has now as callback function in
    LabVIEw 7.1 and newer is not directly compatible with C callback
    functions.
    Basically as you want to get data from the callback function back into
    LabVIEW there is really no way around some intermediate software layer
    which in this case almost surely means your own specific wrapper DLL
    written in C.
    If you use LabVIEW 7.1 you could use user events but not in the way you
    describe. Attached is an example of how you can use user events from
    external code. Note the extra DLL you will have to write. You have to
    watch out what data you pass back to the user event as it has to match
    exactly the type you configured the user event for, otherwise LabVIEW
    will simply crash on you.
    For numerics this is quite simply and also shown in the example. For
    strings you can't just pass back a C string pointer but you will have
    to allocate a LabVIEW string handle with
    handle = DSNewHandle(sizeof(int32) + <length of C string>)
    and then copy the C string into it. For specifics about how to do this
    you should refer to the External Code reference manual in your Online
    Bookshelf. Similar rules apply for arrays or clusters for that matter.
    If you want or need to do this for LabVIEW < 7.1 there are two
    possible approaches but both are even less trivial. You could either
    create a wrapper DLL that translates your callback events into LabVIEW
    occurrences and for the data transfer back to LabVIEW you would have to
    implement your own queing too, or you could use the Windows Message
    Queue example somewhere here in the NI examples and adapt it to return
    your specific data. That would solve the data queueing more or less for
    you without having to worry about that.
    Rolf Kalbermatter
    Message Edited by rolfk on 05-22-2006 11:22 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions
    Attachments:
    userevent.zip ‏27 KB

  • JNI Multithreading/Callback Function Design Issues

    Ok, I have been working on this for quite some time now and I simply can not figure it out. So any ideas are more than welcome. :)
    I have Java code that uses a DLL that I created in C++. My C++ code links with a library made by a 3rd party (don't have access to the source or anything). The 3rd party's code creates a new thread and calls a callback function that I define in my C++ code. This callback is called continuously until I perform some other code to stop it. Now for the tricky part. In my callback function I need to pass some data back in Java. Here is where my design falls apart. Since the callback function is technically part of the 3rd party's thread, I have to call AttachCurrentThread() in the callback to get the JNIEnv pointer in order to ultimately call my desired Java method. The problem is that my Java method (or even the C++ callback function) are only invoked if I do a sleep() in my C++ code after I start the 3rd party code which creates the thread. If I do a Thread.sleep() in Java after I call the native function code, it just sleeps and the callbacks never get called. It appears as though the thread dies as soon as I return from my C++ code.
    So now I am stuck. I have tried creating a thread in Java which simply calls the C++ code and the C++ code just loops waiting for an updated flag, however, this causes the 3rd party's thread creation code to fail (not quite sure why). However, even if their code worked, I'm not convinced this is even proper design. I apologize if this is simply a threading design principle as my multithreading programming techniques are a bit rusty and I've never done a multithreaded application this complex (this is a simplified version, but the idea is the same).
    I welcome any suggestions or even documentation that may lead me in the right direction. Thanks in advance.

    I have a similar issue.
    from java I call a dll I wrote, which calls a third party scanner dll (cyber.dll). Everything works ok, except, when an event in the scanner occurs, it calls the call backin my dll, which calls the callback in java, which kills the vm with an access violation. If I execute the call back to java from a c method which I just called from java, it works, but if it gets called outside of the java execution of the native code, it fails.
    I havent done anything with treads or syncronisation. Do I need to do this AttachCurrentThread stuff? If so, where do I get the _jvm handle as Im not starting the vm from c?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Callback functionality in Web dynpro

    Dear Experts,
    How i can implement a web dynpro application which gets updates from server without any interaction from the end user? in the same time I dont want to trigger a full refresh using timed trigger as this will slow the application.  is there any functionality like Ajax partial refresh or callback functionality?
    Best Regards
    ebrahime

    >
    ebrahime wrote:
    > Dear Experts,
    > How i can implement a web dynpro application which gets updates from server without any interaction from the end user? in the same time I dont want to trigger a full refresh using timed trigger as this will slow the application.  is there any functionality like Ajax partial refresh or callback functionality?
    >
    > Best Regards
    > ebrahime
    If you want to update with ajax a web dynpro application, you can not do this In CE 7.1 or earlier (I really don't know about 7.11). You can do this for example with a portal application, if it isn't something specific for the wd application you can move it outside and place it somewhere with your wd application, some playing with the pages will do this work.
    You can do another thing: place a portal application, which will be invisible and will call some web service via ajax and use portal eventing to "inform" your we dynpro application. But in this case when you receive the event it will behave like the timer trigger, it will redraw you page.

  • In VB6, why is the "GPIBNotify sub" (from the GPIBNotify AtiveX Ctrl) all the time called even if no Event happened? This callback function is started then stopped permanently as if its received SRQ from the GPIB Bus. Any ideas?

    I'm programming in Visual Basic 6 to communicate between a computer and HP Measurement Devices (BER-Meter) with GPIB. I have already read information and code for this. My platform is W98. The NI488.2 commands can be sent without any problem between the equipements. However when I'm using the GPIBNotify ActiveX Control to use the callback function, there is a permanent starting and stop of the GpibNotify Sub. The SetupMask and RearmMask are set to RQS and the HP Device is well configured. Moreover an oscilloscope measuring the 10th line (SRQ
    ) of the bus didn't show any pulse on the line behalf the right one. Any Idea?

    Hello-
    So, the SRQ is not detected by the oscilloscope? It must be a setting that is not correct with the instrument. Try contacting the manufacturer of the instrument for details about SRQ's. The GPIBNotify ocx will not be able to react to an SRQ if there isn't one.
    Randy Solomonson
    Application Engineer
    National Instruments

  • Import dll callback function

    Having trouble with this line "void   (*m_callback)(_t_pciCommand *cmd);" in PciApi.h file. I have replaced it with NULL and was able to import 2 functions, PciAllocCommand and PciSendCommand. I was then able to get valid information using GetValueByPointer.VI, but crash most of the time.
    typedef struct _t_pciCommand
                    t_pciCommandType                      m_command;
                    t_commandError                          m_error;
                    long                                               m_gpVal;
                    void                                                (*m_callback)(_t_pciCommand *cmd);
                    long                                              m_param[MAX_PCI_PARAMS];
                    int                                               m_state;
                    int                                               m_retries;
                    int                                               m_expected;           
                    long                                            m_origParam[MAX_PCI_PARAMS];
    } t_pciCommand;
    All files attached. Based on this callback funtion, I can't seem to resolve 2 functions, called PciAllocCommand and PciSendCommand.
    Thanks,
    John
    Solved!
    Go to Solution.
    Attachments:
    PciApiDll7.zip ‏630 KB

    The manual is "pci_api_manual_jb.doc", The funtion I care most about is PciAllocCommand and the #1 issue I have is how to pass "m_param[0]" , "m_param[1]" and "m_param[2]" to the dll. The original h file is "PciApp(original).h" . The second issue would be if removing the callback functionality I need a VI to poll the status of "t_PciCommand "Function without writing to it.
    For example, PciAllocCommand(c_baudrate, NULL, 0). How do I set baud = m_param[0]?
    Also I am adding a TestApp.exe example of what I want to do in Labview, focusing on the Param1 and Param2
    Attachments:
    PciApiDll7.zip ‏630 KB
    TestApp.zip ‏67 KB

  • How to implement a callback function using LabView's Call Library Function Node?

    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    The SDK.h deacribes the function as:
    //  Function:   SdkSetPropertyEventHandler
    SdkError SDKAPI SdkSetPropertyEventHandler(
                SdkCameraRef                    inCameraRef,
                SdkPropertyEvent                inEvnet,          
                SdkPropertyEventHandler         inPropertyEventHandler,
                SdkVoid*                        inContext );
    //  Description:
    //       Registers a callback function for receiving status
    //          change notification events for property states on a camera.
    //  Parameters:
    //       In:    inCameraRef - Designate the camera object.
    //              inEvent - Designate one or all events to be supplemented.
    //              inPropertyEventHandler - Designate the pointer to the callback
    //                      function for receiving property-related camera events.
    //              inContext - Designate application information to be passed by
    //                      means of the callback function. Any data needed for
    //                      your application can be passed.
    //      Out:    None
    //  Returns:    Any of the sdk errors.
    A separate header file called SDKTypes.h contains the following data:
    typedef  SdkUInt32  SdkPropertyEvent;
    typedef  SdkUInt32  SdkPropertyID;
    typedef  void       SdkVoid;
    typedef  struct __SdkObject*    SdkBaseRef;
    typedef  SdkBaseRef    SdkCameraRef;
     SdkPropertyEventHandler
    typedef SdkError ( SDKCALLBACK *SdkPropertyEventHandler )(
                        SdkPropertyEvent        inEvent,
                        SdkPropertyID           inPropertyID,
                        SdkUInt32               inParam,
                        SdkVoid *               inContext );
    Thanks for your help.
    Alejandro
    Solved!
    Go to Solution.

    alejandroandreatta wrote:
    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    Basically you do not do that. LabVIEW does not know pointers and certainly not function pointers. What you should do instead is writing a C DLL that implements the callback and also exports a function to be called by LabVIEW that translates between the callback and a LabVIEW user event. Look for PostLVUserEvent() here on the NI site to find examples how to do that.
    Rolf Kalbermatter
    Message Edited by rolfk on 02-11-2009 08:00 PM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • The import collides with another import statement

    What is this? Why this happens? I've just imported a class name to the JSP that has much more level imports. This JSP isn't even validated. I don't wanna rename my class has the same name as in one of the jar files on the class path.

  • IS a thread scheduler part of JVM or OS ?

    Hi Folks, Just curious if the thread scheduler is a part of the JVM or OS, or either or both ? I tried few thread pages in JLS,but couldnot locate the exact sentence describing this. However some other resources have given me contradicting informatio

  • Automating a Website with WebBrowser control, but proxy is getting in the way

    Hi I am trying to automate a website query through SSIS, I have a dll that uses the WebBrowser control to download the page, run the query and parse the returned page for detail. This works well on my development machine, including in the Agent, but

  • Total number of pages.

    how can i find the number of printed pages (in total)?thank you.

  • Is it possible to scale or move a dash pattern as you would a fill pattern?

    I am used to using tilda (~) to scale, move or rotate a fill pattern. I have come across the need to slide my dashed pattern along the line - so that the dashes are not in their default position. I gues I could make a custom brush but ideally there w