View Full Version : Deny execution of a program
EndlessLay
08-16-2007, 06:20 PM
Hello IndigoRose Community,
I am new to this forums and i have to admit that this software really amazed me.
Since i am not really familiar with it yet i would like you to lend a hand on my question if its possible of course.
What i want to do is to deny the execution of a program when some other programs are running.
For example i don't want my program to be started when on the task manager's Processes there are some names of programs which i defined.
Actually i can't really know even if this is possible but any information on this would be great.
Thanks guys.
bobbie
08-16-2007, 06:37 PM
have a look in the help file.
Check if a Particular Program is Running
As an example, let us assume that you want to run your program (autorun.exe) only if
there is not another autorun.exe running on the system. To accomplish this, use the
Window.EnumerateProcesses action and check every process against the filename
autorun.exe.
Insert the following code into the On Show event of your page:
-- Initialize variables
instances_of_file = 0;
file_to_check_for = "autorun.exe"; --have all lowercase
processes = Window.EnumerateProcesses();
-- Step through process table
for j, file_path in processes do
-- Split path to get filename
file = String.SplitPath(file_path);
-- compare filename to the file specified in variable initialization
if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
-- The process matches, increment count by 1.
instances_of_file = instances_of_file + 1;
end
end
-- Check if at least one file matched
if instances_of_file > 0 then
-- There was at least one match, hide this application window, display error, and
close.
Window.Hide(Application.GetWndHandle());
Dialog.Message("Error", "Another instance of Autorun.exe is already open.");
Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE);
end
Page
EndlessLay
08-16-2007, 06:54 PM
oh, how bad of me.
Thats the first thing I should do, but i couldn't imagine that it would be on Windows Actions.
But what i asked is if we can prevent even the first execution not the second, i tried adding another name other than autorun.exe but my program started with no errors.
Anyway thanks for the info
EDIT: Sorry again, i just had to chage "if instances_of_file then" and the remove the > 1
bobbie
08-16-2007, 07:05 PM
Thats ok, i do the same thing sometimes.
This for FPSC?
EndlessLay
08-16-2007, 07:25 PM
Hello again,
Actually now i noticed something else.
My Application won't start ONLY when the defined app is shown on "Applications" tab , but when its shown on "Processes" tab my program runs normally
A lot of programs after minimizing them to try aren't shown on "Applications" tab, so is there any way to make it ready from Processes tab as well?
Ps.No actually is for a game loader,where i want the game not to be started when some illegal software programs are running.
EndlessLay
08-16-2007, 08:52 PM
Sorry for doubleposting, but for one more time i found out how to fix.
Actually it was an issue with the TopLevel == false that i forgot to add.
Now its tested and works ok.
Thanks again.
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.