473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I make a form stay on top and is there a way to change the taskbar Icon color?

Hello Everyone,

QUESTION #1
I am working on a timer. I have the following code which works kind of
OK.

If Form1.WindowState = 1 Then Form1.WindowState = 0

The problem is that if the user has another window open when my timer
program restores itself it ends up behind whatever window is currently open.
Is there any way for my window to be told to be on top?
QUESTION #2
The other question, is there a way to change the image or text on the
taskbar icon as to draw attention to it?
Thanks In Advance For Any Answers.
Jim Mac Millan
San Dimas, CA
Jul 17 '05 #1
1 5677
The following code should help:
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

Public Declare Sub SetWindowPos Lib "user32" _
(ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long)

Private Sub Form_Activate()
'SETS THE FORM IDENTIFIED AS ME IN THE STATEMENT BELOW TO BE ALWAYS ON TOP
WHEN SET TO "TRUE"
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or
SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE

End Sub

"Jim M M" <Pe*********@SPAMKILLERYahoo.com> wrote in message
news:TQ********************@vel.net...
Hello Everyone,

QUESTION #1
I am working on a timer. I have the following code which works kind of
OK.

If Form1.WindowState = 1 Then Form1.WindowState = 0

The problem is that if the user has another window open when my timer
program restores itself it ends up behind whatever window is currently open. Is there any way for my window to be told to be on top?
QUESTION #2
The other question, is there a way to change the image or text on the
taskbar icon as to draw attention to it?
Thanks In Advance For Any Answers.
Jim Mac Millan
San Dimas, CA

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shayne H | last post by:
I want to be able to add a clock to the title of a VB.NET form. Simply updating the FormClass.Text property does not quite make it, the titile only changes once the form is minimised/maximised....
7
by: Russ via AccessMonster.com | last post by:
Can someone tell me how to change the icon in the windows task bar? I already figured out how to do it in the forms, and shortcuts but the windows task bar still says Microsoft Access, I only want...
1
by: Andrew Mueller | last post by:
-- This was accidentally posted in the vbscript forum. Sorry about that. Code is C# in VS .NET 2003. Hello all, I have a non-rectangular form... Really, it is just a bitmap with a...
0
by: redneon | last post by:
Is there any way to change the icon for a form but not change it on the taskbar? Effectively having diferent icons for the form and taskbar. Darrell
2
by: ukdmbfan | last post by:
I want to create several forms in my C# program so that when people click on options in the menu bar (such as Tools -> Options) it brings up a new form dialog window for them to change certain...
1
by: Thief_ | last post by:
I have two projects in one solution: a.. Outlook Monitor b.. Tray Notification Both contain a form called "Form1.vb". How do I reference "Outlook Monitor"'s Form1 from "Tray Notification"'s...
5
by: michael sorens | last post by:
(1) By setting an icon in my Windows Form properties, I successfully display my custom icon when my application is executed. However, as soon as I open the Options form in my application--now...
3
by: Jimmy | last post by:
I'm kinda newbie to python and wxPython. Now I'm confronting a thorny problem: how can I make my program minimize to the taskbar represented as an ico, and when there is some message from network...
2
by: plevintampabay | last post by:
I have a borderless form in C#. The form has an icon specified in its properties and I also have the same icon specified for the project in the project properties. When I had a border on the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.