Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Unhandled exception in C++ WriteMultipleItemValues

More
15 Aug 2023 17:25 #12000 by ZParham
Perfect, thank you so much!

Please Log in or Create an account to join the conversation.

More
15 Aug 2023 15:56 #11998 by support
Hello.
There is a bug in the example.

Here is the fixed part:

 
CComSafeArray<VARIANT> ArgumentsArray(8);
ArgumentsArray.SetAt(0, _variant_t((IDispatch*)ItemValueArguments1Ptr));
ArgumentsArray.SetAt(1, _variant_t((IDispatch*)ItemValueArguments2Ptr));
ArgumentsArray.SetAt(2, _variant_t((IDispatch*)ItemValueArguments3Ptr));
ArgumentsArray.SetAt(3, _variant_t((IDispatch*)ItemValueArguments4Ptr));
ArgumentsArray.SetAt(4, _variant_t((IDispatch*)ItemValueArguments5Ptr));
ArgumentsArray.SetAt(5, _variant_t((IDispatch*)ItemValueArguments6Ptr));
ArgumentsArray.SetAt(6, _variant_t((IDispatch*)ItemValueArguments7Ptr));
ArgumentsArray.SetAt(7, _variant_t((IDispatch*)ItemValueArguments8Ptr));
CComVariant vArgumentsArray(ArgumentsArray);
 
LPSAFEARRAY pArgumentsArray = ArgumentsArray.Detach();
CComSafeArray<VARIANT> ResultArray;
ResultArray.Attach(ClientPtr->WriteMultipleItemValues(&vArgumentsArray));
ArgumentsArray.Attach(pArgumentsArray);
 
 


There are two differences:
1) additional variable - CComVariant vArgumentsArray(ArgumentsArray);
2) use of that variable - the WriteMultipleItemValues call now uses &vArgumentsArray and not &pArgumentsArray

Will be fixed in the upcoming version. Good catch!

Best regards
The following user(s) said Thank You: ZParham

Please Log in or Create an account to join the conversation.

More
14 Aug 2023 16:19 #11987 by ZParham
We are using the project at C:\Program Files (x86)\Software Toolbox OPC Data Client 2022.2\Examples-COM\CPP\VisualStudio\Win32\WriteMultipleItemValues unmodified.

ReadMultipleItems in the same solution that is launched with that project runs successfully with no errors.

We have tried this with both the kit server (OPCLabs.KitServer.2) and TOP Server, and saw the same error with both.

Please Log in or Create an account to join the conversation.

More
14 Aug 2023 16:09 #11986 by support
Hello,

1. In the same project, are they calling some other methods on the _EasyDAClient - such as ReadXXXX? If so, do they work?

2. Which target OPC server are they connecting to?

Thank you

Please Log in or Create an account to join the conversation.

More
14 Aug 2023 14:58 #11985 by ZParham
Hello!

We are doing some troubleshooting for a customer using OPC Data Client version 2022.2 in C++ with Visual Studio 2022.

When we attempt to run WriteMultipleItemValues from WriteMultipleItemValues.vcxproj, we receive an unhandled exception with an HRESULT of "E_NOINTERFACE," screenshot attached.


We are having a hard time troubleshooting this no interface supported error.

What are we missing here to get WriteMultipleItemValues to work?

Thank you, as always!

Zachary Parham
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.106 seconds