Click here to Skip to main content
15,900,643 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: this pointer ... Pin
Hadi Rezaee4-Mar-01 18:20
Hadi Rezaee4-Mar-01 18:20 
GeneralRe: this pointer ... Pin
l a u r e n4-Mar-01 20:17
l a u r e n4-Mar-01 20:17 
GeneralRe: this pointer ... Pin
markkuk4-Mar-01 22:24
markkuk4-Mar-01 22:24 
GeneralRe: this pointer ... Pin
Erik Funkenbusch5-Mar-01 9:25
Erik Funkenbusch5-Mar-01 9:25 
GeneralStatus Bar ... Pin
Hadi Rezaee3-Mar-01 18:12
Hadi Rezaee3-Mar-01 18:12 
GeneralRe: Status Bar ... Pin
Wolfram Steinke3-Mar-01 19:11
Wolfram Steinke3-Mar-01 19:11 
GeneralRe: Status Bar ... Pin
Hadi Rezaee4-Mar-01 5:16
Hadi Rezaee4-Mar-01 5:16 
GeneralRe: Status Bar ... Pin
Wolfram Steinke4-Mar-01 10:18
Wolfram Steinke4-Mar-01 10:18 
Ok here goes.
1. Add to dialog header
CStatusBar m_wndStatusBar;
2. Define indicators array as you would in MainFrame of and SDI or MDI application

static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_NUM,
ID_INDICATOR_CAPS,
};

3. Create the status bar in InitDialog

if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}

4. Add OnKickIdle function and Message Map entry
Message Map
ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)

Header
afx_msg void OnKickIdle();

Function
void CMyDlg::OnKickIdle()
{
m_wndStatusBar.OnUpdateCmdUI(reinterpret_cast<cframewnd*>(this), FALSE); // must cast
}

5. And finally the Handler entries

Message Map
ON_UPDATE_COMMAND_UI(ID_INDICATOR_CAPS, OnUpdateKeyIndicator)

Header
afx_msg void OnUpdateKeyIndicator(CCmdUI* pCmdUI);

Function
void CLittleBlackBookDlg::OnUpdateKeyIndicator(CCmdUI* pCmdUI)
{
UINT nVK;
UINT flag = 0x0001;

switch (pCmdUI->m_nID)
{
case ID_INDICATOR_CAPS:
nVK = VK_CAPITAL;
break;

case ID_INDICATOR_NUM:
nVK = VK_NUMLOCK;
break;

default:
TRACE1("Warning: OnUpdateKeyIndicator - unknown indicator 0x%04X.\n",
pCmdUI->m_nID);
pCmdUI->ContinueRouting();
return; // not for us
}

pCmdUI->Enable(::GetKeyState(nVK) & flag);
// enable static text based on toggled key state
ASSERT(pCmdUI->m_bEnableChanged);
}

Similarly if you want a toolar.



Happy programming!!
GeneralRe: Status Bar ... Pin
Hadi Rezaee4-Mar-01 18:08
Hadi Rezaee4-Mar-01 18:08 
GeneralRe: Status Bar ... Pin
l a u r e n3-Mar-01 20:36
l a u r e n3-Mar-01 20:36 
Generaland now a question... Pin
l a u r e n3-Mar-01 10:46
l a u r e n3-Mar-01 10:46 
GeneralRe: and now a question... Pin
Chris Losinger3-Mar-01 11:04
professionalChris Losinger3-Mar-01 11:04 
GeneralRe: and now a question... Pin
l a u r e n3-Mar-01 11:15
l a u r e n3-Mar-01 11:15 
GeneralRe: and now a question... Pin
Tim Deveaux3-Mar-01 11:53
Tim Deveaux3-Mar-01 11:53 
GeneralRe: and now a question... Pin
l a u r e n3-Mar-01 19:41
l a u r e n3-Mar-01 19:41 
GeneralRe: and now a question... Pin
Tim Deveaux4-Mar-01 1:59
Tim Deveaux4-Mar-01 1:59 
GeneralRe: and now a question... Pin
Erik Funkenbusch5-Mar-01 9:54
Erik Funkenbusch5-Mar-01 9:54 
GeneralRe: and now a question... Pin
Chris Losinger3-Mar-01 14:37
professionalChris Losinger3-Mar-01 14:37 
GeneralRe: and now a question... Pin
Joe Moldovan4-Mar-01 11:24
Joe Moldovan4-Mar-01 11:24 
Generalthanks guys... Pin
l a u r e n4-Mar-01 11:44
l a u r e n4-Mar-01 11:44 
GeneralRe: and now an answer... Pin
Julien4-Mar-01 12:19
Julien4-Mar-01 12:19 
GeneralFast busy Pin
Antonio3-Mar-01 3:56
Antonio3-Mar-01 3:56 
GeneralRe: Fast busy Pin
James R. Twine3-Mar-01 9:25
James R. Twine3-Mar-01 9:25 
GeneralActiveX Events Pin
3-Mar-01 3:47
suss3-Mar-01 3:47 
GeneralRe: ActiveX Events Pin
3-Mar-01 10:43
suss3-Mar-01 10:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.