Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is may be very old problem but i really fustrating with same due to some API issues.

I am using some Desktop application API who's version changes each and every month with new feature. Lets consider following scenario, A Company ABC LTD introduce one window application ABCPRO now when they introduce it they dont have com support that is in version 1.0.0.0 the ABCPRO dont have com API. Now company progress and introduce new version of ABCPRO 1.0.0.1 , even this version they dont have com support.After some beta releases of ABCPRO in 1.* they finally introduce com suport for ABCPRO in version 2.0.0.0.

now its pleasure for us to get ABCPRO API and do some functionality.things works great with version 2.0.0.0.

Now in version 2.0.0.1 they introduce one more feature say LMN and which userful to us.so we remove ABCPRO 2.0.0.0 and install ABCPRO 2.0.0.1.Things work great for all our 2.0.0.1 customers but it fails when our customer have ABCPRO 2.0.0.0 So my executable crash on machine where ABCPRO 2.0.0.0 is present because i develop executable using 2.0.0.1.

So how to come out of this problem of versioning because i known in feature there are lots of versions of ABCPRO are going to be introduced with the feature that we needed but what about all old versions?????

Following code may clear you.

C++
int main()
{
   IABCPROAPI ABCPRO;
   VARIANT var;
   ABCPRO->GetNameOfServer(&Var);
   VARIANT LMNVar;
   ABCPRO->GetLMN(&LMNVar);             //This introduce in version 2.0.0.1
}
Posted

1 solution

In COM you should use QueryInterface[^] to ensure a method is available before you try to use it.
 
Share this answer
 
Comments
Coder Block 9-Jul-13 2:26am    
Hey thanks for reply but please can you explain me same with example??
Richard MacCutchan 9-Jul-13 2:37am    
Did you bother to follow the link I provided? This is basic COM which you really need to understand if you are working with COM based libraries.
Coder Block 9-Jul-13 2:51am    
I know QueryInterface() used to separate multiple interface from single one but I really doesn't known how to apply it for version management!!
Richard MacCutchan 9-Jul-13 4:08am    
You know the CLSID of the interface you are trying to access, so QueryInterface will tell you whether that interface is available on the system.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900