Quantcast
Channel: LabWindows/CVI topics
Viewing all 5334 articles
Browse latest View live

Async timer with priority threads

$
0
0

Hi,

I am new to LabWindows/CVI, so bare with me Smiley Happy

 

I was looking at NewAsyncTimers and looked through some previous topics which all state that the async timer callbacks are all executed on the same thread, with the priority of that thread set to THREAD_PRIORITY_HIGHEST.

Does this also apply to NewAsyncTimersWithPriority? Suppose I start multiple async timers with this, and set each timer to a different priority, do they all still run on the same thread?

 

Thanks in advance Smiley Wink


Unexpected behaviour using a company checksum generator

$
0
0

I inherited a DLL that the project uses to generate a checksum. The DLL does this by building a list of project files and calculating the MD5 hash for each. There are excluded files, such as anything subversion(SVN) uses to track version. These calculated MD5 hash values get saved to a text file. They also get sent to a roll up hash function that we built that 'and' s each into one overall hash.

 

Later we run, using the same DLL, a verify hash which uses the exact same MD5 hash generator function to do a string comparison (strncmp() to be specific), the source of the 'known hash' is the text file from earlier.

 

Here is where I found something unexpected, the CVI .c source files inside the project have a changing hash. Specifically it is just the .c source files that generate both a DLL and an EXE but everything else in that workspace is matching and that includes the generated files, i.e. the DLL/EXE.

 

I tried making all the files read only using the SetAttrib() and performing that before a MD5 is calculated. Then I ran the generate and the verify, it still changed. Ran the generate again, thinking well now they are all read only and it should not change and it still changed when I ran the verify.

 

I am using CVI 2013 SP2 and dotnet version is 4.5.2, we are not using FIPS compliant algorithms. Pasted the function that gets the MD5 hash below.

 

I am wondering if anyone has some ideas where this behavior is coming from, I could always add the .c files to the ignore list but I would rather understand what is going on before I do that.

 

char* getFileMD5(const char* filePath)
{
    Initialize_mscorlib();

    System_IO_FileStream fileStream = NULL;
    System_Text_StringBuilder sbInstance = NULL;
    System_Security_Cryptography_MD5 cryptoInstance = NULL;
    char* hashString = NULL;
    unsigned char* hash = NULL;
    ssize_t hashLength = 0;
    
    // Create a new instance to the cryptography class
    System_Security_Cryptography_MD5_Create(&cryptoInstance, NULL);
    System_Security_Cryptography_MD5_Initialize(cryptoInstance, NULL);
    
    // Open a file stream to the provided file path, probably need to handle any exceptions raised
    System_IO_File_OpenRead(filePath, &fileStream, NULL);
    
    // Computer the MD5 hash of the file
    System_Security_Cryptography_MD5_ComputeHash(cryptoInstance, (System_IO_Stream) fileStream, &hash, &hashLength, NULL);
    
    // Convert the MD5 hash from a byte array to string readable format
    System_BitConverter_ToString_1(hash, hashLength, &hashString, NULL);

    // Replace hyphens with an empty character
    System_Text_StringBuilder__Create_2(&sbInstance, hashString, NULL);
    System_Text_StringBuilder_Get_Length(sbInstance, &hashLength, NULL);
    System_Text_StringBuilder_Replace(sbInstance, "-", "", 0, strlen(hashString), &sbInstance, NULL);
    System_Text_StringBuilder_ToString(sbInstance, &hashString, NULL);

    StringLowerCase(hashString);
    
    // Clean up
    CDotNetFreeMemory(hash);
    CDotNetDiscardHandle(sbInstance);
    CDotNetDiscardHandle(fileStream);
    CDotNetDiscardHandle(cryptoInstance);
    Close_mscorlib();
    
    return hashString;
}

General Protection Fault inserting ring items in table cell

$
0
0

I'm seeing GPFs in RunUserInterface when inserting ring items in a column cells of a table control.  It's repeatable now, although yesterday in development I'm pretty certain this was not happening.  Lovely, I know.

 

I've stripped my project down to bare bones.  Click the Add button to add rows.  Click the Fail or Pass ring controls in any row and watch the GPF fireworks!

 

What am I missing here?

Can CALLBACK function be called in code or does it have to be rewritten as regular function

$
0
0

This maybe is a silly question but has anyone called a CALLBACK function in code instead of just a response to user interface?

How can I pass info to it without knowing what the H file will renumber the controls to?

 

