Archive for May, 2014

CMessageBoxX v1.06

May 18, 2014 Comments off

Just to let everyone know that v1.06 of CMessageBoxX has been released. Updates for this version include:

  • Updated copyright details.
  • Updated the code to compile cleanly on VC 2012 and later. Further changes were required to achieve this because MFC in Visual Studio 2012 has been reworked to use the SDK style fusion wrappers rather than those in the now defunct afxcomctl32.h header file.
  • Updated the SetCaption method to operate where AfxGetApp() returns NULL.
  • Updated the project settings to more modern default values.
Categories: Web Site Updates

MSMQWrappers v1.0

May 5, 2014 1 comment

Just to let everyone know that v1.0 of MSMQWrappers has been released. This is a set of C++ classes to provide a complete C++ encapsulation of MSMQ (Microsoft Message Queuing).

The classes provided are: MSMQ::CCursor, MSMQ::CQueue, CMSMQ::CSearch, MSMQ::CSecurityContext, ATL::CComPropVariant, ATL::ComPropVariant2, & MSMQ::CPropVariantAutoFree.

CCursor provides a class based encapsulation of a cursor as returned via MQCreateCursor.

CQueue provides a class based encapsulation of a queue as returned via MQOpenQueue.

CSearch provides a class based encapsulation of a search as returned via MQLocateBegin.

CSecurityContext provides a class based encapsulation of a security context as returned via MQGetSecurityContextEx.

CComPropVariant provides a class based encapsulation of a SDK PROPVARIANT structure with automatic lifetime management of the resources which a PROPVARIANT can contain. Internally MSMQ makes extensive use of this structure which is similar to the good old COM VARIANT structure. I would have expected there to be a built in ATL class to do this wrapping but there isn’t one I could find. This class is modelled upon the ATL CComVariant class and as such I decided to put it in the "ATL" namespace instead of "MSMQ". This class is self contained in its own right and should prove useful in ATL COM development when dealing with the PROPVARIANT structure.

CComPropVariant2 is similar to CComPropVariant except that the lifetime management of the resources which the PROPVARIANT can contain is left up to client code to manage. This is the memory model primarily adopted by MSMQ. Similar to CComPropVariant class, it makes initializing the VARTYPE and various union elements of a PROPVARIANT much easier to code and understand.

CPropVariantAutoFree is another wrapper for the PROPVARIANT structure which provides automatic cleanup of memory allocated via MSMQ via MQFreeMemory in its destructor. Again this C++ encapsulation reduces the amount of boilerplate code you need to write when programming to the MSMQ API. For various examples of using this class in addition to the CComPropVariant(2) classes please see the MSMQDemo.cpp source code module.

Going forward I may add additional wrapper classes to make dealing with the various array structures such as MQQUEUEPROPS, MQMSGPROPS, MQMGMTPROPS etc used in MSMQ easier to program to as well as reducing the boilerplate code required to setup each of these structures. Please let me know your thoughts on this. The development of MSMQWrappers took a number of weeks of hard work researching, developing and testing and hopefully you should find them useful in your C++ MSMQ programming efforts.

Categories: Web Site Updates