Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how to give an path from LV to Visual Studio 2008 for working with DLL ?

Solved!
Go to solution

Hi Guys,

I am working with an DLL that i write in Visual Studio 2008, where i open a file and make an average of 100 images but what if I want to choose A FILE from LV 2009 so that I don't have always to change these direction in the DLL???????????????

I think I can make these with an convert in LV, from path to string and from string to an BYte-array and then to convert in C back, but don't know how to convert back in C. The Dll works so far I give the byte-array to C and give the same byte-arrayback but that was only for test the prog, so how is it possible to convert these byte-array for use it in an "fopen" direction in C????

 

Wait for help or for other good advices how to give the path to C, Thanks !!!!!!!!!

 

Prog in C:

 

char path[52];

FILE *buffer;

buffer=fopen(path,"rb"); //that is the part where the byte-array has to be a string or an array of char ??????????

for(int i=0;i<52;i++)

 fread(&path,sizeof(short int),1,buffer);

...

 

 

0 Kudos
Message 1 of 5
(6,825 Views)

Hello,


find attached a simple VI, which passes a path to a DLL.
The DLL opens a file, reads a text, closes the file and displays the result in a message pop up.
Find also attached the c-sources for the DLL.
How to run the program:
Copy the file “Test.txt” to your “C:” directory.
Open the LV Project and run the VI. That’s all.

 

There’s also a useful link available:

 

Writing Win32 Dynamic Link Libraries (DLLs) and Calling Them from LabVIEW
http://zone.ni.com/devzone/cda/tut/p/id/4877

Regards
Ulrich
AE NI-CER

0 Kudos
Message 2 of 5
(6,803 Views)

Hi UM,

 

first thanks for the answer but Ihave a problem to run this VI.I tried the VI but everytime I open the VI there is an error: The Procedurepoint"GetNumTreeCellItems" is not found in "cvirte.dll".

 

Do you know where the error is?  Do I have to add labview.lib to my project before and how do I do this ?

 

 

0 Kudos
Message 3 of 5
(6,799 Views)
Solution
Accepted by topic author wweber_2

Hi,


I created the DLL in NI LabWindows™/CVI.

That’s the reason, why you have to install the LabWindows/CVI Run-Time Engine engine.
You can download the CVI LabWindows/CVI Run-Time Engine from the NI-homepage:

CVI LabWindows/CVI Run-Time Engine
http://joule.ni.com/nidu/cds/view/p/id/1525/lang/en

However, you can modify and recompile the code in your IDE (e.g. Visual Studio 2008).
Please check the properties of the call library function node in LabVIEW und the C-Code with his function parameters.

That’s the important thing. It’s not necessary to call the DLL.

Regards
Ulrich

0 Kudos
Message 4 of 5
(6,796 Views)
He Thanks for answer I've tried you way and it works  Smiley Wink
0 Kudos
Message 5 of 5
(6,791 Views)