Forum » Operacijski sistemi » Kako zagnati program v želeni prioriteti?
Kako zagnati program v želeni prioriteti?
tha_man ::
Imam en program, ki se po defaultu zažene na high priority. Problem je v tem, da v bistvu veliko bolje deluje če ga dam na normal priority A se ga da kako zagnati v normal priority po defaultu (če imajo windowsi kako foro)? Sprašujem za WinXP.
(c) 1982 Sinclair Research Ltd
Djuro ::
Napišeš eno cmd datoteko z ukazom
START ime_programa.exe /NORMAL
oz. za več informacij o uprabi ukaza START poglej v Help.
START ime_programa.exe /NORMAL
oz. za več informacij o uprabi ukaza START poglej v Help.
tha_man ::
Ja, ravno probavam s startom, pa mi noče zalaufat programa, ampak samo odpre konzolo. Men nč jasno
(c) 1982 Sinclair Research Ltd
Gandalfar ::
C:\>start /?
Starts a separate window to run a specified program or command.
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]
"title" Title to display in window title bar.
path Starting directory
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt
the application
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class
WAIT Start application and wait for it to terminate
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.
If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.
parameters These are the parameters passed to the command/program
If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:
non-executable files may be invoked through their file association just
by typing the name of the file as a command. (e.g. WORD.DOC would
launch the application associated with the .DOC file extension).
See the ASSOC and FTYPE commands for how to create these
associations from within a command script.
When executing an application that is a 32-bit GUI application, CMD.EXE
does not wait for the application to terminate before returning to
the command prompt. This new behavior does NOT occur if executing
within a command script.
When executing a command line whose first token is the string "CMD "
without an extension or path qualifier, then "CMD" is replaced with
the value of the COMSPEC variable. This prevents picking up CMD.EXE
from the current directory.
When executing a command line whose first token does NOT contain an
extension, then CMD.EXE uses the value of the PATHEXT
environment variable to determine which extensions to look for
and in what order. The default value for the PATHEXT variable
is:
.COM;.EXE;.BAT;.CMD
Notice the syntax is the same as the PATH variable, with
semicolons separating the different elements.
When searching for an executable, if there is no match on any extension,
then looks to see if the name matches a directory name. If it does, the
START command launches the Explorer on that path. If done from the
command line, it is the equivalent to doing a CD /D to that path.
-
pomojem kaksn "start \k c:\runme.exe"
mal se igraj.
Starts a separate window to run a specified program or command.
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]
"title" Title to display in window title bar.
path Starting directory
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt
the application
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class
WAIT Start application and wait for it to terminate
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.
If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.
parameters These are the parameters passed to the command/program
If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:
non-executable files may be invoked through their file association just
by typing the name of the file as a command. (e.g. WORD.DOC would
launch the application associated with the .DOC file extension).
See the ASSOC and FTYPE commands for how to create these
associations from within a command script.
When executing an application that is a 32-bit GUI application, CMD.EXE
does not wait for the application to terminate before returning to
the command prompt. This new behavior does NOT occur if executing
within a command script.
When executing a command line whose first token is the string "CMD "
without an extension or path qualifier, then "CMD" is replaced with
the value of the COMSPEC variable. This prevents picking up CMD.EXE
from the current directory.
When executing a command line whose first token does NOT contain an
extension, then CMD.EXE uses the value of the PATHEXT
environment variable to determine which extensions to look for
and in what order. The default value for the PATHEXT variable
is:
.COM;.EXE;.BAT;.CMD
Notice the syntax is the same as the PATH variable, with
semicolons separating the different elements.
When searching for an executable, if there is no match on any extension,
then looks to see if the name matches a directory name. If it does, the
START command launches the Explorer on that path. If done from the
command line, it is the equivalent to doing a CD /D to that path.
-
pomojem kaksn "start \k c:\runme.exe"
mal se igraj.
tha_man ::
Sem pogruntal kaj sem delal narobe: poti do programa ne smeš dat v navednice, ker jo sicer vzame kot naslov okna za konzolo
Sm dela pa še vedno ne. Sicer se program zalaufa, a še vedno veselo ždi na high priority. Dal sem switch /normal, poizkusil sem pa tud s pa rostalimi. Obstaja še kak druga varianta da bi ga prisilil v normal? Kot kaže se program po zagonu sam nastavi na high, tako da switch pri ukazu start ne pomaga.
Sm dela pa še vedno ne. Sicer se program zalaufa, a še vedno veselo ždi na high priority. Dal sem switch /normal, poizkusil sem pa tud s pa rostalimi. Obstaja še kak druga varianta da bi ga prisilil v normal? Kot kaže se program po zagonu sam nastavi na high, tako da switch pri ukazu start ne pomaga.
(c) 1982 Sinclair Research Ltd
Gandalfar ::
tha_man: a gremo komplicirat :> Napisi program, ki bo pognal tvoj program, pogruntal handle ter ga potem z
SetPriorityClass(GetCurrentProcess(),dwPiority)) nastavil na tvojo prioriteto ;)
mogoce bi delovalo
(koda najdena tukaj )
SetPriorityClass(GetCurrentProcess(),dwPiority)) nastavil na tvojo prioriteto ;)
mogoce bi delovalo
(koda najdena tukaj )
tha_man ::
Hehe, upal sem sicer da imajo windowsi že vgrajeno kakšno možnost spreminjat prioriteto iz komandne vrstice
Tile sistemski klici so kr' neki. Sicer sem celo probal tole nardit hehe, ampak seveda ne dela. Uporabu sem tole kodo za zagon programa:
Handl := ShellExecute(Application.Handle, 'open', 'program.exe', nil, 'c:\pot', SW_SHOWNORMAL);
Tole dela, medtem ko
SetPriorityClass(Handl, NORMAL_PRIORITY_CLASS);
vrne error, le da jaz ne vem zakaj, niti kaj pomeni... Mogoče sem narobe definiral handle, ali pa je kaj v zvezi z dostopom do procesov, s čimer pa se še nisem ukvarjal.
Tile sistemski klici so kr' neki. Sicer sem celo probal tole nardit hehe, ampak seveda ne dela. Uporabu sem tole kodo za zagon programa:
Handl := ShellExecute(Application.Handle, 'open', 'program.exe', nil, 'c:\pot', SW_SHOWNORMAL);
Tole dela, medtem ko
SetPriorityClass(Handl, NORMAL_PRIORITY_CLASS);
vrne error, le da jaz ne vem zakaj, niti kaj pomeni... Mogoče sem narobe definiral handle, ali pa je kaj v zvezi z dostopom do procesov, s čimer pa se še nisem ukvarjal.
(c) 1982 Sinclair Research Ltd
Zgodovina sprememb…
- spremenilo: tha_man ()
Gandalfar ::
{Supply a fully qualified path name in ProgramName}
procedure ExecNewProcess(ProgramName : String);
var
StartInfo : TStartupInfo;
ProcInfo : TProcessInformation;
CreateOK : Boolean;
begin
{ fill with known state }
FillChar(StartInfo,SizeOf(TStartupInfo),#0);
FillChar(ProcInfo,SizeOf(TProcessInformation),#0);
StartInfo.cb := SizeOf(TStartupInfo);
CreateOK := CreateProcess(PChar(ProgramName),nil, nil, nil,False,
CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS,
nil, nil, StartInfo, ProcInfo);
end;
tale koda, ti bo ustvarila nov process z priority classem NORMAL. Ker pa ti ga program seveda kasneje sam spremeni ga lahko ti nastavis nazaj z:
SetPriorityClass( ProcInfo.hProcess, NORMAL_PRIORITY_CLASS);
pri cemer se ProcInfo.hProcess seveda nanasa na spremenjlivko znotraj procedure in si bos moral to vrednost nekam ven spravit..
procedure ExecNewProcess(ProgramName : String);
var
StartInfo : TStartupInfo;
ProcInfo : TProcessInformation;
CreateOK : Boolean;
begin
{ fill with known state }
FillChar(StartInfo,SizeOf(TStartupInfo),#0);
FillChar(ProcInfo,SizeOf(TProcessInformation),#0);
StartInfo.cb := SizeOf(TStartupInfo);
CreateOK := CreateProcess(PChar(ProgramName),nil, nil, nil,False,
CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS,
nil, nil, StartInfo, ProcInfo);
end;
tale koda, ti bo ustvarila nov process z priority classem NORMAL. Ker pa ti ga program seveda kasneje sam spremeni ga lahko ti nastavis nazaj z:
SetPriorityClass( ProcInfo.hProcess, NORMAL_PRIORITY_CLASS);
pri cemer se ProcInfo.hProcess seveda nanasa na spremenjlivko znotraj procedure in si bos moral to vrednost nekam ven spravit..
tha_man ::
Hej thanks, tole pa dela
Se je pa pojavil nov problem: program ob takem zagonu ne prebere nastavitev ekrana, in se postavi na naključno mesto ter s premajhnim oknom. Isto se zgodi če ga začenem iz konzole, medtem ko klik na bližnjico deluje pravilno. Nima veze s startup mapo, ker sem jo probal spremenit v bližnjici pa vseeno prebere nastavitve. A veš slučajno v čem je razlika če prog zaženeš iz konzole (oz. takole iz programa) ter iz bližnjice?
Thanks za help, Gandalfar!
Se je pa pojavil nov problem: program ob takem zagonu ne prebere nastavitev ekrana, in se postavi na naključno mesto ter s premajhnim oknom. Isto se zgodi če ga začenem iz konzole, medtem ko klik na bližnjico deluje pravilno. Nima veze s startup mapo, ker sem jo probal spremenit v bližnjici pa vseeno prebere nastavitve. A veš slučajno v čem je razlika če prog zaženeš iz konzole (oz. takole iz programa) ter iz bližnjice?
Thanks za help, Gandalfar!
(c) 1982 Sinclair Research Ltd
Gandalfar ::
probi z tole zadevo pognat .lnk al pa .pif fajl ki bi znala vsebovat take informacije.. pa poglej kaj je nastavljen za WorkDir..
tha_man ::
.lnk noče zagnati... Sm nima veze, sm najdu workaround. Moj zvesti utility PowerPro sem nastavu da okno dotičnega programa ob odprtju samodejno postavi na pravo mesto in ga tud resiza. Itak hočem da je vedno na tem mestu
Evo, thanks še enkrat Gandalfar. Tole kodo utegnem kdaj rabiti tud še za kaj druzga.
Evo, thanks še enkrat Gandalfar. Tole kodo utegnem kdaj rabiti tud še za kaj druzga.
(c) 1982 Sinclair Research Ltd
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | KeyloggerOddelek: Programska oprema | 2625 (1352) | Blisk |
» | En majhen trik za vseOddelek: Programiranje | 1715 (1311) | Trubar |
» | Processes & Set Priority v XP-jihOddelek: Operacijski sistemi | 991 (859) | CaqKa |
» | Funkcija za zapret programOddelek: Programiranje | 1310 (1066) | StratOS |
» | Odpiranje dat.exe v VBOddelek: Programiranje | 2985 (2778) | webblod |