Click here to Skip to main content
15,890,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questiontransparent text background on a tab control? Pin
jeremysay26-May-03 23:05
jeremysay26-May-03 23:05 
Generaladd DIALOGBAR Pin
aguest26-May-03 22:36
aguest26-May-03 22:36 
GeneralRe: How can i create a Barcode 128 in MFC?? Pin
Rage26-May-03 22:52
professionalRage26-May-03 22:52 
GeneralRe: How can i create a Barcode 128 in MFC?? Pin
Rage26-May-03 23:37
professionalRage26-May-03 23:37 
GeneralRe: How can i create a Barcode 128 in MFC?? Pin
John M. Drescher27-May-03 11:00
John M. Drescher27-May-03 11:00 
GeneralMFC Pin
frackasse26-May-03 21:52
frackasse26-May-03 21:52 
GeneralRe: MFC Pin
Rage26-May-03 22:10
professionalRage26-May-03 22:10 
Generalsubclass static control without losing its parent attribute Pin
yccheok26-May-03 21:23
yccheok26-May-03 21:23 
i try to subclass a static control using the following method. i add extra attribute to the static control (once i click on it, a msgbox pop up). however, after i subclass it, i found that although it has the new attribute, but it loses its parent attribute.

-----------------------------------------------------------------------
// CxStatic is extended frm CStatic
BOOL Cxstatic::CreateFromStatic (CWnd* pwndParent, UINT wID)
{
BOOL bSuccess = FALSE;
CWnd* pwndStatic = pwndParent->GetDlgItem (wID);

if (pwndStatic != (CWnd*) 0)
{
DWORD dwStyle = pwndStatic->GetStyle();
CString strText;
CRect rectStatic;

// Get the window text
pwndStatic->GetWindowText (strText);
MessageBox(strText);

// Get the window position and convert from screen -> client
pwndStatic->GetWindowRect (rectStatic);
pwndParent->ScreenToClient(rectStatic);


pwndStatic->DestroyWindow();

bSuccess = CWnd::Create (NULL,
strText,
dwStyle,
rectStatic,
pwndParent,
wID,
NULL);
}

return (bSuccess);
}

void Cxstatic::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
MessageBox("MFC Rules");
CStatic::OnLButtonDown(nFlags, point);
}
-----------------------------------------------------------------------
BOOL CXxxDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
// m_wndClockSmall is Cxstatic
m_wndClockSmall.CreateFromStatic(this, IDC_STATIC);
}

void CXxxDlg::OnButton1()
{
// TODO: Add your control notification handler code here
m_wndClockSmall.SetWindowText ("JAVA Rules");
}
------------------------------------------------------------------------

the following code will coz:when i click on the static control on the dialog, a msgbox pop up. however, when i click on the button1, the text just wont shown up Frown | :(

how can i solve this problem to make the extended static control remain its parent attribute?

thank you.

regards
yccheok
QuestionChange the date of a directory on Win95/98 ? Pin
Piccinano26-May-03 20:15
Piccinano26-May-03 20:15 
AnswerRe: Change the date of a directory on Win95/98 ? Pin
Chris Meech27-May-03 2:32
Chris Meech27-May-03 2:32 
GeneralHiding a pane of a Splitter Window Pin
Anonymous26-May-03 19:25
Anonymous26-May-03 19:25 
GeneralRe: Hiding a pane of a Splitter Window Pin
Rage26-May-03 22:49
professionalRage26-May-03 22:49 
GeneralCancel Button in PropertySheet Pin
Sorak26-May-03 19:05
Sorak26-May-03 19:05 
GeneralRe: Cancel Button in PropertySheet Pin
Sorak26-May-03 19:22
Sorak26-May-03 19:22 
GeneralRe: Cancel Button in PropertySheet Pin
Michael Dunn26-May-03 19:23
sitebuilderMichael Dunn26-May-03 19:23 
GeneralRe: Cancel Button in PropertySheet Pin
Sorak27-May-03 5:19
Sorak27-May-03 5:19 
QuestionGraphical representation of Drives ??? Pin
rohit.dhamija26-May-03 18:17
rohit.dhamija26-May-03 18:17 
AnswerRe: Graphical representation of Drives ??? Pin
Michael Dunn26-May-03 18:37
sitebuilderMichael Dunn26-May-03 18:37 
QuestionCHtmlView::OnNewWindow2 : Which one is correct? Pin
YuHao26-May-03 15:51
YuHao26-May-03 15:51 
AnswerRe: CHtmlView::OnNewWindow2 : Which one is correct? Pin
Michael Dunn26-May-03 16:54
sitebuilderMichael Dunn26-May-03 16:54 
GeneralRe: CHtmlView::OnNewWindow2 : Which one is correct? Pin
YuHao26-May-03 17:41
YuHao26-May-03 17:41 
GeneralRe: CHtmlView::OnNewWindow2 : Which one is correct? Pin
Michael Dunn26-May-03 17:52
sitebuilderMichael Dunn26-May-03 17:52 
GeneralInfinite Linking ( This time, i logged on before ) Pin
Somaa26-May-03 14:13
Somaa26-May-03 14:13 
GeneralRe: Infinite Linking ( This time, i logged on before ) Pin
John R. Shaw26-May-03 17:09
John R. Shaw26-May-03 17:09 
GeneralInfinite Linking fights back Pin
Somaa26-May-03 18:26
Somaa26-May-03 18:26 

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.