Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

WindowsOnTop - What the best way?


  • Please log in to reply
4 replies to this topic
xbutton
  • Members
  • 3 posts
  • Last active: Nov 02 2015 01:54 AM
  • Joined: 28 Oct 2015

Hi All,

 

I have Point of Sales application (Windows Form A) and a small form (Windows Form B). On Windows startup, Form A and Form B will run automatically as both shortcut (Form A and Form B) are put inside startup Windows folder. 

 

The problem is that Form B must always on top of others windows form. Sometime Form B is not on top of other windows form. I need to find a solution so that Form B always on top of other Windows forms, especially on top of Form A. 

 

I try to create Autohotkey script (OPTION 1)

 

WinSet, AlwaysOnTop, ON, ahk_exe C:\Form B.exe

 

I compile the script and put the shortcut inside startup Windows folder. My assumption, it will work perfectly. Form A is starting up....Form B is starting up, then Form B is always on top by using above script.....

 

However...when Form A show confirmation message or any circumstances, Form B will not be on top (go to behind of other windows form). is this a bug of Autohotkey?

 

 

Then, I try to use OPTION 2 by writing this script:

 

#Persistent

SetTimer, WatchExistXButtonWindow, 500
return
 
WatchExistXButtonWindow:
if WinExist("ahk_exe C:\Form B.exe")
{  
    WinSet, AlwaysOnTop, ON, ahk_exe C:\Form B.exe
}
return
 
Option 2 is working so far and under monitoring now. my concern is that system is checking every 500 milliseconds and the Point of Sales machine is never shutdown. Is there performance issue and slow down Point of Sales machine in future?
 
Is there any other better way by not using timer? OPTION 1 is the best if can make it forever until system shutdown.
 
Please advice......

 

 



noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011

Just use the settimer,500msec is a very long time .Windows would handle hunderds of messages in that timeframe.I have a few running at the default 250ms on an old pc just checking mouseposition.


winXP  and ahk unicode


xbutton
  • Members
  • 3 posts
  • Last active: Nov 02 2015 01:54 AM
  • Joined: 28 Oct 2015

Hi Noname,

 

Do you mean that there is no issue at all on performance even though we never shutdown the PC?



noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011

Correct. :)


winXP  and ahk unicode


xbutton
  • Members
  • 3 posts
  • Last active: Nov 02 2015 01:54 AM
  • Joined: 28 Oct 2015

ok, thanks for sharing your experience