DLLImport for c# programming

Hello

I am programming with c#, I have the problem in the niVB_Initialize function,

below the code example, compile OK. But when I try to debug, error and without value of LibraryHandle to answer.

My environment: WIN7 32 bit, VS2013 community (compiled x 86)

All tips to clear this?

=================================================

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace AUA_niVB
{
Class Program
{
[DllImport ("nivirtualbench.lib", CallingConvention = CallingConvention.Cdecl)]
niVB_Initialize public unsafe static extern Int32 (UInt32, Int32 niVB_LIBRARY_VERSION * libHandle);

public static void Main (string [] args)
{

Int32 i;
UInt32 LibVer = 17874944;
Try
{
unsecured
{
Int32 LHandle;
I have = niVB_Initialize (LibVer & LHandle);
}
}
catch (System.BadImageFormatException e)
{
int a = 0;
}

} //Main
} //class program
} //namespace AUA_niVB

The only thing I see in your code that I'm not sure is the use of "nivirtualbench.lib" as the name of the DLL; nivirtualbench.lib is a library to import for "nilcicapi.dll." I think that the syntax for pointer/address-from you with "unsafe" is correct, even though I'm more a C++ guy than a c# guy.

I was able to use the following with the C API of VirtualBench. It also avoids the use of the keyword "potentially dangerous."

Example of namespace

{

Class Program

{

public const UInt32 LIBRARY_VERSION = 17874944;
public const nom_dll as string = "nilcicapi.dll";
[DllImport (nom_dll, EntryPoint = "niVB_Initialize", CallingConvention = CallingConvention.Cdecl)]
public static extern Int32 Initialize (UInt32 version, out IntPtr libraryHandle);
[DllImport (nom_dll, EntryPoint = "niVB_Finalize", CallingConvention = CallingConvention.Cdecl)]
public static extern Int32 Finalize (IntPtr libraryHandle);

public static void Main (string [] args)

{

IntPtr libHandle;

Initialize (LIBRARY_VERSION, out libHandle);

do stuff with libHandle

Finalize (libHandle);

}

}

}

Tags: NI Products

