From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Code about getting clipboard formats.

Solved!
Go to solution

Hello everyone,

 

I have this subVI that I found somewhere in this forum.

When you've found the BMP format, you pass the index of that element for the next subVI. But why do I need the ANSI text to be found first before I can find the BMP?

Get_BMPClipboard.png

 

Thanks in advance

0 Kudos
Message 1 of 5
(2,382 Views)
Solution
Accepted by topic author Sailiman

@Sailiman wrote:


But why do I need the ANSI text to be found first before I can find the BMP?


You don't. The code checks if one of the available formats is TEXT or DIB and it does it by looking for either of them in the array. I'm guessing that this code was written in an old LV version (the background on the labels is a good indication) and today you could simplify this code by replacing the while loop with a for loop with a conditional terminal and by using auto-indexing on the input array instead of the Index Array primitive (although that ability goes as far back as I can remember).


___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(2,362 Views)

Thanks for the quick response!

0 Kudos
Message 3 of 5
(2,353 Views)

And could you explain me stepwise, this whole code?

I'm lost after the 2nd Move Blocks VI..getDIB.png

0 Kudos
Message 4 of 5
(2,347 Views)

Personally, I wouldn't bother trying to understand how the code works unless I had a specific reason to. If it works, use it and move on.

 

That said, if you do want to understand something, the best option is to look for documentation. I can't look at the actual code, but I'm assuming that the Move Block VI calls the MoveBlock function, which derefrences a pointer. Based on the image, I'm assuming that this code takes the handle (a double pointer) to an image in the clipboard, gets the data and converts it to an image cluster. If you want to know exactly how it works, go ahead and look up the docs for the clipboard formats.


___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(2,320 Views)