Tech Tips
By Edited by Chris Branch, May 01, 2002
Size Limitations for Device-Dependent Bitmaps - Stephen Schumacher
The ability to create large bitmaps in your app will vary with each machine it runs on. Here are some tips to reduce the limitations.
Custom Keyboard Navigation with Radio Buttons - Matthew Wilson
In some situations, such as web-page style windows or embedded dialogs, the default keyboard handling may not be enough. This solution helps provide the right user feedback for radio button navigation.
Using Resources in MFC Extension DLLs - Thomas Gawehns
Here's a class to manipulate the global module handle that MFC uses to retrieve resources. This lets you avoid trouble if your resource IDs overlap with IDs used by other extension DLLs.
An Easy Way to Add Tool Tips to Any MFC Control - Zuoliu Ding
A parent window may not intercept the WM_MOUSEMOVE message for a child control because the child window eats this message without routing it to the parent. If you want to add tool tips for each control in a child window, the helper class CTipHelper presented here will forward WM_MOUSEMOVE messages on to its parent.
May 2002/Tech Tips
Example 1:
A message loop with special processing for the Tab key
BOOL CCompositeDialog::PreTranslateMessage(MSG* pMsg)
{
// Check for keyboard event
if( pMsg->message >= WM_KEYFIRST &&
pMsg->message <= WM_KEYLAST)
{
// Check for TAB pressed
if( pMsg->message == WM_KEYDOWN &&
pMsg->wParam == VK_TAB)
{
// Check for SHIFT pressed
HWND hwndFocus = ::GetFocus();
BOOL bBackward = IsKeyPressed(VK_SHIFT);
// m_hwndInnerFirst and m_hwndOuterPrior are established
// already at dialog creation time
if( bBackward &&
IsRadioPeer(m_hwndInnerFirst, hwndFocus))
{
// The last in the radio group was left backwards
// so move to the previous control in the outer
// dialog
::SetFocus(m_hwndOuterPrior);
return true;
}
... other processing
}
}
return BaseClass::PreTranslateMessage(pMsg);
}