Thursday, May 26, 2011

COM interface pointer wrapping

Today I created the repository for the new test project and started on the framework.

One of the things I want to try out in this project is a better wrapper around COM interfaces.  Previously, each interface had its own wrapper class which handled creation of the associated object, as well as destruction.  This was a bit difficult to work with though, and caused the code to look like "m_dev->m_dev->Present()".

The new wrapper I am going to try out will be generic by way of a template.  One really nice thing about this new design is that I will be able to pass the wrapper directly to a function which is expecting a normal COM interface pointer.  This will be done by overloading the address-of operator to return the address of the interface pointer being wrapped.  With the old design I had to make such calls inside of the wrapper, which lead to some really rigid code.

Another thing I will be looking into is hooking the window to process input messages separate from the windowing code.  I have never liked having the WM_KEYDOWN message processing inside of the window manager.

No comments:

Post a Comment