Thanks for not making fun of the question!

 

Dmitry

关于在CANVAS控件中画图的问题

$
0
0

我想在CANVAS控件中逐点画出一幅图,就是每次都在第一行从左到右画点,画完一行后已完成的所有行下移一行,然后又重新在第一行从做到右画。感觉就像一幅图片从画布上方一行一行显示出来一样。请高手赐教!谢谢!

draw a picture in the CANVAS control?

$
0
0

I want draw a picture in the CANVAS. Every time I draw one point from left to right in the first line. If finished one line, all line have finished will move down one line. Then I will draw new line from the first line.

ALL this like a picture one by one line display from the top of CANVAS.

Thanks' very much!

Repeat the process in stacked sequence

$
0
0

Hello guys,

Here I am facing a problem in my VI, please do help me. It is URGENT.

The problem is stated below:

 

The given VI has a flat sequence structure. In the first sequence there is also a flat sequence with a logic, what I want is that the whole logic of led off and led on will flow repeatedly for 20 second. In the same manner the logic in the next sequence will flow for 24 second, for that what should I change in my VI.

 

Thank you all\1

Smiley Happy 

Please help me to use this labview program.

$
0
0

After reinstalling the windows, labview program, "Ressistance.vi", dose not work with

"Error 8 occurred at Open/Create/Replace File in Write Spreadsheep String.Vi -> Write To Spreadsheet File (DBL).vi. File permission error. You do not have the correct permission for the file. C:\238.dat".

I think there is a problem with the storage root.

So, i want to modify the labview source of "Resistance.vi" using the source of "Test.exe".

However, we can not deal with the labview program and code.

Please help me to use this program without the "238.dat".


Counting the number of lines in a file?

$
0
0

Hello everyone,

 

I'm writing a program that reads and imports data from a CSV file. I was trying to count the number of lines in the file, so I wrote the code below. It works, however the output says there is one more line. For instance, I know the file contains 297 lines, yet it gives me 298. Here is a sample of my code:

 

int file;
ssize_t size;
int info;
char *data;
int get_data;
int count=0;
int i;

file = OpenFile (fname, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII);
info=GetFileInfo (fname,&size);

data=(char*)malloc(size*sizeof(char));

get_data=ReadFile (file, data, size);

for(i=0;i<size;++i)
{
    if(data[i]=='\n')
{
    count=count+1;
  }
}

 

Any help would be very much appreciated!

 

Thanks!

Universal Windows Platform App running error

$
0
0

I built an application using LabWindows CVI 2015 environment. In the end, I obtained setup.exe and *.msi files. After that, using the steps presented in https://blogs.msdn.microsoft.com/appconsult/2016/10/17/desktop-bridge-converting-an-installer/ the appx (Universal Windows Platform - UWP apps) file resulted.

        When I run the application in Win 10 environment, the following error appear several time (each time I press OK button): “Mesa.dll could not be found”. In the end the application runs, but the GUI elements are not completely displayed – I know that the mesa.dll is required to display 3D controls correctly.

        Another error: in my application, I save some data in the windows registries database (some user configuration), but when the application restart none of these data can be find anymore.

       I know that UWP Apps run in a protected environment. As a result, I believe that calls to mesa.dll are considered to compromise the security of the platform and are not allowed – the same with the registry.

 

      Please, do you have a solution for these problems? Thank you very much ! 

DLL issue

$
0
0

Hi Everybody,
i'm very confused, please help me:
i would like to create a cvi .DLL to be used in case of machine vision applications.
each application require multiple configuration in the parameter of its functions. So i'm thinking Instead of making this configuration by modifying the parameters with an
.ini file, i would create a .uir file of setting with a custom panel for each function (to directly follow the change of parameters on the image window and avoiding the repetition of modification and saving of the .ini file before execution) .
Does this is feasible and .dll can contains .uir file in addition to .c file?
In below a capture of my first .uir test for a simple functionality which i want to integrate it into my DLL

Thank you So much for your Help !!!

Command Prompt argument cause error 17201

$
0
0

I have a quick question in regards to command line arguments.

Right now, if I execute my .exe file through cmd and add an argument like 1234, the program will throw an error as seen in the attached image. However, if I were to put a character such that the argument is -1234, then the error is not going to be visible.

 

I have tried to search for documentation and such but found nothing. 

Ideas?

 

 

