Getting Started : Chapter 5 Support for the MFC Feature Pack : Tips and Troubleshooting
Tips and Troubleshooting
Creating Applications without a MenuBar
Creating an application without a menu can cause unwanted drawing side effects in the main frame. There is some additional work required for applications that do not use a menu. Mostly, you must destroy the menus that get created by the frame window, as well as handle them in the frame classes with several overridden functions. Please refer to the following Microsoft article work workarounds:
http://support.microsoft.com/kb/131368
RWUXTheme Compatibility
The features in the FoundationEx library do not use functionality from Stingray Studio’s RWUXTheme library. Drawing in FoundationEx is handled by the Visual and Drawing managers in the MFC Feature Pack. Controls in Stingray Studio’s other products still use the RWUXTheme library for themed drawing.
There may be some drawing style conflicts when using RWUXTheme styles and those provided by the MFC Feature Pack. The Stingray Studio controls have not been updated to use the new Visual and Drawing managers.
Office 2007 Theme Issues
This appears to be several bugs in the MFC Feature Pack Office 2007 styles. Currently, there is no work around. Refer to:
Visual Manager Sleep Problem
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/88b4bfe4-782a-4a0d-a042-e38be2c56544
Customized Popup Menus
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=325105
Auto-Hidden Taskbar
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361025
Frame Drawing Artifacts with CMDIChildWndEx
http://social.answers.microsoft.com/Forums/pt-BR/vcgeneral/thread/33da79b7-4381-4b60-ad4e-cadece94b852
Conflicts with INT16
If you get compiler errors related to definitions of INT16, make sure you include FoundationEx.h before other Stingray product header files. Similarly, the following errors might also be found if FoundationEx.h is included below any Stingray product header files:
 
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxbutton.h(182) : warning C4003: not enough actual parameters for macro 'SelectFont'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxbutton.h(182) : error C2226: syntax error : unexpected type 'HFONT'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxbutton.h(182) : error C2238: unexpected token(s) preceding ';'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxfontcombobox.h(45) : warning C4003: not enough actual parameters for macro 'SelectFont'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxfontcombobox.h(45) : error C2059: syntax error : '<L_TYPE_raw>'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxfontcombobox.h(45) : error C2238: unexpected token(s) preceding ';'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxfontcombobox.h(46) : error C2059: syntax error : '<L_TYPE_raw>'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxfontcombobox.h(46) : error C2238: unexpected token(s) preceding ';'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxheaderctrl.h(85) : warning C4003: not enough actual parameters for macro 'SelectFont'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxheaderctrl.h(85) : error C2226: syntax error : unexpected type 'HFONT'
c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxheaderctrl.h(85) : error C2238: unexpected token(s) preceding ';'
Make sure FoundationEx.h is included before any Stingray product header files to avoid these errors.
Multiple Toolbar Layout
If your toolbars are not restoring correctly after setting up the layout, make sure you have created them with the Create() function and that you also have a unique ID for each toolbar created.
Unique Toolbar IDs
Create a unique toolbar ID for each toolbar created.
 
#define ID_TOOLBAR1 200
#define ID_TOOLBAR2 201
// CMainFrame::OnCreate()
if(!m_wndToolBar1.Create(this,
WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_HIDE_INPLACE|
CBRS_SIZE_DYNAMIC|CBRS_GRIPPER|CBRS_BORDER_3D, ID_TOOLBAR1) ||
!m_wndToolBar1.LoadToolBar(IDR_TOOLBAR1))
{
return -1;
}
if(!m_wndToolBar2.Create(this,
WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_HIDE_INPLACE|
CBRS_SIZE_DYNAMIC|CBRS_GRIPPER|CBRS_BORDER_3D, ID_TOOLBAR2) ||
!m_wndToolBar2.LoadToolBar(IDR_TOOLBAR2))
{
return -1;
}
Lay Out Toolbars Next to Each Other
If you have multiple toolbars that you are trying to lay out next to each other, you can do so as follows:
 
m_wndToolBar1.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndToolBar1);
DockPaneLeftOf(&m_wndToolBar2, &m_wndToolBar1);
NOTE >> Also, it may be necessary to delete any previous registry entries that contain information on the application layout. See also the section on SetRegistryKey() Conflicts below.
SetRegistryKey() Conflicts
Calling SetRegistryKey() with the use of SFLWinAppEx::Initialize() may cause some registry conflicts that affect the layout of menus and toolbars because Initialize() sets the registry with a default set of registry values. Calling SetRegistryKey() before calling Initialize() should resolve this problem:
 
DelRegTree(HKEY_CURRENT_USER, _T("\\Software\\StingrayEx"));
CString regkey = _T("StingrayEx");
SetAppRegKey(regkey);
SFLWinAppEx::Initialize(TRUE, TRUE, FALSE /*Registry Setup*/);
Likewise, it may be necessary to also call DelRegTree() prior to the SetRegistryKey() call in order to clear registry calls before setting the registry key:
 
DelRegTree(HKEY_CURRENT_USER, _T("\\Software\\StingrayEx"));
Crash in pMainFrame->LoadFrame(IDR_MAINFRAME)
If the sample or application you are running crashing during the Main Frame’s InitInstance() in the section loading the frame, chances are it is a static configuration and afxribbon.rc has not been added to the sample or application’s resource includes. Add the following to the project resource includes section:
 
#include “afxribbon.rc”
Runtime Crash in afxregpath.cpp
Migrating an existing application may lead to a runtime crash after migration. This can be fixed by deleting any previous existing registry values for the application, or by adding a new registry value for the application using SetRegistryKey() before any calls to SFLWinAppEx::Initialize().
Use of DECLARE_DYNAMIC() / IMPLEMENT_DYNAMIC()
Template classes do not work with the DECLARE_DYNAMIC() and IMPLEMENT_DYNAMIC() macros. Either remove these calls or forward the calls to the base class of the class used in FoundationEx. For example: forward to CSplitterWnd instead of CSplitterWndEx.
Warning GetWindowMenuPopup failed!
This is a known problem that you can find discussed at various places on the internet. The basic issue is that the Stingray library replaces the standard Windows menu bar with the Stingray menu bar, so when MFC fails to find the standard menu bar it issues this warning. As the internet discussions attest, this warning does not indicate an actual problem and can safely be ignored, although there are discussions of how to get rid of the warning.
Importing/Exporting Implementation
The FoundationEx library uses the _SFLEXDLL preprocessor command to indicate Dynamic Link Library builds. If this preprocessor is not included, the build will be a static library.
Classes use the FOUNDATIONEX_API macros as defined in StingrayExportDefs.h, which is located in the <StingrayInstallDir>\Include directory to define importing and exporting. The library itself has _SFLEX_EXPORT_IMPL defined during builds. This gives the macros a definition of __declspec(dllexport). Since this macro is not defined in samples and applications, the functions in FoundationEx are imported, as FOUNDATIONEX_API is defined as __declspec(dllimport).
For further information on importing and export of the Stingray libraries, consult the Getting Started User’s Guide.
Resource Corruption
The Microsoft Visual Studio 2008 SP1 or later compilers may truncate the end of a .rc file, causing compile errors. Refer to the following:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=347841
OnNcActivate() Illegal Call of Non-static Member Function
When porting samples that use the call to OnNcActivate(), use the base class CMDIFrameWndEx instead of SFLFrameWndEx. For example:
 
BOOL CMainFrame::OnNcActivate(BOOL bActive)
{
if (GXDiscardNcActivate())
return TRUE;
return CMDIFrameWndEx::OnNcActivate(bActive); //SFLFrameWndEx
}