Jump to content

Trouble calling an ActiveX control


Recommended Posts

post-9524-126331294154_thumb.jpg

Manufacture provides an ActiveX control to use in LabVIEW. One function "OpenConnection (ServerName: PChar; out Result: OleVariant) requires a Pascal PChar type; when accessed from LabVIEW, it is converted to String type. I tried to wire a normal LabVIEW string, it returned an error saying the ActiveX Server is not installed or registered. I manually registered the server, but it still returns the same error.

I tried to convert the LabVIEW string to a Pascal type, like shown in the picture (put the string length in the beginning and a NULL in the end to make it a null-terminated string), still the same error. My guess is that the problem still lies in the string, it is not compatible with the Pascal type. But how can I convert the string in this case?

Edited by menghuihantang
Link to comment
  • 2 weeks later...

I don't think that you need a pascal String.

Since you're working with an ActiveX object all data types must be automation compatible, however, pascal string aren't.

The only string type type allowed for use with ActiveX is BSTR. LabVIEW converts string arguments automatically to that type. If your method really would require a pascal string you couldn't even select it (LabVIEW disables methods that aren't automation compatible in the dropdown list).

It seems there must be another problem. Your error message usually means that the object isn't registered properly

(Sometimes manual registering seemed to work but in fact it didn't). Perhaps some requirements of your component are missing. Verify that your ActiveX object is registered properly and creatable, e.g. with Microsoft's OleView utility.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.