|
-
May 26th, 1999, 01:51 AM
#1
How do I change Title bar text
I want to know how to replace the titlebar text in my SDI to something useful.
I've tried these:
CWnd::GetWindowText();
CWnd::SetWindowText();
But no luck, if I set nothing changes, and if I get after I set, the new value is returned by GetWindowText().
And if I get before calling SetWindowText(), I get garbage instead of the "Untitled - MyApp" I thought I would get, since that is what I am seeing in the title bar.
What do I do now?
PS: I call these functions in my View (CListView) class, after construction of the view.
And also, I want to know how to flicker the titlebar on a given event, when it is minimized.
Thanks in advance
Cheers
Rossi.
==============================================
Allen Van Der Ross
Systems Programmer
Software Performance Improvement
South Africa
E-Mail: [email protected]
==============================================
-
May 26th, 1999, 02:10 AM
#2
Re: How do I change Title bar text
You can use CDocument::GetTitle and CDocument::SetTitle in OnInitialUpdate() of your View. For Example
CMyAppDoc* pDoc = GetDocument();
pDoc->SetTitle("Changing title");
This will change the "Untitled" to "Changing title".
Hope this helps you.
-
May 26th, 1999, 03:51 AM
#3
Re: How do I change Title bar text (flashing the title bar)
Here's how I have flashed the title bar before :
You need to declare
int m_TimerID ;
bool m_bFlashTitle ; (init to false)
void CMainFrame::StartFlashingTitleBar()
{
// only start to flash if not active
if (m_TimerID == 0 && !m_bActive)
{
m_TimerID = SetTimer(2, ::GetCaretBlinkTime(), MainWndTimerProc) ;
m_bFlashTitle = true ;
}
}
void CALLBACK EXPORT MainWndTimerProc(
HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent, // timer identification
DWORD dwTime
)
{
((CMainFrame*)(AfxGetMainWnd()))->FlashWindowNow() ;
dwTime = 0 ;
nIDEvent = 0 ;
nMsg = 0 ;
hWnd = 0 ;
}
void CMainFrame::FlashWindowNow()
{
static bool bFlash = true ;
FlashWindow(bFlash) ;
bFlash = !bFlash ;
}
void CMainFrame::OnActivateApp(BOOL bActive, HTASK hTask)
{
CMDIFrameWnd::OnActivateApp(bActive, hTask);
if (!bActive)
{
// the application has been deactivated
m_bActive = false ;
}
else
{
m_bActive = true ;
// if we are flashing, stop it
if (m_bFlashTitle)
{
KillTimer(m_TimerID) ;
m_TimerID = 0 ;
}
m_bFlashTitle = false ;
}
}
I hope this helps
Roger Allen
Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
Please remember to rate useful answers. It lets us know when a question has been answered.
-
May 26th, 1999, 03:52 AM
#4
Re: How do I change Title bar text
The title bar of your SDI is the frame window, not the view. Try AfxGetMainWnd()->SetWindowText("MyNewTitle")
MJA
-
June 1st, 1999, 04:58 AM
#5
Re: How do I change Title bar text
Add the following line of code in your Application class, (in your case List.cpp? )
ccode
BOOL CListApp::InitInstance()
{
--
--
m_pMainWnd->SetWindowText("Name of Application");
return TRUE;
}
/ccode
let me know, if it works
--SatyaReddy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|