Click here to Skip to main content
Sign Up to vote bad
good
See more: C++
Helo,
 
So, a while ago i wrote a long program that it takes a little to open, that is, i open the program and only many seconds later it appear on my screen, sometimes i even open 2 or 3 accidentally.
 
My program was written in C++ using visual studio forms and has many external images built in the exe.
 
How can i make like a loading screen so i know that the program was started but is loading?
 
Do i have to export image and my larger pieces of code to external resources like dll and then in the exe load those resources?
 
Cumpz,
Posted 24 Jun '12 - 9:55
Cr4zYPT406

Comments
chandanadhikari - 26 Jun '12 - 11:29
you can try implementing proxy pattern not exactly a solution but this will not only help in solving this problem but might also better your coding style look here :http://advancedcppwithexamples.blogspot.in/2010/10/c-example-of-proxy-design-pattern.html

4 solutions

The term for this is a Splash Screen. There are several articles about those here on CodeProject.
 
Here is an excellent C++/MFC class: CSplashScreenEx : a non rectangular splash screen class with Alpha blending[^]
 
Soren Madsen
  Permalink  
Comments
Vitaly Tomilov - 24 Jun '12 - 17:09
Doh! Posted at the same time :) Good, +5 ;)
Sergey Alexandrovich Kryukov - 24 Jun '12 - 21:48
Right, a 5. --SA
SoMad - 25 Jun '12 - 17:19
Thanks Sergey.
Your question is confusing as to which platform you used when writing your code. First, you say it is C++, and then you refer to forms in C++, which implies managed C++. The answer would depend very much on whether or not it is the managed platform.
 
Anyway, the best answer that would be universal here is this: just search for Splash Screen articles on CP. There are plenty of them, covering every platform that exists, including MFC (that's what I suspect you meant).
 
I would provide a list of links here, but it would be just a very long list, given the platform uncertainty.
  Permalink  
Comments
SoMad - 24 Jun '12 - 17:13
I agree, +5. Soren Madsen
Sergey Alexandrovich Kryukov - 24 Jun '12 - 21:48
Agree, a 5. --SA
By visual studio forms I assume that you have created a Windows Forms application using C++/CLI.
 
Before trying anything else I would try the Native Image Generator (Ngen.exe)[^] - if you are really lucky this will be good enough.
 
Here is an article, A Pretty Good Splash Screen in C#[^], by Tom Clement - that shows how to create a splash screen for Windows Forms applications. It's c#, but it shows one way to create a splash screen.
 
To actually solve your problem, you need to create elements as needed, implementing some sort of lazy initialization for those parts that can be created after your program has started. The real performance hit occurs when the controls using your "large" resources are initialized.
 
Best regards
Espen Harlinn
  Permalink  
Comments
Sergey Alexandrovich Kryukov - 24 Jun '12 - 21:48
Good reply, a 5. --SA
Espen Harlinn - 25 Jun '12 - 3:25
Thank you, Sergey :-)
The use of a splash screen helps the user to know that the program is in the process of starting. However, it does not absolutely prevent the user from starting multiple instances of the same application. If you want to avoid opening multiple instances of an application, read this article: Avoiding Multiple Instances of an Application[^].
  Permalink  
Comments
SoMad - 26 Jun '12 - 20:44
I think this is a valid point. The OP does not say if he wants to be able to launch another instance later on. If he does want to limit the application to one instance, this is a good article to read. Soren Madsen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 318
1 Sergey Alexandrovich Kryukov 143
2 Mohammed Hameed 123
3 Santhosh G_ 108
4 Lohith Korupolu 85
0 Sergey Alexandrovich Kryukov 8,266
1 OriginalGriff 6,306
2 CPallini 3,528
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid