LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to access Window Handle (HWND) in Labview. This is an argument of a DLL. Also I need to get a pointer of an image buffer.

Call library function in Labview:
=================================

Hi all,

I'm trying to access a DLL using Call library function in Labview.

1) I have problems in obtaining the window handle (hDC) of an object in Labview.
2) Also to get the pointer of an image buffer.

thanks

Code Warrior
Take life as it comes! you may never know what's gonna happen Tommorrow
0 Kudos
Message 1 of 10
(6,956 Views)
Code Warrior;

Get the Windows API Function Utilities (32-bit) for LabVIEW. For instructions, check the article "How Do I Get the Instance of a LabVIEW Window?". Additional information is in here: Where Can I Get Help Calling Windows API Functions from LabVIEW?

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 2 of 10
(6,947 Views)
This is just an FYI in regards to item one. You can get the main windows hWND but your not going to be able to go any further down the chain. LabVIEW is a completely owner drawn application including all the controls. IE there are no hWNDs or hDCs for any of the "objects"...
0 Kudos
Message 3 of 10
(6,944 Views)
Thanks,

Now, I'm able to access the (hDC) of the main window, As you said.

But still I'm not able to get the reference of the "object" inside the LabVIEW main window. (for example, I want to send the handle of the Image Window to a DLL, so that I can get the output from DLL as the Image or Graph)

Thanks
CodeWarrior
Take life as it comes! you may never know what's gonna happen Tommorrow
0 Kudos
Message 4 of 10
(6,929 Views)


@CODE WARRIOR wrote:
Thanks,

Now, I'm able to access the (hDC) of the main window, As you said.

But still I'm not able to get the reference of the "object" inside the LabVIEW main window. (for example, I want to send the handle of the Image Window to a DLL, so that I can get the output from DLL as the Image or Graph)

Thanks
CodeWarrior




As Chaos said, you simply can't do that. All the front panel objects in LabVIEW are actually LabVIEW objects and absolutely NOT based on Windows standard controls. So there is no Windows HWND associated with them at all.

The only thing you can do is pass the handle of the main window and the area of the window you want the function to BitBlt the image into. However this can be troublesome, as the external bitbliting happens completely asynchronous from LAbVIEW and if LabVIEW feels that it needs to redraw some area of the window for whatever reason, this may collide with the update from your external DLL.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 10
(6,915 Views)
Warrior;

As other pointed out, you can't.

An alternative is to write a wrapper dll. You pass the image to the dll you write, create the necessary handlers and pass it over the other dll.

In order to consider other alternatives... what is the reason you need to call an external dll?

Message Edited by Enrique on 04-23-2005 10:37 PM

www.vartortech.com
0 Kudos
Message 6 of 10
(6,913 Views)
I'm trying to do something similar right now and coming to the same problems. I am trying to get the image from a Nikon DXM1200 camera that is mounted on a microscope. It has its own commands and capture card and is not playing well with the imaq stuff. I am using their SDK in an effort to get the images into LabVIEW.

As I said, I am having the same types of problems. I managed to wrap everying into a dll and into a .net assembley, but I have been unable to figure out a way to get it into LabVIEW. I can call either of these things from LabVIEW to make an image capture. But, I have been unable to transfer that image into LabVIEW. I also have been unable to get enough windowing information to get the information into LabVIEW.

I am not sure what Code Warrior is doing, but here is why I have been tracking this thread with great interest.

Thanks for the thread,
Bob
0 Kudos
Message 7 of 10
(6,885 Views)


@BOB Y. wrote:
I'm trying to do something similar right now and coming to the same problems. I am trying to get the image from a Nikon DXM1200 camera that is mounted on a microscope. It has its own commands and capture card and is not playing well with the imaq stuff. I am using their SDK in an effort to get the images into LabVIEW.

As I said, I am having the same types of problems. I managed to wrap everying into a dll and into a .net assembley, but I have been unable to figure out a way to get it into LabVIEW. I can call either of these things from LabVIEW to make an image capture. But, I have been unable to transfer that image into LabVIEW. I also have been unable to get enough windowing information to get the information into LabVIEW.

I am not sure what Code Warrior is doing, but here is why I have been tracking this thread with great interest.

Thanks for the thread,
Bob




You might want to look at http://www.hytekautomation.com/products.html. They have a Nikon interface for LabVIEW and since you already have the SDK, the issue mentioned on their site won't be a problem for you. It is for sure much more cost effective to pay them some money for that interface than trying to develop an interface yourself. The issues are quite involved and even if you knew quite some stuff about LabVIEW memory management and its internal C programming interface (and you can get quite some information from looking at the NI-IMAQ VIs too, eventhough they are anything but a nice example for good programming style), it is a work counting into weeks to get it done right.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 10
(6,875 Views)

@Enrique wrote:
SNIP
An alternative is to write a wrapper dll. You pass the image to the dll you write, create the necessary handlers and pass it over the other dll.




Lets say I wanted to do this, how do you do it?

I am not really a wondows programmer. I have done some C work and lots of LabVIEW, but windowing is a little over my head. Any help that y'all can give me would be appreciated.

I have sent an e-mail to Hytek Automation and may just buy my way out of this, but assuming that I cannot . . .

Thanks,
Bob
0 Kudos
Message 9 of 10
(6,866 Views)


@BOB Y. wrote:

@Enrique wrote:
SNIP
An alternative is to write a wrapper dll. You pass the image to the dll you write, create the necessary handlers and pass it over the other dll.




Lets say I wanted to do this, how do you do it?

I am not really a wondows programmer. I have done some C work and lots of LabVIEW, but windowing is a little over my head. Any help that y'all can give me would be appreciated.

I have sent an e-mail to Hytek Automation and may just buy my way out of this, but assuming that I cannot . . .

Thanks,
Bob




Well, to help further I would both need the SDK and some time. The SDK might be a license problem but the time is at the moment simply non-existent to go deeper into this, eventhough it touches some of my pet areas.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 10 of 10
(6,863 Views)