Click here to Skip to main content
15,887,302 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can DirectShow play Mp3 stream? Pin
Cyrus Dang9-Jun-06 4:13
Cyrus Dang9-Jun-06 4:13 
QuestionWant to plot some points on something from within a dll Pin
ns8-Jun-06 10:56
ns8-Jun-06 10:56 
QuestionHow to know when Dialog is open Pin
sschilachi8-Jun-06 10:53
sschilachi8-Jun-06 10:53 
AnswerRe: How to know when Dialog is open Pin
Michael Dunn8-Jun-06 10:59
sitebuilderMichael Dunn8-Jun-06 10:59 
QuestionRe: How to know when Dialog is open [modified] Pin
sschilachi8-Jun-06 11:18
sschilachi8-Jun-06 11:18 
AnswerRe: How to know when Dialog is open [modified] Pin
Roger Stoltz8-Jun-06 13:02
Roger Stoltz8-Jun-06 13:02 
QuestionRe: How to know when Dialog is open [modified] Pin
sschilachi8-Jun-06 23:14
sschilachi8-Jun-06 23:14 
AnswerRe: How to know when Dialog is open [modified] Pin
Roger Stoltz9-Jun-06 2:05
Roger Stoltz9-Jun-06 2:05 
What both I and Michael Dunn suggested is a common technique used when something has to be done when all dialog controls has been created and initialized. I thought this was your problem since it's quite common.

The last message handled when a dialog is created is usually WM_PAINT. Both WM_SIZE and WM_SHOWWINDOW are sent prior to WM_PAINT.
If it's imperative that your dialog is visible to the user there is no message handler you can override. You have to write code inside the message handler for WM_PAINT, OnPaint().
Like this:
void CShowDlg::OnPaint() 
{
    static BOOL bShown = FALSE;
    if (IsIconic())
    {
        CPaintDC dc(this); // device context for painting

        SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

        // Center icon in client rectangle
        int cxIcon = GetSystemMetrics(SM_CXICON);
        int cyIcon = GetSystemMetrics(SM_CYICON);
        CRect rect;
        GetClientRect(&rect);
        int x = (rect.Width() - cxIcon + 1) / 2;
        int y = (rect.Height() - cyIcon + 1) / 2;

        // Draw the icon
        dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
        CDialog::OnPaint();
    }
    if( !bShown )
    {
        // Write code here or post your message
        bShown = TRUE;
    }
}


Sorry that I misunderstood your needs. :->
I just haven't encountered a initialization situation yet that actually requires the dialog to be visible and I can't figure out why this would be necessary. It's not necessarily wrong, I'm just curious.

--
Roger


It's supposed to be hard, otherwise anybody could do it!

Regarding CodeProject: "resistance is pointless; you will be assimilated"

QuestionRe: How to know when Dialog is open Pin
sschilachi9-Jun-06 14:00
sschilachi9-Jun-06 14:00 
AnswerRe: How to know when Dialog is open Pin
valikac8-Jun-06 11:02
valikac8-Jun-06 11:02 
QuestionRe: How to know when Dialog is open [modified] Pin
sschilachi8-Jun-06 11:20
sschilachi8-Jun-06 11:20 
AnswerRe: How to know when Dialog is open [modified] Pin
valikac8-Jun-06 11:35
valikac8-Jun-06 11:35 
AnswerRe: How to know when Dialog is open Pin
ThatsAlok8-Jun-06 19:36
ThatsAlok8-Jun-06 19:36 
Question2D array Pin
ramamaru8-Jun-06 9:54
ramamaru8-Jun-06 9:54 
QuestionRe: 2D array Pin
David Crow8-Jun-06 10:25
David Crow8-Jun-06 10:25 
AnswerRe: 2D array Pin
Velmont8-Jun-06 14:26
Velmont8-Jun-06 14:26 
AnswerRe: 2D array Pin
ThatsAlok8-Jun-06 19:38
ThatsAlok8-Jun-06 19:38 
GeneralRe: 2D array Pin
ramamaru9-Jun-06 4:02
ramamaru9-Jun-06 4:02 
GeneralRe: 2D array Pin
Sebastian Pipping10-Jun-06 18:10
Sebastian Pipping10-Jun-06 18:10 
Questionm_pCtrlSite Pin
hmklakmal8-Jun-06 9:09
hmklakmal8-Jun-06 9:09 
AnswerRe: m_pCtrlSite Pin
David Crow8-Jun-06 9:40
David Crow8-Jun-06 9:40 
AnswerRe: m_pCtrlSite Pin
ThatsAlok8-Jun-06 19:39
ThatsAlok8-Jun-06 19:39 
GeneralRe: m_pCtrlSite [modified] Pin
hmklakmal9-Jun-06 11:49
hmklakmal9-Jun-06 11:49 
QuestionWin32 and HTML Pin
adiilah8-Jun-06 7:38
adiilah8-Jun-06 7:38 
AnswerRe: Win32 and HTML Pin
Chris Meech8-Jun-06 7:46
Chris Meech8-Jun-06 7:46 

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.