LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I load a picture and use it in ActiveX in run time ??

I am using an ActiveX object which needs a property "picture" as input.
I can set the picture property in its property page in design time, but I don't know how to give it a "picture" in run time.
In VB, I can do:
 
dim pic As Picture
pic = loadpicture("c:\test.bmp")
control_1.picture = pic
(("control_1" is the ActiveX object, and picture is the property))
 
How can I do the same with labview?
Is there any example that sets the picture property of an ActiveX in run time?
0 Kudos
Message 1 of 17
(4,797 Views)

I just find that in VB I can read picture properties such as handle, height, type, etc. of ActiveX objects.

But in LabView, these properties all return zero.

You can see it in attached files. (I use Microsoft Picture Clip ActiveX object as example)

Could anyone please tell me why? 

Or........ just tell me if LabView can handle picture property of ActiveX.

I really enjoy writing in G.

I hope I can do everything with labview~~

Download All
0 Kudos
Message 2 of 17
(4,775 Views)

Hi sealiker,

      Try pulling Hwnd, Height, and Width straight off the "IPicClip".  No help for hPal, or Type....

Cheers.

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 3 of 17
(4,767 Views)

Check the attached file!

I just try to simply pass a picture from PicClip_1 to PicClip_2.

Why it doesn't work?

What should I do ?

Help me~~~~~

0 Kudos
Message 4 of 17
(4,764 Views)

Hi Sealiker,

     I'm missing the PicClip object and can't pursue this now.  However, if you examine the properties of the PicClip class, you should see the handle , Height, and Width (along with Picture.)  They returned valid values on another machine.

Dunno what's happening with Picture! - but I've never used these tools.

We should be looking at error codes, though.  Might be a type (or class) incompatibility here...

Cheers.

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 5 of 17
(4,752 Views)


@sealiker wrote:
I am using an ActiveX object which needs a property "picture" as input.
I can set the picture property in its property page in design time, but I don't know how to give it a "picture" in run time.
In VB, I can do:
 
dim pic As Picture
pic = loadpicture("c:\test.bmp")
control_1.picture = pic
(("control_1" is the ActiveX object, and picture is the property))
 
How can I do the same with labview?
Is there any example that sets the picture property of an ActiveX in run time?


As far as I understand from the MSDN site, it seems that the Picture datatype is a specific VB only datatype. Most probably it is a handle (uInt32) value as far as other programs including LabVIEW are concerned, but there is no way that LabVIEW could deal with this datatype directly.
If you can convert this datatype with some VB fucntions into a HBITMAP or HDIB then you could call some Win32 API functions to extract the relevant bitmap data from this common Win32 datatype and get somewhere from there. OR it maybe that VB itself has other functions to extract the bitmap data, color palette and other attributes of the Picture datatype. Don't expect LabVIEW to be able to deal with the Picture datatype directly though, this is really a proprietary VB thing.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 17
(4,748 Views)

Thanks for your replies, but I feel a little bit frustrated now~~:(

I got a error message which said that the interface is not supported when I tried to automation open a stdType.picture activeX Class.

But I am still looking forward to a solution.

I find a VC++ thing which seems try to create a picture class for ActiveX via the COleDispatchDriver class (implements the client side of OLE automation). 

Maybe the OLE automation  can be used in Labview, or a VC++ file can be written to be called from labview. 

Do you think this a way I can try?

I don't have a computer science background and do need some help and suggestions.

 

由 sealiker 在 03-07-2006 05:48 AM 上編輯的訊息

0 Kudos
Message 7 of 17
(4,729 Views)
Hi:

I have this same problem and I have yet to find a solution. I am using the Microsoft ImageList Control and I wish to add images at run-time. The imagelist has an ADD method that expects a 'Picture' input. This is a special pointer or reference data type that I do not know how LabVIEW can generate from an image file.

I am researching this and will let you know if I find anything.

Anthony L.
0 Kudos
Message 8 of 17
(4,704 Views)

Hi  Anthony,

I found that some ActiveXs dealing with images such as ImageX  have a load method that allow one to load a picture with just a file path.

Maybe this will help you~

Unfortunately, the ActiveX I am using, like the Ms image list, doesn't have a load method.

I hope that NI can offer some support about dealing with Ole picture in labview.

0 Kudos
Message 9 of 17
(4,688 Views)
Hi :

Thank you for the imageX suggestion. I have downloaded ImageX for a test run.

. . .  Apparently prehaps we could also make our own VB 'LoadPicture DLL' that has just one function that accepts a path and outputs a picture  reference. The downside is that we would have to install the VB run-time support files. Something that is native within the Windows OS COM files would be great.

Anthony
0 Kudos
Message 10 of 17
(4,674 Views)