LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Windows data

Instead of create a new window, you can simply use your front panel.

 

To find the window handle, download Windows API Function Utilities (32-bit) for LabVIEW from NI website.

 

 

George Zou

http://webspace.webring.com/people/og/gtoolbox/

 

George Zou
0 Kudos
Message 11 of 17
(1,384 Views)
Given that, how do I know where the video stream will be displayed.  Will it fill the whole window?
0 Kudos
Message 12 of 17
(1,376 Views)

The video stream most likely will be displayed on the top-left corner of the window specified by hWnd, or a child window.

That's the choice of the Sensoray application.  Same for fill the window.

George Zou
0 Kudos
Message 13 of 17
(1,365 Views)

Wow this is a really old thread of mine Smiley Wink

 

I was actually able to figure this out, so here it goes:

 

You can use the current front panel window, or create another by placing a subVI in your application which shows its front panel and remains open for as long as you want to show the video. You need to know the name of this window (what shows up in the titlebar) to get the window handle. (This can also be changed by using VI Properties)

 

Next, to get the window handle you can use one of the VI's supplied from NI, or just use the User32.dll called "FindWindowA", which returns the handle based on window name. Now, from the sensoray DLL, use the function "SN_SetBoardWindow" (its parameters are defined in the 2250/51 documentation). One of these parameters is "bsize", which defines the size of the video which will be displayed in the window. There are 2 options, 720x480 (option 0) or 360x240 (option 1). What I did was resize the video window to fit whichever resolution size the user had chosen, and displayed the video in that window using that resolution.

 

All thats left after that is to make the "SN_StartStream" call from the sensoray dll and the video should appear in the window! (Assuming that the device was initialized properly prior to doing any of this).

 

Hopefully this helps, let me know how it goes!

 

Eric  

Message 14 of 17
(1,353 Views)

Here is what I am doing:

 

First:  I use the Open Board API, then I use the Set Board Window (feeding it the Hwnd value from Get Window Refnum.vi modified to send out Hwnd instead of windows reference), then use the Start Stream API.  When I do this the Start Stream API returns a value of -2147220985.  And nothing happens.  I have attached the little test program.  Hopefully the issue is just that I haven't initialized something correctly.

 

Also, one other note, the API I have for the Set Board Window defines the in's and out's to be Board (interger), Reserved (Bool), and Hwnd (hwnd).  Thanks.

0 Kudos
Message 15 of 17
(1,342 Views)

I cant open your VI because i'm using 8.5, but the arguments I am passing SN_SetBoardWindow are HWND (U32), bsize (U8), and board (I32). I then call SN_StartStream which only takes board (I32) as an argument. I am not sure what the error you are recieving from SN_StartStream means, but my guess is that you are not correctly setting the board window. If you save your VI in LabView 8.5 or lower, I will check out what your doing.

 

Eric

0 Kudos
Message 16 of 17
(1,328 Views)
Here it is in 8.5 I believe.
0 Kudos
Message 17 of 17
(1,323 Views)