MSI Factory 2.3

Window.Close

Window.Close

This is the first topic This is the last topic  

Window.Close

This is the first topic This is the last topic  

OverviewExamples

Window.Close (

number WndHandle,

number Method = CLOSEWND_SENDMESSAGE )

Example 1

Window.Close(app_handle, CLOSEWND_SENDMESSAGE);

Sends a close message to the program whose window handle is stored in the variable "app_handle."

Example 2

Window.Close(app_handle, CLOSEWND_TERMINATE);

Terminates the process of the program whose window handle is stored in the variable "app_handle."

Example 3

-- Get the titles and window handles of all open windows.

windows = Window.EnumerateTitles();

 

-- A variable containing text in the title you want to search for.

window_name = "Notepad";

 

-- Loop through the table of windows.

for handle, title in windows do

 

   -- Check if the window title has the target text.

   result = String.Find(title, window_name, 1, false);

 

   -- if the string was found in the title, send the window a close message.

   if (result ~= -1) then

       Window.Close(handle, CLOSEWND_SENDMESSAGE);

   end

end

Finds all open windows with the string "Notepad" in the title and sends each of them a close message.

See also: Related Actions


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