Launch deployed application with winopen
8 views (last 30 days)
Show older comments
Hi, I'm trying to launch an executable (application compiled with AppDesigner) from another deployed application (application compiled with AppDesigner) using the winopen function.
I get the error: Error in validating CTF manifest file.
Is there a solution?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1657191/image.png)
3 Comments
Answers (1)
chrisw23
on 2 Apr 2024
...
function callConsoleApplicationAsync(obj,appWorkingPath,appFileNameWithArguments)
arguments
obj
appWorkingPath
appFileNameWithArguments
end
import System.IO.*
asyncSysProc = System.Diagnostics.Process();
asyncSysProc.EnableRaisingEvents = true;
try
liEmptyProc = addlistener(asyncSysProc,'Exited',@obj.consoleProcessFinished_Callback);
catch ex
disp("Error@callConsoleApplicationAsync save listener handle " + string(ex.message))
end
try
asyncSysProc.StartInfo.CreateNoWindow = true; % true = no cmd windows pops up
asyncSysProc.StartInfo.UseShellExecute = false; % false to enable redirection
asyncSysProc.StartInfo.WorkingDirectory = appWorkingPath;
asyncSysProc.StartInfo.FileName = "cmd.exe"; % use cmd.exe to call any app
asyncSysProc.StartInfo.Arguments = "/c " + appFileNameWithArguments; % add arguments here
asyncSysProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
asyncSysProc.Start();
notify(obj,"ConsoleProcessStartedAsync", WinNetIO.NotifyDiagArgs(string(asyncSysProc.StartInfo.Arguments)))
obj.liAsyncCmd.("P" + string(asyncSysProc.Id)) = liEmptyProc; % id available after start
catch ex
disp(ex.message)
end
end
...
Just copied a function from one of my classes to show how to call any executable asynchronous. This will not block your calling app. If you don't want to use events skip lines for listeners and notification. Be aware of missing class frame for this code snippet.
3 Comments
chrisw23
on 8 Apr 2024
Edited: chrisw23
on 8 Apr 2024
Sry for the late response. Its rigth the code snippet should be used to create a simple function as you did. This is a fire and forget call and you can call anything from the console. You could call explorer.exe instead of the Matlab executable to debug this part of your code. As you have two AppDesigner apps both are to be compiled and app1.exe needs the path to app2.exe . In the AdditionalSettings section of the AppCompiler you should enable the console output to write debug info via disp cmd for better understanding what happens when.
Check also that the Matlab Runtime version installed matches the compiler version. Another option ist to start the appdesigner app as Administrator to check if this is an priviliges error.
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!