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.
Sample c++ code (subscribe, error handling, MFC)
In my view, however, if you have a MFC application, you can use the code we provided just well - that is, combine the code from the example with your existing MFC code. MFC and ATL are now considered a single library by Microsoft, and the reason we chose the "ATL" approach for our examples is because it works best (I am not sure if it can be done the "pure MFC" way).
Please Log in or Create an account to join the conversation.
Sent: Thursday, September 11, 2014 2:10 AM
To: Zbynek Zahradnik
Subject: OPC Labs Contact Form - MFC Event handling
[...]
Please provide sample code that demonstrates how to set up asynchronous event messages using MFC. The sample code that I have seen up to this point is ATL based. It is slightly different in syntax from that of MFC. The sample code should have the following components:
1. Syntax for coding the message map
2. Syntax for initiating the asynchronous updates (advise method)
3. Syntax showing how to declare the class
4. Syntax showing how to declare the constructor
Please Log in or Create an account to join the conversation.
I have created a project that demonstrates the proper error handling and OPC quality recognition in the event handler.
The project file (SubscribeErrorHandling.zip) is attached to this post, and the most important part of the code (the ItemChanged event handler with the exception handling) is listed here:
I am not sure about the other parts of your question. Our events are not Windows messages, and my understanding is that therefore the MFC message maps cannot directly handle them.
Best regards
Please Log in or Create an account to join the conversation.
Sent: Wednesday, September 10, 2014 4:24 AM
To: Zbynek Zahradnik
Subject: OPC Labs Contact Form - Sample c++ code
[...]
Subject:
Sample c++ code
Note
Sample MFC code for Advise(Subscribe) with event notification(MESSAGE_MAP).
Sample Advise callback function that uses Exception interface.(extract error codes)
Please Log in or Create an account to join the conversation.