you can get this thing work as you expect. But it is going to be very weird method to show progress. You have to create a separte thread to handle the message box closing stuffs. Because a message box is of a modal dialog. Once invoked, without closing you can not execute next line of code. So first you have to write a thread function. In that Write the code to get the message box window handle as below and then close it
UINT ThreadFun(LPVOID lpvParam)
{
Sleep( 4000 ); HWND hWnd = FindWindow( 0, "Initilization" );
Sleep( 4000 ); CloseWidnow( hWnd );
}
void ShowMsg()
{
:
AfxBeginThread( ThreadFun, 0 );
MessageBox(NULL,"Initilizing the Software","Initilization",MB_OK);
:
}
But this code will for sure crash unless you handle the synchronizantion effeciently.
Now coming to a real solution to your issue, better you use a modless dialog which shows the progress message
http://www.winprog.org/tutorial/modeless_dialogs.html[
^]
and send the message WM_CLOSE to this dialog after some time or once your s/w initialization is done