Bill2's Process Manager : le forum

Bill2's Process Manager, Votre gestionnaire de processus automatique
 
AccueilAccueil  FAQFAQ  RechercherRechercher  S'enregistrerS'enregistrer  MembresMembres  GroupesGroupes  Connexion  

Partagez | 
 

 Window focus

Aller en bas 
AuteurMessage
MarkShot
Supporter
Supporter


Nombre de messages : 28
Date d'inscription : 21/05/2008

MessageSujet: Window focus   Mer 21 Mai - 1:19

I like the priority option for whether a window is minimized or not.

However, I would also like such an option depending on whether a window has focus or not. In many cases, a user will not explicitly minimize a window, but simply click on something else and change focus. Often in these cases, you might like the priority demoted.

In the past, I have scripted this myself using a language call WinBatch (www.winbatch.com). However, this would be fit very nicely into your rule set.

Thanks!
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
Bill2
Administrateur
Administrateur
avatar

Nombre de messages : 418
Age : 40
Localisation : Dijon
Date d'inscription : 21/11/2006

MessageSujet: Re: Window focus   Mer 21 Mai - 6:18

Hi,

Have you e-mail me about this function ?
I just have the same demand by E-Mail Shocked Very Happy

So, I repeat me answer, with my "wonderfull" English Wink


As far as I know, my soft is the only one that handdle minimized windows.
I think it is technically possible to check focused windows, but this kind of feature may consumme too many CPU. (I have to test it)

Furthermore, windows has a special function that can "boost" focused windows.
Right click on the "my computer" icon, properties, advanced tab, then click the parameters button in "Performances".
In the "advanced" tab, you will find an option to boost programs or system services.

I may be wrong, but I think this option modify a little bit the priority of the focused process.
(For exemple, "normal priority" is 8, "above normal" is 10, and a "boosted normal" is 9) Well, this is automatic, and not "forced" like the minimized feature of my soft.
However, I will consider to test this requested kind of feature, but I can't promess you to implement it.

_________________
Rubik's Addicted !
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://www.bill2-software.com/processmanager
MarkShot
Supporter
Supporter


Nombre de messages : 28
Date d'inscription : 21/05/2008

MessageSujet: Re: Window focus   Mer 21 Mai - 7:06

Here is a script I did for a game which I used to play on my single CPU Pentium 2.53GHz. In WinBatch, I don't think the check focus is very resource intensive. Note, the formatting may be off due to tabs/spaces.

Citation :

WinTitle(WinName(), "Tropico1 Priority")

; Mark Kratzer 11/28/06
;
; Set priority to normal when active window. Set
; priority to low when it loses focus.

; ----- Definitions ------

Interval=1
NormalPriority=32
IdlePriority=64
GameProcess="Tropico"

; ----- Initialize -----

lookfor=GameProcess
Addextender("wproc34i.dll")

; ----- Monitor active window and toggle priority -----

While @True

If WinExist(GameProcess) Then

If WinGetActive()==GameProcess Then

CurrentPriority=NormalPriority
GoSub FindAndSet

Else

CurrentPriority=IdlePriority
GoSub FindAndSet

End If

End If

Delay(Interval)

End While

; ----------------------------------
; ----- Subroutine definitions -----
; ----------------------------------

; ##### Get PID and set #####

:FindAndSet

Processlist=tListProc()
ptr=StrIndexNC(processlist,lookfor,0,@fwdscan)
if ptr<>0
ptr=StrIndex(processlist,"|",ptr,@fwdscan)
ptr2=StrIndex(processlist,@tab,ptr,@fwdscan)
if ptr2==0;if last item in list
pid=Strsub(processlist,ptr+1,-1)
else
pid=Strsub(processlist,ptr+1,ptr2-ptr-1)
endif
ret=tSetPriority(pid,CurrentPriority)
End If

Return
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
MarkShot
Supporter
Supporter


Nombre de messages : 28
Date d'inscription : 21/05/2008

MessageSujet: Re: Window focus   Mer 21 Mai - 7:08

Yes, I had sent it via email originally. I was concerned about posting in English on a French forum.

But I decided you had such a great tool that I should encourage you to add this feature. Smile
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
Bill2
Administrateur
Administrateur
avatar

Nombre de messages : 418
Age : 40
Localisation : Dijon
Date d'inscription : 21/11/2006

MessageSujet: Re: Window focus   Mer 21 Mai - 7:13

Well, I just have to look at the "focus" functions, and verify I could simply check if a window has focus or not.
I don't know if this feature is build-in in .net2.0, or if I have to use API ...

Then, changing priority is simple: the core architecture is already there, it's like changing priority for minimized or hidden window ...

I'll take a look, but not for the next version (v3.2), because this version is already in "RC" stage before publication Wink

May be for v3.2.x bounce

