LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

directx capture screen

Hello all,

 

I have been trying to develop some remote desktop application which is integrated with my main project. I have managed to develop one but it uses ".NET screen capture" that takes time and uses a lot of processor. I have searched and found that using DirectX is the fastest way to capture screen. There is not any Labview code but C# code exists.

 

C Sharp.png

 

A third party library, named SlimDX, is used. It is free and can install SDK just in a few minutes. C# code works fine and really fast. I tried to convert this code to Labview. Used .NET calls but I meet parameter error and couldn't find what is wrong.

 

Snippet is at below

 

Labview.png

 

Does anyone correct the problem or is there any code to share about capture screen with DirectX?

 

Thanks for help.

0 Kudos
Message 1 of 13
(7,801 Views)

Haven't checked all but to the first parameter to the Device() constructur method, the C# code passes a valid Direct3D object created with new() not just a static reference. So you will have to use a constructure or something to create such an object too. 

Rolf Kalbermatter
My Blog
Message 2 of 13
(7,795 Views)

Thanks for the tip. I have searched references a bit more and found the constructor.

 

Labview.png

 

 

Now I am stuck at taking the data to Labview. Everything else seems fine. Do you have any idea how I can get the image to LV?

Thanks for helping.

0 Kudos
Message 3 of 13
(7,774 Views)

I worked a bit and solved importing the picture to LV.

 

DirectX Screen Capture.png

 

This is the way to capture screen using DirectX. It is really fast but converting image takes time.

You have to install SlimDX SDK to use .NET calls.

 

SlimDX download

 

Anyone find a better way please add the solution 🙂

Message 4 of 13
(7,756 Views)

Really nice from you to provide this final piece of code

It was exactly what I was looking for

 

Thanks

Mathieu


0 Kudos
Message 5 of 13
(7,732 Views)

hello 🙂

I'm doing a school project where I need to take screen captures, but the copy-paste with the keyboard is too slow. So your code is exactly what I would need but I just started using .net in labview, and I can't manage to reproduce it 😕 could you post your vi please? it would really helpful..

Thank you! 🙂

0 Kudos
Message 6 of 13
(7,441 Views)

You won't believe it but the image in the last post from Zafer is in fact a VI snipped. Just drag it to your desktop and from there into a LabVIEW diagram and watch the magic happen!

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 13
(7,433 Views)

i didn't know that, thank you! 🙂

0 Kudos
Message 8 of 13
(7,412 Views)

Hi,

 

I am trying to do this thing but after installation of Slimdx whenever I am trying open the vi, it becomes unsuccessful to open/find the Slimdx.dll. Where do I find Slimdx.dll? It is not in my system32 folder. But I have installed it.

0 Kudos
Message 9 of 13
(6,619 Views)

Well, which LabVIEW version and platform and which Windows?

 

I assume you run Windows 7 64 bit and LabVIEW 32 bit.

 

In that case the system32 folder is irrelevant since it contains only 64 bit components. In addition the SlimDX application is a .Net library and .Net components don't get installed into the <system> folder anyhow.

 

Also depending on your LabVIEW version you have to use either the .Net 2.0 or .Net 4.0 version of the libraries, unless you create a manifest file for your LabVIEW system to load the other .Net framwork version on launch. LabVIEW before 2013 starts up with .Net 2.0 compatibility and after that with .Net 4.0.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 13
(6,607 Views)