Type of GDI object!

To retrieve type of a HGDIOBJ object call GetObjectType. E.g. GetObjectType( hGdiObj ); Possible return values taken from MSDN… [sourcecode language=’cpp’]OBJ_BITMAP OBJ_BRUSH OBJ_COLORSPACE OBJ_DC OBJ_ENHMETADC OBJ_ENHMETAFILE OBJ_EXTPEN OBJ_FONT OBJ_MEMDC OBJ_METAFILE OBJ_METADC OBJ_PAL OBJ_PEN OBJ_REGION[/sourcecode]
Continue reading…

 

Careful with memset and ZeroMemory!

Do not use these functions for initializing classes which contains other class objects. Always go via constructors for initializing class objects. I personally use { 0 } for initializing c-style structures which is safe since compiler will give an error just in case future someone adds a class object to this structure. For e.g. [sourcecode […]
Continue reading…

 

Making a property sheet window resizable!

Sometime back my boss asked me to write a test application for a layout manager. This test application was for testing layout manager on a property sheet! Hmm so property sheet cannot be resized even if you modify the style of a property sheet. Well the reason why it can’t be resized is because SC_SIZE […]
Continue reading…

 

DLL Best Practices

Following information taken from this document maintained by microsoft! An important excerpt from this document! DllMain is called while the loader-lock is held. Therefore, significant restrictions are imposed on the functions that can be called within DllMain. As such, DllMain is designed to perform minimal initialization tasks, by using a small subset of the Microsoft® […]
Continue reading…