MSI Factory 2.3

Window.EnumerateProcesses

Window.EnumerateProcesses

This is the first topic This is the last topic  

Window.EnumerateProcesses

This is the first topic This is the last topic  

OverviewExamples

table Window.EnumerateProcesses (

boolean TopLevel = true )

Example 1

open_processes = Window.EnumerateProcesses();

Gets the window handles and executable file paths for every process that is currently running and stores them in a table named open_processes.

Example 2

instances_of_file = 0;

file_to_check_for = "setup.exe"; --have all lowercase

processes = Window.EnumerateProcesses();

 

for j, file_path in processes do

   file = String.SplitPath(file_path);

   if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then

       instances_of_file = instances_of_file + 1;

   end

end

 

if instances_of_file > 1 then

   Window.Hide(app_handle);

   Dialog.Message("Error", "Setup already running: code: already running");

   Window.Close(app_handle, CLOSEWND_TERMINATE);

else

   Window.Show(app_handle);

end

As an example, let us assume that you want to run your program, only if there is not another setup.exe running on the system. To accomplish this, use the Window.EnumerateProcesses action, and check every process against the filename setup.exe.

See also: Related Actions


Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us