Link to home
Start Free TrialLog in
Avatar of Ron Miller
Ron Miller

asked on

Always on top VB.net program

I want to write a Windows  VB.net program that always occupies the top quarter of the screen (I want it permanently displayed so users see important messages).
If other windows programs are maximized, they should not cover my vb program. Other programs should behave as if  the screen starts below my vb program.

i hope I have explained clearly !

Ron
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Hi Ron,

I understand that this is a business requirement that you have but it will be a great hassle for end users to deal with such an app.

While your requirements are crystal clear, did you try to put together some code?

There is a working sample available at: http://www.pinvoke.net/default.aspx/user32/SetWindowPos.html

<DllImport("user32.dll", SetLastError:=True)> _
 Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As SetWindowPosFlags) As Boolean
 End Function

Open in new window


Private ReadOnly HWND_BOTTOM As New IntPtr(1)
 Private ReadOnly HWND_NOTOPMOST As New IntPtr(-2)
 Private ReadOnly HWND_TOP As New IntPtr(0)
 Private ReadOnly HWND_TOPMOST As New IntPtr(-1)

Open in new window


Regards,
Chinmay.
Avatar of Ron Miller
Ron Miller

ASKER

Why do you say it will be  a hassle for users ?
I agree with Chinmay, it is usually a hassle for users as they are now giving up screen space that could be used for other productive tasks.

Rather than trying to force your application to the top (especially when taking up a quarter of the screen) a better solution is to use a notify icon.  You could even have it pop up messages when they are received.  The notify icon should have at least two states, one when no new messages need to be reviewed, and another which shows that there are new messages to be reviewed.

-saige-
Humans are creatures of habit. Try working on a computer by blocking top 1/4th of the screen. I am sure there might be business justifications but then there are other ways to draw user's attention to important notifications/messages for example Windows Activation Message.
What i might do it have the application initially take a smaller amount of screen space - say the top 10% and for it to expand to 25% when a message has arrived.
That's a great idea. Also, how about this, you have a floating icon on desktop which pops up necessary messages as and when needed and if your end users are on Windows 8.1+ I would suggest using built-in Toast notifications (which are non-obstrusive by design).
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.