Added the code to launch another process

This commit is contained in:
Alekhya Reddy Kommuru
2020-03-16 07:38:12 -07:00
parent c4b49ce6cd
commit 078656fb8b

View File

@@ -206,14 +206,29 @@ public:
} }
} }
// Enable the powertoy // Enable the powertoy
virtual void enable() { virtual void enable()
m_enabled = true; {
SHELLEXECUTEINFO sei{ sizeof(sei) };
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
sei.lpFile = L"modules\\launcher\\Wox.exe";
sei.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sei);
m_hProcess = sei.hProcess;
m_enabled = true;
} }
// Disable the powertoy // Disable the powertoy
virtual void disable() { virtual void disable()
m_enabled = false; {
if (m_enabled)
{
TerminateProcess(m_hProcess, 1);
}
m_enabled = false;
} }
// Returns if the powertoys is enabled // Returns if the powertoys is enabled