pierre
04-20-2004, 01:34 AM
Hi all:
I have some codes as below:
--It uses Windows Media Player to open a file that the name is 12-128k_wma.wma
File.Run("AutoPlay\\Docs\\wmplayer.exe", "D:\\design-MM\\AUDIO\\source\\12\\wma\\12-128k_wma.wma", "", SW_SHOWNORMAL, false);
--Makes the application sleep for 343000 second
Application.Sleep (343000);
--Finds all open windows with the string "Windows Media Player" in the title and sends each of them a close message.
windows = Window.EnumerateTitles();
window_name = "Windows Media Player";
for handle, title in windows do
result = String.Find(title, window_name, 1, false);
if (result ~= -1) then
Window.Close(handle, CLOSEWND_TERMINATE);
end
end
At this time problem is appeared. If I uses upon codes, I must wait 343000 seconds to end, then I can use or open the application again. If I interrupt the application by manual during 34300 seconds, it has not responding. It must wait 343000 seconds to end that it can use again.
I wish When the application be opened by user, it can interrupt immediatly without waiting 343000 seconds to end. If I can't interrupt the application, it can go on working include 343000 seconds of waiting.
How can I do that it reach my demand? Who can teach me or give me an example? Thank you for advance!
About Application.Sleep command:
Can it other parameters or commands use together?
If it can do it, who has it examples for me?
I have some codes as below:
--It uses Windows Media Player to open a file that the name is 12-128k_wma.wma
File.Run("AutoPlay\\Docs\\wmplayer.exe", "D:\\design-MM\\AUDIO\\source\\12\\wma\\12-128k_wma.wma", "", SW_SHOWNORMAL, false);
--Makes the application sleep for 343000 second
Application.Sleep (343000);
--Finds all open windows with the string "Windows Media Player" in the title and sends each of them a close message.
windows = Window.EnumerateTitles();
window_name = "Windows Media Player";
for handle, title in windows do
result = String.Find(title, window_name, 1, false);
if (result ~= -1) then
Window.Close(handle, CLOSEWND_TERMINATE);
end
end
At this time problem is appeared. If I uses upon codes, I must wait 343000 seconds to end, then I can use or open the application again. If I interrupt the application by manual during 34300 seconds, it has not responding. It must wait 343000 seconds to end that it can use again.
I wish When the application be opened by user, it can interrupt immediatly without waiting 343000 seconds to end. If I can't interrupt the application, it can go on working include 343000 seconds of waiting.
How can I do that it reach my demand? Who can teach me or give me an example? Thank you for advance!
About Application.Sleep command:
Can it other parameters or commands use together?
If it can do it, who has it examples for me?