Archive

Archive for December, 2008

CAVICapWnd v1.12

December 29, 2008 Comments off

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

  • Updated copyright details
  • Removed VC 6 style AppWizard comments from the code.
  • Updated code to compile correctly using _ATL_CSTRING_EXPLICIT_CONSTRUCTORS define
  • Code now compiles cleanly using Code Analysis (/analyze)
  • The code now only supports VC 2005 or later.
  • Fixed a bug in the ManualCreatePalette method where the wrong windows message was being used.
  • Various functions now take a LPCTSTR instead of a const CString& parameter.
  • Code now supports the WM_CAP_GET_MCI_DEVICE message
  • SetScroll method now takes a LPPOINT parameter
  • Fixed a bug in GetDescription where the description parameter was not being passed by reference.
Categories: Web Site Updates

CSelectCertificateDlg v1.02

December 28, 2008 Comments off

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

  • Updated copyright details
  • Removed VC 6 style AppWizard comments from the code
  • The code has now been updated to support VC 2005 or later only
  • Code now compiles cleanly using Code Analysis (/analyze)
  • Updated code to compile correctly using _ATL_CSTRING_EXPLICIT_CONSTRUCTORS define
  • Added explicit support for the following OID’s: szOID_PKIX_KP_OCSP_SIGNING, szOID_PKIX_OCSP_NOCHECK, szOID_PKIX_OCSP_NONCE, szOID_KP_CTL_USAGE_SIGNING, szOID_SERVER_GATED_CRYPTO, szOID_SGC_NETSCAPE, szOID_KP_MOBILE_DEVICE_SOFTWARE, szOID_KP_SMART_DISPLAY, szOID_KP_CSP_SIGNATURE, szOID_DRM_INDIVIDUALIZATION & szOID_KP_KERNEL_MODE_CODE_SIGNING
Categories: Web Site Updates

CHLinkCtrl v1.29

December 22, 2008 Comments off

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

  • The code now uses TrackMouseEvent to implement support for highlighting instead of capturing the mouse.
Categories: Web Site Updates

CHLinkCtrl v1.28

December 22, 2008 Comments off

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

  • Updated copyright details
  • Removed VC 6 style AppWizard comments from the code
  • The code has now been updated to support VC 2005 or later only
  • Code now compiles cleanly using Code Analysis (/analyze)
  • Made the "Open" method virtual
  • The verb passed to ShellExecute can now be customized.
  • Notifications for the static control are now enabled via a WM_NCHITTEST message handler
  • All the default colors and behaviour for the hyperlink are now taken from the users default settings at HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Settings|Main. These settings include a new setting which controls the underline behaviour. The programmer can still change these values if you so desire.
  • Fixed a redraw glitch when the control is sent what looks like unsolicited reflected CTLCOLOR messages from the parent even when it does not look like the control needs repainting. The control now does not draw transparently, instead it uses SetDCBrushColor and GetStockObject(DC_BRUSH). Please note that this means that the control will only work on Windows 2000 or later and requires _WIN32_WINNT to be defined >= 0x0500
Categories: Web Site Updates

DDXFile v1.23

December 21, 2008 Comments off

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

  • Updated copyright details
  • Removed VC 6 style AppWizard comments from the code
  • InitializeAutoComplete now returns a HRESULT instead of a BOOL
  • Updated DDX_FileControl code to be consistent with DDX_Control in VC 2008
  • The code has now been updated to support VC 2005 or later only
  • Code now compiles cleanly using Code Analysis (/analyze)
  • The code now can use the Vista style of file dialog provided by VC 2008
  • Fixed a bug in the sample app where the various checkbox UI states were not initially in sync with the control.
Categories: Web Site Updates

DDXFolder & CChooseDirDlg v1.37

December 18, 2008 Comments off

Just to let everyone know that v1.37 of DDXFolder & CChooseDirDlg has been released. Updates for this version include:

  • Updated copyright details.
  • InitializeAutoComplete now returns a HRESULT instead of a BOOL
  • DDV_FolderControlNotFile function has been renamed to DDV_FolderControlIsFolder
  • Removed VC 6 style AppWizard comments from the code
  • The code has now been updated to support VC 2005 or later only
  • Code now compiles cleanly using Code Analysis (/analyze)
  • Refactored the CChooseDirDlg codebase quite a bit
  • Updated DDX_FolderControl code to be consistent with DDX_Control in VC 2008