_________________
Rubik's Addicted !
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://www.bill2-software.com/processmanager
Bill2
Administrateur
Administrateur
avatar

Nombre de messages : 418
Age : 40
Localisation : Dijon
Date d'inscription : 21/11/2006

MessageSujet: Re: Window focus   Jeu 22 Mai - 19:20

Hello,

I've done some tests in Windows and "without" BPM running.
So ... Foreground windows seems to have a little priority boost ...

I use Celestia (a space simulator).
I launch it two time (so there is two celestia.exe process running), and set affinity to CPU1 only for each instance.

Then I launch the MS Task Manager to verify how Windows handle that.

Here what I find :
With the same priority, the tow instance share the CPU nearly perfectly (48-52 or 50-50 for exemple)
It if lower one process priority, then Windows give a significant boost for the other (normal, isn't it ?)

But there's an interesting thing.
If both processes have the same priority, then Windows seems to give a very little priority boost to the window having the focus.
In my test, it was about 45-55 or 40-60, and not very stable, but there is a little boost.

So, I think implementing a function to lower priority if background windows is not necessary.


I wil not implement it in a near future, but I think I have to do more tests to verify this MS-Windows function.

_________________
Rubik's Addicted !
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://www.bill2-software.com/processmanager
MarkShot
Supporter
Supporter


Nombre de messages : 28
Date d'inscription : 21/05/2008

MessageSujet: Re: Window focus   Jeu 22 Mai - 22:28

Bill,

Your findings make sense. It's been many years (~30), since my graduate work in Computer Science. But typically in an OS you try favor interactive processes over batch (or background) processes. This is done by giving an interactive process small time slices (scheduled CPU allotment before a timer interrupt preempts the CPU and invokes the OS Scheduler) and at the same time boosting the interactive process' priority. Thus, something like a word processor should tend to display good typing echo and function performance despite a substantial system load.

It sounds to me the like that is what is going on during your test. However, like I said my days of systems theory of operations is long behind me. I've been in Systems for a long time, but for the last 20 years or more it's been senior management roles. Sad

Keep up the good work!
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
Bill2
Administrateur
Administrateur
avatar

Nombre de messages : 418
Age : 40
Localisation : Dijon
Date d'inscription : 21/11/2006

MessageSujet: Re: Window focus   Ven 23 Mai - 6:41

Thanks for all your propositions Smile

I'm currently working on v3.2, wich have really greats improvement over v3.1.5.
This version will not include any of your ideas, but I keep them in mind for the next version.

_________________
Rubik's Addicted !
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://www.bill2-software.com/processmanager
MarkShot
Supporter
Supporter


Nombre de messages : 28
Date d'inscription : 21/05/2008

MessageSujet: Re: Window focus   Ven 23 Mai - 7:04

Here is my current configuration. It's working quite well despite assigning system processes. I don't think I am too worried about it, since it is trivial to just disable PM if there are problems.

By the way, I see that I have stars by my name. Well, thanks, I am honored. So, will I get my name mentioned in the credits? Spelling is Mark "MarkShot" Kratzer if you do.

Sorry, I understand BPM is to remain free. I guess I am too much caught up in the commercial side of software. Smile I'll try to stop thinking of BPM as a commercial product ... although it is good enough and has the potential to be one. But, of course, the choice is yours.

Take care. Good night.


Dernière édition par MarkShot le Ven 23 Mai - 14:37, édité 1 fois
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
Bill2
Administrateur
Administrateur
avatar

Nombre de messages : 418
Age : 40
Localisation : Dijon
Date d'inscription : 21/11/2006

MessageSujet: Re: Window focus   Ven 23 Mai - 7:57

I know my soft is good enougth to be sold, but I don't want to, because my current job doesn't permit me to do such thing.
I can sold anything for my own profit.
So the soft is free, but you can donate if you want Smile


Can I have your opinion on other commercial softwares having the same functions as BPM ? (You can find some in my comparison page ...)

Do you think it is the best is its category?

_________________
Rubik's Addicted !
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://www.bill2-software.com/processmanager
MarkShot
Supporter
Supporter


Nombre de messages : 28
Date d'inscription : 21/05/2008

MessageSujet: Re: Window focus   Ven 23 Mai - 14:53

<deleted screen shots above to make the thread more browser friendly>

Okay, I'll make a donation this weekend. Smile I have to check if paypal account is still active as I hardly ever use it.

I had looked at a number of those on your comparisons page. Of course, yours compares very favorably:

(1) Feature rich.

(2) Professionally polished (as opposed to being a little "proof of concept" job like THG).

(3) Much more convenient to use. I have previously used IMAGECFG. But you have to remember to save the original EXE (since you cannot undo it). You must redo the EXE if it changes. It's not dynamic. After editting the EXE, it gives you a new firewall exception. Many games do to copy protection do not permit their EXE to be modified. ...

(4) I think the rule/set approach really put yours over the top as a quality implementation. The rules make it convenient and concise. For anyone who has ever used a firewall, it is a very good model for doing things that is already familiar.

(5) I looked at doing my own via WinBatch, but at that time (or the version I have) doesn't support affinity setting. Otherwise, it is a very powerful too. However, getting a version that allows you to compile is around $400USD. I simply own the $100USD version which is interpreted. Good enough for all my needs.

So, you say that you cannot sell it. Is that because you have developed it on your employer's time or is that because in France all intellectual property belongs to a programmer's employer regardless of when they develop something? When I worked as an employee in the USA (now run my own business), I was careful with employment contracts to specificy any intellectual property issues.

FYI - I found BPM via Google. The last time I looked for a solution was a little before you got started as I got my quad core (QX6700 OC'd[liquid cooled] to 3.2GHz) in 02/07. I came across BPM, since I am building a new system for my wife duo core (Q6700 standard cooling @ 2.6GHz). She does trading/money management. Her money management software is a pig and she uses a lot of heavy browser analytics. So, I want to guarantee that the money management doesn't get CPU starved and the analytics remains snappy. I will use BPM and some personal scripting via WinBatch to get exactly the behavior I want on her system.
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
Bill2
Administrateur
Administrateur
avatar

Nombre de messages : 418
Age : 40
Localisation : Dijon
Date d'inscription : 21/11/2006

MessageSujet: Re: Window focus   Ven 23 Mai - 16:52

Well, in fact, I don't code BPM on my employer's!
He does't pay me for doing personnal coding.

I code on my personnal free time, and with two babies @home, it's sometime difficult!


Thanks for your comparison with other softs Smile
I will have a look at WinBatch.

_________________
Rubik's Addicted !
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://www.bill2-software.com/processmanager
MarkShot
Supporter
Supporter


Nombre de messages : 28
Date d'inscription : 21/05/2008

MessageSujet: Re: Window focus   Sam 24 Mai - 1:09

WinBatch is a really nice scripting language. I use for all kinds of things. In the 80s when the world began to switch over to PCs and then Windows, I really missed command line scripting like what is common UNIX shell. WinBatch has been around since the days of Windows 3. It was originally jointly marketted by Wilsonware along with a programmers editor WinEdit (which I also still use).

These days, I believe MS included some form of VBA called VBS which can be used for Windows scripting. However, I am just too used to WinBatch. Here is an example of a VBS script I use for creating restore points daily (not mine; downloaded it):

Citation :

' Creates a SR point during the first startup of the day
' December 18, 2005
' For Windows® XP
' © 2005 Ramesh Srinivasan
' Website: http://windowsxp.mvps.org

Option Explicit
Dim SRP, CSRP, objWMI, clsPoint
Dim RPDate, D1, D2, dtmInstallDate, DMatch
DMatch = 0
Set SRP = getobject("winmgmts:\\.\root\default:Systemrestore")
Set dtmInstallDate = CreateObject("WbemScripting.SWbemDateTime")
Set objWMI = getobject( _
"winmgmts:\\.\root\default").InstancesOf ("systemrestore")
For Each clsPoint In objWMI
RPDate = getmytime(clsPoint.creationtime)
D1 = Month(RPDate) & "/" & Day(RPDate) & "/" & Year(RPDate)
D2 = Month(Date) & "/" & Day(Date) & "/" & Year(Date)
If D1 = D2 Then DMatch = 1
Next

Function getmytime(wmitime)
dtmInstallDate.Value = wmitime
getmytime = dtmInstallDate.GetVarDate
end Function

If DMatch = 0 Then
CSRP = SRP.createrestorepoint ("Daily Restore Point", 0, 100)
End If
Revenir en haut Aller en bas
Voir le profil de l'utilisateur
Bill2
Administrateur
Administrateur
avatar

Nombre de messages : 418
Age : 40
Localisation : Dijon
Date d'inscription : 21/11/2006

MessageSujet: Re: Window focus   Sam 24 Mai - 5:21

Yes, I know VBS, and WMI ...

But now, there's a more powerfull thing : PowerShell.

It allows you to script directlt in .Net, with all the power of this framework.

But I'm not sure if it is availlable for all Windows version, of just for servers ...

Well, I think it's a other way to work Wink
BPM is intented to be graphical and user friendly, without having to learn computer language.

_________________
Rubik's Addicted !
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://www.bill2-software.com/processmanager
Contenu sponsorisé




MessageSujet: Re: Window focus   

Revenir en haut Aller en bas
 
Window focus
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Salaire minimum : Focus sur les vrais problèmes.
» [Elémentaliste] Focus pour Emrold
» precision sur carte avec jeton focus
» Ceinture Force / Focus Sash
» Utilisation des cartes avec jeton focus

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Bill2's Process Manager : le forum :: Suggestion de fonctionnalités-
Sauter vers: