473,789 Members | 2,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keep my application on top

Hi, Group

I am C# and VB.6 programmer but in this moments I have the followin
question:

How Can I keep my application on the top of all applications on my Windows
desktop.

Please let me know

Best regard
MArio
Nov 15 '05 #1
6 10033
> I am C# and VB.6 programmer but in this moments I have the followin
question:

How Can I keep my application on the top of all applications on my Windows
desktop.


I don't believe you can without reverting to Win32 API funtions. I simply
needed a BringToFront for the main application window and couldn't find it,
Win32's SetForeGroundWi ndow seemed the only way.

Martin.
Nov 15 '05 #2
> I am C# and VB.6 programmer but in this moments I have the followin
question:

How Can I keep my application on the top of all applications on my Windows
desktop.


I don't believe you can without reverting to Win32 API funtions. I simply
needed a BringToFront for the main application window and couldn't find it,
Win32's SetForeGroundWi ndow seemed the only way.

Martin.
Nov 15 '05 #3
Mario,

You can get top most behavior by setting the form property TopMost to
boolean true; Something like this:

/* *************** *************** ******** */
private void Form1_Load(obje ct sender, System.EventArg s e) {
this.TopMost = true;
}
This will keep your for above all other windows, until another application
sets a window to TopMost -- then all TopMost windows compete for top most
based on foreground/active states...

One side note - debugging an app with a TopMost window is a bit of a pain -
the Debugger/IDE is ends up behind the app form...

I hope this helps a bit....

regards
roy fine
"Mario Reiley" <mr*****@cantv. net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi, Group

I am C# and VB.6 programmer but in this moments I have the followin
question:

How Can I keep my application on the top of all applications on my Windows
desktop.

Please let me know

Best regard
MArio

Nov 15 '05 #4
Mario,

You can get top most behavior by setting the form property TopMost to
boolean true; Something like this:

/* *************** *************** ******** */
private void Form1_Load(obje ct sender, System.EventArg s e) {
this.TopMost = true;
}
This will keep your for above all other windows, until another application
sets a window to TopMost -- then all TopMost windows compete for top most
based on foreground/active states...

One side note - debugging an app with a TopMost window is a bit of a pain -
the Debugger/IDE is ends up behind the app form...

I hope this helps a bit....

regards
roy fine
"Mario Reiley" <mr*****@cantv. net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi, Group

I am C# and VB.6 programmer but in this moments I have the followin
question:

How Can I keep my application on the top of all applications on my Windows
desktop.

Please let me know

Best regard
MArio

Nov 15 '05 #5
> You can get top most behavior by setting the form property
TopMost to boolean true;


I don't know what I did wrong before but this just works now. I had been
messing with it and found it didn't work for forms, I must have been
screwing something up. I ended up doing

// couldn't find a .NET-way to bring the window
// to top, reverting to old Win32 functions...
[DllImport("User 32.dll")]
public static extern Int32 FindWindow(Stri ng lpClassName,Str ing
lpWindowName);
[DllImport("User 32.dll")]
public static extern Int32 SetForegroundWi ndow(int hWnd);

private void triMain_Click(o bject sender, System.EventArg s e)
{
Show();
int hWnd = FindWindow(null , "Pacemaker" ); // Win32 API, don't want
to use this
SetForegroundWi ndow(hWnd); // Wim32 API, don't want to use this
}

Now it is clean:

Show();
TopMost = true;
TopMost = false;

I am resetting TopMost to false because I just want it to bring the form to
top when the tray icon is clicked and not stay on top persistently.

Thank you!

Martin.
Nov 15 '05 #6
OK guys Thanks for all

Mario

"Mario Reiley" <mr*****@cantv. net> escribió en el mensaje
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi, Group

I am C# and VB.6 programmer but in this moments I have the followin
question:

How Can I keep my application on the top of all applications on my Windows
desktop.

Please let me know

Best regard
MArio

Nov 15 '05 #7

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

Similar topics

5
3850
by: Mark Fisher | last post by:
I have a Java desktop GUI application that the user can run multiple times. In order to keep one instance of the application distinct from another, I'd like to put the instance number of the application in the title bar. For example, the user starts the application, and the title bar says "Control Panel". The user starts another instance of the application, and it knows that one instance is already running, so the title bar of the...
2
1983
by: medhanush | last post by:
Hi, Can somebody please tell me how to keep application running even though user logs out ? scenario is, user logs in, starts an exe and logs out, exe need to run for couple of hours. One solution is to use service instead of exe. Any other ideas ...? and also user logs-in using Remote Desktop appreciate your help.
3
2039
by: Jeff Greenland | last post by:
Hello everyone, I am having problems with Timers in a web application. They just seem to stop running after 15 minutes or so. My web application is set up like this: When a user hits a page in the site, that page (.aspx) instantiates a compiled class (.DLL). The instantiation process creates a Timer that runs in the background to perform tasks every so often (such as notifying clients
20
4498
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have found FileSystemWatcher class not very reliable and sometimes it behavies unexpectedly.I'm afriad that...
1
1255
by: ChainsawDude | last post by:
I can keep the session variables across application restarts by storing the session state in StateServer (rather than inprocess). However, the application variables are still lost! Please would someone say if they know how to keep application variables intact when the process restarts?
6
2044
by: Mad Scientist Jr | last post by:
My asp.net pages sessions are timing out after 20 minutes, and when I asked my Web host about it they said due to the nature of a shared hosting environment they cannot allow for sessions to keep application pools and worker processes hosed for too long as these fearures are consuming CPU resources while they are active. Therefore the pool application shutdown and re-start settings are at 20 minutes. Is there a workaround for this? Do I...
2
7210
by: Mark Huebner | last post by:
I am trying to create a web application with Visual Studio 2005 and C# that will start up a "keep alive" application on my web site's server. My DotNetNuke home page loads slowly when the site hasn't been accessed for a while. The purpose of the "keep alive" application is to keep my web site alive (loaded in memory) by accessing a page on the server every 5 minutes or so. I've tried using Process.Start to run a console application...
35
2220
by: salad | last post by:
I have an application written in MS-Access. It is a complete application that manages the day-to-day operations of a business. The program is nearly ready to be used in other customer sites. I am wondering if any of you have advice on supporting an application. Since it has never had any outside exposure, what I don't want is to make a bunch of sales and not be able to support the issues that arise. I believe as kinks are worked out...
2
2298
by: manontheedge | last post by:
In Visual Basic, how do I keep a program that I'm running on top of EVERYTHING? For example, I have an application in Visual Basic that has a GUI, and I want it to stay on top of anything that may open after it. I searched the internet, found a bunch of things, and NONE of them work. If anyone can help me out I would appreciate it.
7
7227
by: mail747097 | last post by:
I would like to keep IIS alive on my web site and prevent Application_End from occuring in global.asax. Any ideas?
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10410
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.