我想在主程序前先显示一个图片,即运行程序时先显示一个bmp图象再进入主程序
请问我该怎能么办?

解决方案 »

  1.   

    project -> add to project->components and controls
      

  2.   

    创建一个图片的模态对话框类CDlgSplash,里面有你想要的bmp
    然后在你的程序的InitInstance()函数里

    CDlgSplash splash;
    splash.Create(IDD_DLG_SPLASH, NULL);
    CTime timeStart = CTime::GetCurrentTime()
    ..这里你可以对对话框的其它内容如标题,时间进行设置到时间后,关掉对话框就可以了
    CTime timeCurrent = CTime:: GetCurrentTime();
    CTimeSpan timeSpan =  timeCurrent-timeStart;
    for ( ;;){

    timeCurrent = CTime:: GetCurrentTime();
    timeSpan =  timeCurrent-timeStart; if (timeSpan.GetTotalSeconds() >= 2) break;
    }
    splash.DestroyWindow();...