Click here to Skip to main content
15,902,275 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to let user choose a directory? Pin
basementman25-Jun-03 4:32
basementman25-Jun-03 4:32 
QuestionHow to insert a row in FlexGrid? Pin
Radha Nair24-Jun-03 22:57
Radha Nair24-Jun-03 22:57 
AnswerRe: How to insert a row in FlexGrid? Pin
Toni7825-Jun-03 0:08
Toni7825-Jun-03 0:08 
GeneralUsing printer device Pin
Ahmed Galal24-Jun-03 22:54
Ahmed Galal24-Jun-03 22:54 
Questionstl set bug ? Pin
Brian van der Beek24-Jun-03 21:35
Brian van der Beek24-Jun-03 21:35 
AnswerRe: stl set bug ? Pin
ankea17-Nov-15 0:16
ankea17-Nov-15 0:16 
Generalvb constants in vc Pin
mooze24-Jun-03 21:15
mooze24-Jun-03 21:15 
GeneralRace conditions Pin
Toni7824-Jun-03 20:35
Toni7824-Jun-03 20:35 
Two days ago I had to send out an application. At the very last minute I was asked if I could add a splash screen to it and stupid me said yes. I had never done that before in my life. I tried to add a splash screen through Components and Controls but that works only for MDI or SDI. My application is dialog based. With only 20 minutes left (I couldn't go online and search codeproject) I decided to add my own splash screen. So inside OnInitDialog I have something like this:
CSplashDlg aSplashDlg( this );
aSplashDlg.DoModal()

Not being able to send a close message to CSplashDlg I just added a thread to CSplashDlg (a CDialog based class).
UINT SplashDelayThread( LPVOID pParam )
{
	Sleep( 5000 );
	::PostMessage( (HWND)pParam, WM_CLOSE, 0, 0 );
	return 0;
}

int CSplashWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	AfxBeginThread( SplashDelayThread, this->m_hWnd,
                        THREAD_PRIORITY_NORMAL );

	return 0;
}

Now I am afraid that this might cause race conditions. For example what if the thread is activated and then it returns before the Splash dialog is created. 5 seconds is a long time but should I be worried? I mean you never know.

// Afterall, I realized that even my comment lines have bugs
GeneralCOM DLL registration problem Pin
vikramj24-Jun-03 20:15
vikramj24-Jun-03 20:15 
GeneralRe: COM DLL registration problem Pin
Kannan Kalyanaraman24-Jun-03 20:49
Kannan Kalyanaraman24-Jun-03 20:49 
QuestionHow to check who is currently logged on (Win2K/XP) Pin
Hashim Saleem24-Jun-03 19:52
Hashim Saleem24-Jun-03 19:52 
AnswerRe: How to check who is currently logged on (Win2K/XP) Pin
Ryan Binns24-Jun-03 20:04
Ryan Binns24-Jun-03 20:04 
Questionhow to free library by dll self Pin
gucy24-Jun-03 17:52
gucy24-Jun-03 17:52 
AnswerRe: how to free library by dll self Pin
David Crow25-Jun-03 3:09
David Crow25-Jun-03 3:09 
QuestionApplication that handles 200 000+ Lines? Pin
Steve The Plant24-Jun-03 16:01
Steve The Plant24-Jun-03 16:01 
AnswerRe: Application that handles 200 000+ Lines? Pin
J. Dunlap24-Jun-03 16:14
J. Dunlap24-Jun-03 16:14 
GeneralRe: Application that handles 200 000+ Lines? Pin
Steve The Plant24-Jun-03 16:21
Steve The Plant24-Jun-03 16:21 
GeneralRe: Application that handles 200 000+ Lines? Pin
David Crow25-Jun-03 3:14
David Crow25-Jun-03 3:14 
AnswerRe: Application that handles 200 000+ Lines? Pin
Steve The Plant24-Jun-03 17:17
Steve The Plant24-Jun-03 17:17 
GeneralRe: Application that handles 200 000+ Lines? Pin
basementman25-Jun-03 5:11
basementman25-Jun-03 5:11 
QuestionDrawing without flicker? Pin
Aidman24-Jun-03 15:25
Aidman24-Jun-03 15:25 
AnswerRe: Drawing without flicker? Pin
John M. Drescher24-Jun-03 15:45
John M. Drescher24-Jun-03 15:45 
AnswerRe: Drawing without flicker? Pin
Dave Bryant24-Jun-03 15:46
Dave Bryant24-Jun-03 15:46 
GeneralRe: Drawing without flicker? Pin
Aidman24-Jun-03 15:51
Aidman24-Jun-03 15:51 
GeneralRe: Drawing without flicker? Pin
John M. Drescher24-Jun-03 15:54
John M. Drescher24-Jun-03 15:54 

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.