{"id":558,"date":"2011-01-06T20:44:49","date_gmt":"2011-01-06T20:44:49","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=558"},"modified":"2022-02-17T06:24:04","modified_gmt":"2022-02-17T06:24:04","slug":"start-a-new-process-in-another-thread","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/threads\/start-a-new-process-in-another-thread","title":{"rendered":"Start a new process in another thread"},"content":{"rendered":"<h4>\nGood Resources<br \/>\n<\/h4>\n<p>\n<a href=\"http:\/\/www.csharp-examples.net\/create-asynchronous-method\/\">http:\/\/www.csharp-examples.net\/create-asynchronous-method\/<\/a>\n<\/p>\n<h4>\nNew process must be in a separate class<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nusing namespace System::Threading;\r\n<\/code><\/pre>\n<p>\n(you can just create a new named class before the class you are currently in when working in a form etc)\n<\/p>\n<pre>\r\n<code>\r\n\tpublic ref class InstallerUpdaterClass\r\n\t{\r\n\t\tpublic: static void UpdaterStartSilent(void)\r\n\t\t{\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\t\/\/Pause before starting\r\n\t\t\t\tThread::Sleep(10000);\t\t\/\/mS\r\n\r\n\t\t\t\tString ^UpdaterFilename;\r\n\t\t\t\tUpdaterFilename = Path::GetDirectoryName(Application::ExecutablePath);\r\n\t\t\t\tUpdaterFilename += &quot;\\\\&quot; + INSTALLER_UPDATER_FILENAME;\r\n\r\n\t\t\t\tProcess ^UpdaterProcess = Process::Start(UpdaterFilename, &quot;\/silent&quot;);\r\n\t\t\t\tUpdaterProcess-&gt;Close();\r\n\t\t\t}\r\n\t\t\tcatch (Exception ^)\r\n\t\t\t{\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n<\/code><\/pre>\n<h4>\nStart the process in a seperate thread to the current thread<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n\tThreadStart ^threadDelegate = gcnew ThreadStart(&amp;InstallerUpdaterClass::UpdaterStartSilent);\r\n\tThread ^newThread = gcnew Thread(threadDelegate);\r\n\tnewThread-&gt;Start();<font face=\"Century Gothic, Arial, Helvetica, sans-serif\"><span style=\"font-size: 6px; white-space: normal;\">\r\n<\/span><\/font><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Good Resources http:\/\/www.csharp-examples.net\/create-asynchronous-method\/ New process must be in a separate class using namespace System::Threading; (you can just create a new named class before the class you are currently in when working in a form etc) public ref class InstallerUpdaterClass { public: static void UpdaterStartSilent(void) { try { \/\/Pause before starting Thread::Sleep(10000); \/\/mS String ^UpdaterFilename; UpdaterFilename [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-558","post","type-post","status-publish","format-standard","hentry","category-threads"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=558"}],"version-history":[{"count":4,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/558\/revisions"}],"predecessor-version":[{"id":1155,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/558\/revisions\/1155"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}