Similar Questions

  • How can I disable "Fingerprint Software" for only for the programs?

    Hello

    somehow, the 'Fingerprint Software' require the user to slide a finger at any time it open programs that require the user to insert "user and password."
    How can I disable it permanently just for the program, not to open a session?

    Thank you.

    Hello

    In the TrueSuite Access Manager, you can configure some settings.
    In the administrator settings, you will find two tabs; General and advanced.
    On the Advanced tab, simply uncheck the option called: change logon Windows fingerprint logon password.

    I think that should do the job.

  • Your browser is not supported for this program. This program is expected to be launched above IE4 version!

    The provider's Web site will not reflect orders/quotes...
    We get this message
    "Your browser is not supported for this program.
    This program is expected to be launched above IE4 version! »

    URL of affected sites

    http://

    To work around this problem, you can also try using the User Agent Switcher add-on to give the impression that you are using IE on the site.

    You can contact the site owner to inform them of their poor support for Firefox.

    Alternatively, you can report a broken help site.

  • I can't build a Setup program for my program

    I'm building an installer for my program, but I keep to says that I must tell the system where are installers.

    I've attached a screenshot of what tells me to find, but told me not to find something specific. I made sure all drivers are up to date, but I can't yet build a Setup program.


  • Is "Introduction to data acquisition" by R. King a good reference for learning programming of data acquisition?

    Is "Introduction to data acquisition" by R. King a good reference for learning programming of data acquisition? Or can anyone recommend a better text.

    Why don't you start hera.

  • my c drive shows low disk space, so I searched for the program that holds more memory on drive c. I got to know that this pagefile.sys has 3 GB in the c drive

    Hi, my c drive shows low disk space, so I searched for the program that holds more memory on the c drive. I came to know that pagefile.sys has 3 GB in the c drive, kindly guide me to move the pagefile.sys to another drive.

    Hi jafrin.michel,

    Thanks for posting in the Microsoft community.

    Before you start the troubleshooting steps, I need the information required.

    What version of the windows operating system do you use?

    Method 1:

    If you are using windows 7, I suggest to perform a disk cleanup and verify.

    Delete files using disk cleanup

    http://Windows.Microsoft.com/en-us/Windows7/delete-files-using-disk-cleanup

    Method 2:

    If you want to move the pagefile.sys to another drive, follow the steps and check out them.

    Follow these steps to move the pagefile.sys to C: drive on D: drive (if you have the drive D :).

    1, write click on my computer and select Properties.

    2, click on the Advanced tab.

    3, click settings under performance menu.

    4, click on the Advanced tab and click on change.

    5, select letter (C :) and "BOLD" No pagefile then click on Set. )

    6, if you want to configure pagefile.sys in, select drive D: drive letter D: and "BOLD" in the custom size or the size of the system managed , then click on Set. It displays a pop-up message click OK.

    7, again click apply and OK OK.

    8, the system you will be asked to reboot, click on Yes.

    9, after rebooting the system, you can see the pagefile.sys will be moved to D:

  • I'm looking for a program that you alow to draw me and trace products and prototypes

    I'm looking for a program that you alow to draw me and trace products and prototypes

    Hello

    Looks like you need a CAD program. Have you checked with someone else, like engineers, who
    that job category? There may be some that are specifically designed to assist with your needs. Of
    course AutoCad, a commercial product, is used by many professionals.

    There are also many available freeware programs.

    BING or Google - freeware CAD programs

    FreeCAD - many freeware programs
    http://www.FreeCAD.com/

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Optional update listed for a program that is not installed

    OS: Windows 7 Home Premium 64-bit - current (clean install on the new machine)

    AV: Blink Personal - current (eEye Digital Security) doubt that there is a problem

    Whenever I receive a notice on an update for Windows 7, there is always an optional update for Windows Live Essentials - except that I have not installed Windows Live Essentials.

    How can I fix it so update does not include an unnecessary update?

    Never seen an update listed for a program not installed before on 7 window

    No action taken - do not know how to stop it - the download screen allows no options ignore or hide an optional update that I see.

    Hello

    Windows Live Essentials is a collection of free programs include Windows Live Photo Gallery, Windows Live Movie Maker, Windows Live Mail
    and Windows Live Messenger.

    You can check this link for more information:
    http://www.Microsoft.com/Windows/Windows-7/features/Windows-Live-Essentials.aspx

    You can hide this update in Windows Update.

    1. open Windows Update.
    2. in Windows Update, select the Windows Live Essentials.
    3. right click and select "Hide update".
    4 leave the action when prompted by User Account Control.

    You can also check this link:
    http://Windows.Microsoft.com/en-us/Windows7/troubleshoot-problems-with-installing-updates

    Kind regards
    Amal-Microsoft Support.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Iexplore.exe application 0x079B0068 error - I need to turn off DEP for certain programs and services, but I don't know which. I can't open some favorite sites. Micorsoft advice is not to turn off Dep for all programs and services.

    Iexplore.exe application error 0 x 0790068 - I am told that I have to turn off DEP for certain programs and services, which?  I am unable to open some favorite sites from one about Microsoft Update 1 month ago.
    Simplify the answer please, I'm so confused and frustrated and have spent hours to get to this point that I am destroyed so solve my problem!

    Hello

    Do run this as a top list of verification at the bottom.

    EricLaw IEInternals - a peek at Internet Explorer from inside. -Understanding DEP/NX
    http://blogs.msdn.com/ieinternals/archive/2009/10/10/understanding-data-execution-prevention-crashes-in-IE8.aspx

    The problem might actually be an add-on or another program to the origin of the problem and you should check that
    1st.

    What antivirus/antispyware/security products do you have on the machine? Be one you have NEVER on it
    machines, including those that you have uninstalled (they leave leftovers behind which can cause strange problems).

    Start - all programs - Accessores - system tools - IE with no Addons - does this work better?

    IE - Tools - Internet Options - Advanced - tab click on restore, and then click Reset - apply / OK

    IE - Tools - Internet Options - Security - reset all Zones by default level - apply / OK

    not better?

    Close IE and try again IE or IE with no Addons

    IE - tools - manage Addons (for sure disable SSV2 if it is there, it is no longer necessary but Java always install
    "(and it causes problems - you never update Java to go back in and turn it off again)." Search for other possible problems.

    Windows Defender - tools - software explore - look for problems with programs that do not look right. Permit
    are usually OK and "unauthorized" are not always bad. If in doubt about a program to ask about it here.

    Could be that a BHO - BHOremover - free - standalone program, needs no installation, download and run - not all
    are bad, but some can cause your question. (Toolbars are BHO)
    http://securityxploded.com/bhoremover.php

    Startup programs
    http://www.Vistax64.com/tutorials/79612-startup-programs-enable-disable.html

    Also get Malwarebytes - free - use as scanner only. If you ever suspect malware, and that would be unusual with
    Prevx running except a low occasional (not much), updated cookie, and then run it as a scanner.

    I would add prevx so.

    Prevx - Home - small, fast, exceptional CLOUD free protection, working with other security programs. It comes
    a scan only, VERY EFFICIENT, if it finds something to come back here or use Google to see how to remove.
    http://www.prevx.com/

    PCmag - Prevx - Editor's choice
    http://www.PCMag.com/Article2/0, 2817,2346862,00.asp

    -------------------------------------------------------------------

    Do yourself a big favor and work through 1 above.

    How control DEP but I don't recommend turning it off and certainly not to let power off.

    How to enable DEP on or off for a program under Vista
    http://www.Vistax64.com/tutorials/65790-DEP-turn-off-programs.html

    How to enable or disable DEP in Vista
    http://www.Vistax64.com/tutorials/120778-DEP-enable-disable.html

    I hope this helps.

    Rob - bicycle - Mark Twain said it is good.

  • Find the number of license for LabVIEW program?

    Hello
    My name is Cleber, I am of the Brazil.
    I'm trying to find a role in the LabVIEW programming that I return the license number and the user name for the license. In vain so far. I thought I returns the ofLabVIEW type installed, but I need this information for my program is finished.
    Can someone help me?

    Thank you.

    Is that what you are looking for?

  • A software says I need 4 MB of VM set aside for the program to run.

    Original title: virtual memory.

    How to set 4 MB of virtual memory in windows xp? A software says I need 4 MB of VM set aside for the program to run.

    Hi KennethBrasel,

    Welcome to the Microsoft community where you can find all the answers related to windows.

    According to the description provided, looks that you receive a virtual memory message when installing a program on Windows XP computer.

    By default, the virtual memory paging file that is created during installation is 1.5 times the physical RAM on your computer. Therefore, a computer that has 1 GB of RAM installed will have 1.5 GB of virtual memory.

    You can manually change the size of the swap file to make it larger or smaller. You can also optimize virtual memory use by dividing the space of files between multiple drives and by removing the disks slow or very open space.

    He would be grateful if you can answer this question in order to help you further.

    1. What is the size of your RAM memory?
    2 are. what program you referring?

    I suggest you try the following steps to change the virtual memory:

    a. Click Start, right click my computer and then click Properties.

    b. in the System Properties dialog box, click the Advanced tab.

    (c) in the results pane, click settings.

    d. in the performance Options dialog box, click the Advanced tab.

    e. in the virtual memory section, click on change.

    f. change the initial size value and the value of maximum size to a higher value, click on set and then click OK.

    g. click OK to close the performance Options dialog box and then click OK to close the System Properties dialog box.

    Note: With virtual memory, the computer can use the hard drive as memory (RAM) space. The computer uses virtual memory to increase the ordinary RAM that is installed on the computer. If you reduce the size of the pagefile, some the program may not start correctly or may not start at all. This problem may occur even if the computer has plenty of RAM.

    If you need Windows guru, do not hesitate to post your questions and we will be happy to help you.

  • I have an acerdesktop model am3910 - e3122.hat a windows 7 premiume.i House haveto install windows xp for a program but I can't not.__please you please help me how to install windows xp I have the two windows .thanks

    I have an acerdesktop model am3910 - e3122.hat a windows 7 premiume.i House haveto install windows xp for some programs, but I can't.
    Please please help me how to install windows xp I have the two windows .thanks

    If your computer is running Windows 7 Home Premium, purchase and install a Windows Anytime Upgrade Windows 7 Professional or ultimate edition, then download and install the FREE Windows XP Mode. Carey Frisch

  • Rule for a program in "Add/Remove Program"...

    I would like to know the rules for a program to display in the pane of the Add/Remove program?

    My understanding is that the software must exist in the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" and it must contain a key "Display Name" AND "uninstall the channel."
    Is this true? Are there other conditions?

    Thank you!

    It's DisplayName and UninstallString (note that there is no empty space between the two). The existence of these two values should be sufficient for a program to display in Add / Remove programs. However, there are additional details that you can add. See: Article Key of Registry Uninstall (Windows) on the MSDN Web site.
    Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]

  • Software Bloggie Touch does not work because of the DEP - I can't turn off DEP for this program

    Original title: software Bloggie Touch does not work because of the DEP

    I downloaded the Bloggie Touch (Sony) software, but the function of prevention of execution of data in Windows Vista prevents me from using it. Any suggestions? I contacted Sony and they had me re-download the software on their site, but it did nothing. I tried to reset the DEP to allow the Bloggie software, but he says that the processer wouldn't let me do that. Message: I can not turn off DEP for this program.

    Any help would be appreciated.

    Hello
    the only other thing you can do is to do a Bing search for how to turn off dep.
    There are several options (not recommended by the way)
    b Eddie

  • Computer application for this program to run

    Original title: uPrograms compatibility Application ApplicationsContent Manager permission to continue

    p, it seeks approval for this program to run, how can I stop it. I tried administrator and run in vista mode he asks again. Any ideas?

    Hello

    ·         What program are you trying to run?

    ·         The problem occurs with particular program or all?

    ·         You use the administrator or Standard user account?

    Method 1:

    The prompt that you get is the setting on your computer user account control. You can change the setting and use them according to your requirements and run programs. Check out the link below for more details - mentioned


    What is user account control?

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-user-account-control

    Warning: User Account Control (UAC) can help prevent your computer from unauthorized changes. It works by asking permission when a task requires administrative rights, such as installing software or changing settings affecting other users. We do not recommend disable user account control. If you turn it off, you must reactivate as soon as possible.

    Method 2:

    You can even use the steps and check mentioned below:

    a. right click on the file program, and then click Properties.
    b. now, click on the compatibility and select run the program as administrator.
    c. now click on change settings for all users and click ok. Now, check to see if the problem resolves.

    See also:

    How to enable an application to run once with a full administrator access token in the UAC?

    http://Windows.Microsoft.com/en-us/Windows-Vista/how-do-I-allow-an-application-to-run-once-with-a-full-administrator-access-token-in-UAC

    I hope this helps.

Maybe you are looking for