I also assumed that maybe because it is a number that it's causing the error to pop up. For example, if I put .../testexec.exe 1234, the error would show up. It would also show up if I use "1234" but not for '1234'.

 

Any help would be apperciated. thanks!

ON button to be active with an external signal? HOW?

$
0
0

Ladies and Gentlemen,

 

I am sure this question has been asked before, however I could not find the answer for my question, so sorry if the question is repetitive.

 

Imagine I have code that has a ON button. So if I run the code, it will wait for the user to click on ON button to start the task. Now I want to have an external button (a simple button that can be connected to the computer via USB port)  to play the role of "ON" button. How do I find such a device and where to look? I just didn't know what to google! Such a "device" should have labview VIs so that the LabView program recognizes it.

 

Any help or experience would be appreciated.

Sina

 

 

Is there any method to save TestStand container into a compatible CVI struct?

$
0
0

Good morning,

I created a new data type in TestStand which is a container with four numbers and one string and i need to develop a function in CVI which receives that container and saves all its info into a struct defined in the same way (with compatible data types).

I only know TestStand API Functions "TS_PropertyGetValNumber" and "TS_PropertyGetValString" which requires accessing all of the variables inside the container individually but in case there is a more direct method (specially for larger containers/structs) will be very useful to me.

Regards,

Alejandro

ListPreAllocate limitations?

$
0
0

I am using ListTypes in LabWindows/CVI 2015 15.0.0 (413).  Windows 7

 

When attempting to use the ListPreAllocate() function I am seeing what appears to be an undocumented limit to the pre cache memory that can be allocated.

 

I understand the requirements of contiguous available space for [m][c][re]alloc to succeed, and I suspect the same is true for initial allocation using ListPreAllocate.  So In the following code, I added a calloc statement to see if it would also fail.  It did not.  So, while I can allocate memory equivalent to 30 list items using malloc, the call to ListPreAllocate fails:

 

struct SCRIPT, has sizeof(SCRIPT) of approximately 8K. 

 

    char *buf = malloc(262080);//size equivalent to 30 * sizeof(SCRIPT)
    if(!buf) return -1;
    
    ListType list1;
    list1 = ListCreate(sizeof(SCRIPT));
    if(ListPreAllocate(list1, 30*sizeof(SCRIPT)) == 0) return -1;//fails here, whether or not the malloc call above is called.

I also observed that 25*sizeof(SCRIPT) was successful.

Is there a designed limit to the memory that can be allocated using this function?

Or some parameter that needs to be set?

 

 


Labwindows .Net Assembly

$
0
0

Hello,

I have a problem with CVI.

This is the error msg "Could not get CVI .NET error description. A .NET Framework version 1.1 or higher, or the CVI .NET modules may not be installed on your system. If not already present, install the required .NET Framework. Then repair the CVI Runtime Engine installer."

 

I have labwindows 2010, .Net Frameworf 4.0 and i i install labwindows run time engine.

Can you help me please?

Thanks a lot!

Duplicate TCPClient callback?

$
0
0

Hi everyone,

 

I am developing a tcp client driver. Therfore, i used the TCPconnect function with the TCPclient callback parameter in it, which ables us to receive callback as DISCONNECT.

 

My question is : how to receive the TCPclient in both my driver code and my user code.

 

For exemple, I would like to receive the disconnection event in my driver code to process to some intern functions as log in file. But the user also want to receive that event to change its IHM like turn a led connection red.

I success to receive the callback in my dll code (as in the tcp client example).

I success to receive the callback in my user code (passing the tcpfuncpointer in higher level in parameter)

But i did not success to duplicate it (see pictures attached).

 

Is there a way to do it?

 

Thank you!

instal function into choices in list box

$
0
0

Please i need help.

How i can install function (not  a callbackfunction just normal function type int for example )

into choices in list box.

thnx Smiley Happy

 

Selecting columns and extracting information from Tables

$
0
0

Hello everyone, 

 

I am currently working on a project that involves reading information from a csv file, parsing it, and then displaying the information in a table. I have been able to complete all of that, but am a little stuck on the next step. 

 

My goal is to allow a user to select specific column headers, and then have the information from that column stored in an array so I can perform calculations on the information. 

 

Can anyone steer me in the proper direction on how to properly complete this task?

 

Thank you very much!

 

 

mysql database with cvi

$
0
0

hello

i need an exemple of how to connect to mysql database and how to insert data ,

Viewing all 5334 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>