Categories: Web Site Updates

DtWinVer v1.78

December 15, 2008 Comments off

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

  • Added support for detecting Windows 7
Categories: Web Site Updates

CToasterWnd v1.16

December 14, 2008 Comments off

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

  • The control now supports drawing an alpha blended image in its client area. This is achieved using the new member variables: m_Logo, m_rectLogoSrc, m_rectLogoDest and m_nLogoSrcAlpha. The code internally uses the CImage class and its support for alpha blending via the Win32 API function AlphaBlend. To use this functionality in the control you must define the preprocessor variable WINVER to be >= 500. Thanks to "Sky" for prompting this update.
Categories: Web Site Updates

CFileTreeCtrl v1.53

December 13, 2008 Comments off

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

  • Optimized the memory usage by removing the m_bFileItem member variable from CFileTreeCtrlItemInfo. Instead now whether an item is a File (as opposed to a folder) is encoded into the m_NodeType value. In addition the m_nodeType value has been made a BYTE value. This helps to save an additional 4 bytes per node. Thanks to Michael Mötje for prompting this update.
Categories: Web Site Updates

AFXASSUME bug in VC 2005

December 13, 2008 1 comment

I got a bug report recently about one of my open source modules, namely CVersionInfo giving a compiler warning when the code is compiled in release mode on VC 2005 as follows:

warning C4189: ‘__afx_condVal’ : local variable is initialized but not referenced

If you review the code that caused this warning you will see that it is the macro AFXASSUME. This macro which I have started using in all my code as I upgrade it to support VC 2005 and later only as well as Code Analysis aka Prefast combines the job of the MFC ASSERT macro and the Code Analysis “__analysis_assume” function. Well it turns out that Microsoft just didn’t get the macro fully correct on their first implementation in VC 2005, because they forgot to explicitly optimize the macro away in release mode code just like how the standard ASSERT works. Here’s AFXASSUME from VC 2005 with SP1 applied:

#define AFXASSUME(cond) do { bool __afx_condVal=!!(cond); ASSERT(__afx_condVal); __analysis_assume(__afx_condVal); } while(0)

As you can see it does not take the _DEBUG pre-processor macro into account.

This is reported as a bug on the connect web site at https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101373. This page refers to the error when you build a standard MFC doc/view application with AppWizard and include support for CRichEditView view class. The page also includes a workaround to avoid the compiler warning.

If you take a look at AFX.h in VC 2008 (with SP1) you will see that it has been fixed for good:

#if defined(_PREFAST_) || defined (_DEBUG)
#define AFXASSUME(cond)            do { bool __afx_condVal=!!(cond); ASSERT(__afx_condVal); __analysis_assume(__afx_condVal); } while(0)
#else
#define AFXASSUME(cond)            ((void)0)
#endif

So if you are getting this error in VC 2005, than bear in mind that the problem may not be related to my code but could be a bug in MFC itself. With that said, if you want to release code which incorporates my code and your compiler is VC 2005, then here is a more comprehensive workaround which you should place before you include any of my source modules which use AFXASSUME. Normally the best place to put this would be in your precompiled header stdafx.h before you reference any of my modules:

#if (_MSC_VER < 1500)
  #ifdef AFXASSUME //Redefine the buggy version of AFXASSUME if we are being compiled on VC 2005 which generates the compiler warning "C4189: ‘__afx_condVal’ : local variable is initialized but not referenced". This bug was fixed in VC 2008
    #if defined(_PREFAST_) || defined (_DEBUG)
      #undef AFXASSUME
      #define AFXASSUME(cond)    do { bool __afx_condVal=!!(cond); ASSERT(__afx_condVal); __analysis_assume(__afx_condVal); } while(0)
    #else
      #undef AFXASSUME
      #define AFXASSUME(cond) ((void)0)
    #endif
  #endif
#endif

If the word wrapping seems a bit confusing above, then you can download the macro directly from http://www.naughter.com/download/FIX_AFXASSUME.h.

Happy coding!

Categories: Programming