The ability to show a splash screen or some other kind of user feedback when the MCR is loading is not available in MATLAB Compiler.
To work around this issue, there are two options:
A. MessageBox:
1. You will have to compile your stand-alone without the deploytool, for example as follows:
mcc -m -v -C -e hello.m
The options:
-m: Generate en executable (.exe)
-v: Verbose output.
-C: Create separate CTF file (necessary since R2008a embeds the CTF file in the exe).
-e: Suppress DOS window (Windows Standalone Application mode).
For more details check the documentation: doc mcc
2. When the compilation is done, look at the verbose output and try to find and entry that looks like this:
Executing command: mbuild -O -v -output "hello" "hello_main.c" "hello_mcc_component_data.c" -link exe
This is mbuild Copyright 1984-2006 MathWorks, Inc.
You will need this mbuild command to recompile the stand-alone after making changes to the C file.
3. Open the main C file with a text editor, in this case it would be "hello_main.c".
4. Look for the main function, which should be at the bottom of the file, and add a call to MessageBox just before mclInitializeApplication, which initializes the MCR. In this case it should look like this:
----------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
#else
int main(int argc, const char **argv)
#endif
{
MessageBox(NULL, "Starting application, please click OK to continue...", "My Standalone", MB_OK);
if (!mclInitializeApplication(
__MCC_hello_component_data.runtime_options,
__MCC_hello_component_data.runtime_option_count))
return 0;
return mclRunMain(run_main, argc, argv);
}
----------------------------------------
5. Save the file and recompile it by using the mbuild command from step 2.:
mbuild -O -v -output "hello" "hello_main.c" "hello_mcc_component_data.c" -link exe
6. To deploy your application, you will need to always distribute the .exe file and the .ctf file. This is the way it was done before R2008a.
7. The MessageBox creates a "modal" dialog window, this means that the execution will not proceed until you click away the box. That's why you need to explain this to your user. Creating a splash screen or graphical output is fairly complex when working in plain C for Windows. You might be able to find an example on the Internet to help you with this. Details about all the options available for the MessageBox can be found here:
B. Visual Basic (or similar) Wrapper: You can create an executable for example using Visual Basic. The VB program could show a splash screen or message and run your stand-alone in the background, and after a few seconds it could just exit leaving the MATLAB stand-alone running. You could setup your project as follows:
C:\Test\Main\MATLABStandalone.exe
C:\Test\StartProgram.exe
In this setup, the program StartProgram.exe would look for an executable of a certain name under the "Main" folder and run it.
Best Answer