Using PostLVUserEvent function from Labview.dll

I am trying to use the PostLVuserEvent function from the labview.dll and corresponding extcode.h file.  I have made my own dll using CVI that uses this function.  I then use Labview to call my dll.  My dll compiles fine.  No issues, no errors.  LabView can call my dll function containing the PostLVUserEvent function with no errors.  However, the event number LabView passes my dll is not the same event number I receive so no LabView event is triggered. 
Has anyone had this issue? 
We are trying to solve it from the LabView side and the CVI side but cannot seem to get it to work.  The examplesI have found here were compiled using C++ and those seem to work.  I do not know why when I compile my program in C, it creates the dll but does not work.   If I had to guess, i think it's an issue with pointers vs non-pointers.  When the LAbview program selects my function from the dll, it shows the argument PostLVUserEvent as a pointer when in my dll, it is not a pointer PostLVUserEvent....
Any ideas?
Thanks in advance. 

Hello Blue
Take a look to this one, it was created on C, I think the .c and the .h files will give a good idea, how the function should be implemented. It is important when calling the dll on LabVIEW, to use the std calling convention and run it on the UI thread.
Regards
Mart G
Attachments:
LabView EventTest.zip ‏1041 KB

Similar Messages

  • Can I call a function from a dll in LabVIEW that returns:double*string and int.?

    I have a function from a dll that return a double* string and an integer. How can I call this function from LabVIEW? There is a possibility to work in LabVIEW with a double* string?

    pcbv wrote:
    > Hello all,<br><br>The header of the function is:
    >
    > "HRESULT WRAPIEnumerateDevices(WRAPI_NDIS_DEVICE **ppDeviceList, long *plItems);"
    >
    > where WRAPI_NDIS_DEVICE have this form:
    >
    > typedef struct WRAPI_NDIS_DEVICE<br>{<br>
    > WCHAR *pDeviceName;<br>
    > WCHAR *pDeviceDescription;<br><br>}
    > WRAPI_NDIS_DEVICE;<br><br>
    >
    > The function is from WRAPI.dll, used for communication with wireless card.
    > For my application I need to call in LabVIEW this function.
    Two difficulties I can see with this.
    First the application seems to allocate the array of references
    internally and return a pointer to that array. In that case there must
    be another function which then deallocates that array again.
    Then you would need to setup the function call to have a pointer to an
    int32 number for the deviceList parameter and another pointer to int32
    one for the plItems parameter.
    Then create another function in your DLL similar to this:
    HRESULT WRAPIEnumExtractDevice(WRAPI_NDIS_DEVICE *lpDeviceList, long i,
    CHAR lpszDeviceName, LONG lenDeviceName,
    CHAR lpszDeviceDesc, LONG lenDeviceDesc)
    if (!lpDeviceList)
    return ERROR_INV_PARAMETER;
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceName, -1,
    lpszDeviceName, lenDeviceName,
    NULL, NULL);
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceDescription, -1,
    lpszDeviceDesc, lenDeviceDesc,
    NULL, NULL);
    return NO_ERROR;
    Pass the int32 you got from the first parameter of the previous call as
    a simple int32 passed by value to this function (and make sure you don't
    call this function with a higher index than (plItems - 1) returned from
    the first function.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Using function from windows dll in abap program

    Hi
    How can i use a function from a standard  DLL that in c:\winnt\system32.?.
    Ami

    Hello ami,
    here is the solution to your question - I know, a little bit late, but I hope not to late.
    Cheers
    Stefan
    "-Begin-----------------------------------------------------------------
      Report  ZLOGON.
      "-Variables-----------------------------------------------------------
        Data Win32 Type OLE2_OBJECT.
        Data Token Type String Value '0000'.
        Data hToken Type Integer.
        Data phToken Type Integer.
        Data ret Type Integer.
      "-Main----------------------------------------------------------------
        Create Object Win32 'DynamicWrapperX'.
        If Win32-Handle > 0.
          "-Define external functions---------------------------------------
            Call Method Of Win32 'Register' Exporting
              #1 = 'advapi32.dll' #2 = 'LogonUserA'
              #3 = 'i=sssuup' #4 = 'r=l'.
            Call Method Of Win32 'Register' Exporting
              #1 = 'kernel32.dll' #2 = 'CloseHandle'
              #3 = 'i=h' #4 = 'r=l'.
            Call Method Of Win32 'Register' Exporting
              #1 = 'kernel32.dll' #2 = 'GetLastError'
              #3 = 'r=u'.
          Call Method Of Win32 'StrPtr' = phToken Exporting
            #1 = Token #2 = 's'.
          Call Method Of Win32 'LogonUserA' = ret Exporting
            #1 = 'bambi' #2 = '.' #3 = 'hugo' #4 = 2 #5 = 0 #6 = phToken.
          If ret <> 0.
            "-Logon successful----------------------------------------------
              Write: 'Logon as bambi user'.
            Call Method Of Win32 'NumGet' = hToken Exporting
              #1 = phToken.
            Call Method Of Win32 'CloseHandle' = ret Exporting
              #1 = hToken.
            If ret = 0.
              Call Method Of Win32 'GetLastError' = ret.
              Write: / ret.
            EndIf.
          Else.
            Call Method Of Win32 'GetLastError' = ret.
            Write: / ret.
          EndIf.
          Free Object Win32.
        EndIf.
    "-End-------------------------------------------------------------------
    Edited by: Stefan Schnell on Sep 6, 2011 7:07 AM

  • Calling a function from a dll written by using visual studio c++

    Hi, how can i call a function from a dll which is written by visual studio c++ in test stand?  Although the functions in dll are exported and i've chosen c/c++ adapter, i saw no function in test stand. Is there a different step while i'm calling a function from a dll written by c++ than calling a function from a dll written by cvi?

    Hey Sadik,
    Selecting the C/C++ DLL Adapter Module should be sufficient for this. When you drag an action step for this onto the Main Step and navigate to the location of the DLL, the function list should populate and you should be able to select the function you want to use. If this is not the case, would you be able to post this DLL so that we can test this on our end?
    Regards,
    Jackie
    DAQ Product Marketing Engineer
    National Instruments

  • How can i use function from microsoft DLL in an ABAP program?

    Hi
    Is there a way to use a function from a standard DLL file in an ABAP progrm ????
    The dll is stored in c:\winnt\sttem32.
    Do i need to upload the dirver to the ECC server? do i need to put it some Tcode before i use it in my program?
    i tried to fined some clear exaple but without any success .
    Hope to get some help here ,
    thanks ,
    E.

    this is not really possible, a dll cannot be uploaded, eg. sap could run in a non windows-environment so this won't work
    Why not?  You can query the local operating system for type/version, you can detect the presence of a file if you have the access, and you can run local executables using GUI_EXECUTE.  However, if you've got any level of decent security in place, you're not going to be allowed to run a DLL in that location...

  • Call multiple functions from same dll with call library function

    hi,
    i am working on a project in wich we need to make a UI to read out a sensor network.
    the UI should be usable in any project, but every node needs a different piece of code depending on the type of sensor with wich it is equipt.
    so i need to be able to call different pieces of code when i need them, and still be able to use the UI in future projects with possibly new types of node we now don't have.
    so someone told me to use DLL's, cause then i would be able to call the code i need the moment i need it.
    but i have never worked with DLL's (just learned about this option 3 day's ago) so i have a question.
    i know i can dynamicly change the DLL i call with the call library function, but can i dynamicly change the function i call from that DLL ?
    or do i have to put a new call library function for each function i want to call, even if its from the same DLL ?
    kind regards,
    stijn

    nazarim wrote:
    ok so there is no (easy and ubderstandable) way for me to dynamicly change wich function i want to call from a certain DLL.
    but now i started wondering, the path on the call library function is not ment to dynamicly change a DLL
    but it does work so, if i am carefull, can i use it for that purpose or will labview give me a series of problems once i start using it in larger programs ?
    Thepath on the Call Library Node can be used to load a different DLL. Obviously since you can't change the function name your other DLL would have to export exactly the same function name and of course with the same parameters. This is seldom the case so it is not the main use of the path input to the Call Library Node. It's main use is as indicated to load DLLs at runtime rather than at load time of a VI. So that an application can run even when the DLL is missing, until the moment the functionality from that DLL is needed.
    If you can make sure that all your DLLs export the same function name with the same parameter you can use the Call Library Node to call into different DLLs through the path input. If however you would need to call different function names you would have to resolve to some DLL which does do the dispatching and invocation using LoadLibrary() and GetProcAddress(). But unless you need to go with DLLs for some reason using the Call By Reference Node can give you an even more flexible approach. 
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Calling a native function from a dll

    Hi all,
    I want to call an api function exported from a dll using java. For example l like to call a function from kernel.dll (Windows). How can i do this. Do i have to create another dll for this?

    hi,
    you need to use JNI
    you have to create de DLL , and call kernel32.dll in.
    like that:
    java_class.class ==> first_dll.dll ==> kernel32.dll

  • Calling a function from a DLL, exectution in background mode.

    Dear Experts,
    We have created an ABAP report the calls a function from a DLL file. If the report is executed in on-line mode the program calls and executes the function from the DLL, but if the ABAP programa is executed in background mode it doesnt calls the DLL function.
    Do you know a way to solve the problem when executing in background mode?
    Best regards.
    Antonio

    Hi Gabriel,
    Let me explain in details about my DLL function.
    We are importing the business partners from legacy system into the SAP CRM system, so at the moment we created the BP master data via BAPI, I get the name of the BP and this moment I call the function in the DLL file. I export the parameter name and I receive back a simplified string with the name reduced to a code. This code I get back from the dll it is insert in a Z table, so there is no interaction in the screen, all must be executed in background mode, because there are a lot of business partners to be converted in SAP system.
    I am sending my code for your considerations.
    Instancia a DLL
      CREATE OBJECT dll 'MTCODE.CPFONET'.
      IF sy-subrc NE 0.
        RAISE without_dll.
      ENDIF.
    Move para a tabela interna IT_NAME os valores recebidos na TI_NAME
      it_name[] = ti_name[].
    Para cada registro importado
      LOOP AT it_name.
        CLEAR v_string_ret.
        wa_matchcode-zregid     = it_name-zregid.
        wa_matchcode-name1_text = it_name-name1_text.
        v_string = it_name-name1_text.
        CONDENSE  v_string.
        TRANSLATE v_string TO UPPER CASE.
        CALL METHOD  OF dll 'SetNome' EXPORTING #1 = v_string.
        CALL METHOD  OF dll 'ExecMatch'.
        CALL METHOD  OF DLL 'GetMCData' = v_string_ret.
        FREE OBJECT dll.
      Preenche os campos do match-code de acordo com o retorno da DLL
        SPLIT v_string_ret
        AT '|'
        INTO wa_matchcode-zparmcln
             wa_matchcode-zparmcfn
             v_empty
             wa_matchcode-name_first
             wa_matchcode-name_last
             wa_matchcode-namemiddle.
      Adiciona o registro com o match-code correspondente na TE_MATCHCODE
        APPEND wa_matchcode TO te_matchcode.
      ENDLOOP.

  • Impossible to use SAPGETDATA function from an intermediary level of a hierarchy with a cell reference.

    Hi Gurus,
    It is impossible to use SAPGETDATA function from an intermediary level
    of a hierarchy with a cell reference.
    When I open completely a hierarchy node I manage to get the bottom level
    using a cell reference.
    But I cannot do the same thing from a level above.
    I attach screenshots.
    Best regards,
    Thierry Chiret

    Hello,
    I find the soluce :
    Regards,
    Thierry

  • How can i call a DLL file using invoke node from labview?

    I cant call a DDL function using call library function.so plz tell me how to use invoke node and call DLL using invoke node
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    Please stay in the same thread.
    - Cheers, Ed

  • How to use custom functions from Dlls

    I would like to know if there a way to import functions from
    a custom DLL?
    Thanks

    Hi Wardell,
    Did you get any break through on this I was exploring on same.
    Egarly awaiting reply....
    Regards,
    Ankeet Pujara

  • Application with a vi calling a function from kernel32.dll

    I have a Labview application which runs very well.
    I had add a vi using the functio GetSystemTime from the dll kernel32.dll. The vi calling the API function runs well. Then I tried to buil the application and it does'nt run anymore . A dialog box is opened : "access to a forbidden space memory. I don't understand.
    Does anyone have an idea?
    Thank you for your response.

    I have made at test with this function but it runs on my system.
    I have used LV 6.0.2 to LV 7.0 on a Win XP Prof. You can compare your solution with mine.
    The VI will run once when the application is called. You will see current time.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    GetSystemTime.zip ‏23 KB

  • Authentication syntax for HTTP GET method using TCP functions in Labview on linux

    Hi,
    Currently, I am trying to communicate to web server. I have Labview installed on a Linux machine. The HTTP function blocks and other labview functions do not work. Hence, I am building a HTTP code string using TCP functions (port 80) to talk to the web server. I am successfully able to fetch a response from web sites (example www.ni.com) from my vi. However, when I try to communicate to my web server, it does not work. It requires an authentication. I am able to open http://ipaddress in my browser from my machine using username and password. Can someone help with Authentication string requirement for GET method?
    so far the string is:
    GET /index/ HTTP/1.1
    Host: http://xx.xx.xx.xx

    An easy option would be to try http://userassword@server syntax for the URL.
    Else I posted a Twitter fetcher once (won't work anymore since Twitter moved to Oauth authentication) at LAVA. Based on code from @cloew.
    The code is part of this LLB.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • I am using Activex controls from Labview to log the data into Excel spreadshee​t. My applica

    tion is running fine without giving any error messages. But even after the vi stops, excel process does not shutdown. "Excel.exe" process keeps running until I end it from Windows NT Task Manager. Is there any way to end the excel.exe process from Labview?

    tion is running fine without giving any error messages. But even after the vi stops, excel process does not shutdown. "Excel.exe" process keeps running until I end it from Windows NT Task Manager. Is there any way to end the excel.exe process from Labview?I use Excel Active X control frequently to save and then analysis test data. In order to properly destroy the "Excel.exe" process it is important to close all the automation refnums opened when using the Excel active x controls. After completing your desired Excel task wire all the refnums in reverse order they were created into the Automation Close function in Functions->Communication->Active X pallette. This includes all Application, Workbook, Worksheet, or Range refnum. Missing even one of these refnums will mean that Excel.exe will still persist in the task manager and cause problems when excel is opened from outside LabVIEW. I hope this helps.
    Stephan

  • Calling functions from a DLL

    I am currently using Oracle to retrieve a BLOB data to process it. The only way I have of intepreting the BLOB is through a function of a DLL provided by my supplier. Is there anyway of doing so?
    Any Help is very greatly appreciated. Thanks

    Unless you have worked with the JNI before or are long accustomed to "just figuring it out due to lack of documentation and information", you really will not glean too much information just from looking at the JNI itself.
    In a nutshell, what you need to do is: create one or more Java classes which contain native methods appropriate for your use; compile these classes; use the 'javah' to process each class that contains native method declarations in each class; copy the generated C header files to C/++ source files; implement each C function (each function corresponds to precisely one native method declaration) in each C/C++ source file as appropriate for your needs (e.g., do Oracle ju-ju (this is where the real beef of the JNI comes in - functions to get data out of the VM and from the Java environment - threads, objects, and so on); compile and link the C/C++ source code into a DLL for Windoze and a shared object for Unix (note that when you compile you will actually need to include two directories from the JDK, not just one - the second directory provides the platform specific definitions of types and so forth). Having done all that, you essentially can now use that/those class/classes in the Java world to hit the Oracle ju-ju, or whatever it does, from a Java perspective.
    For more information, see the Java Native Interface tutorial trial at http://java.sun.com/docs/books/tutorial/native1.1/index.html

Maybe you are looking for

  • Problem on Installation of oracle on Linux............

    I am trying to install oracle on Redhat Linux 9.0 With the kernal version of 2.4 but installation is Abounded at 0% and not carrying forward at all, I think some Of the parameter should be set on “.bash_profile” Please tell me all the parameters shou

  • Cannot awake from sleep after CPU replacement.

    I recently upgraded my arch machine from E4500 CPU to a E6700 CPU. Everything seems to be okay, but for some reason I can no longer awake from suspension. My computer kind of just sits with the little blinking white under score at the top of the scre

  • I bought a new laptop and have lost all my music library when installing itunes?

    This will be the third Laptop that I have authorised but when I installed iTunes to it, my entire music library had disappeared, only purchased items were there. It's worked ok previously when I authorised the old Laptop so I am really confused as to

  • Manage multiple computers from out side

    Hi , i want to manage 2 computers from out side my network. Ihave time machine, dynamic ip, wha ti wanted is able to log in from out side to this 2 computers. what is the best option ? thanks in advnace

  • 13 th question

    mark the correct SAP business work flow a..is a support tool that can be used to optimize the flow of business transactions b..control the info process flow according to a predefined model c.. bring right work in the right order at right time to the