473,382 Members | 1,329 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,382 software developers and data experts.

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 10005
> 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 SetForeGroundWindow 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 SetForeGroundWindow 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(object sender, System.EventArgs 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****************@TK2MSFTNGP10.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(object sender, System.EventArgs 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****************@TK2MSFTNGP10.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("User32.dll")]
public static extern Int32 FindWindow(String lpClassName,String
lpWindowName);
[DllImport("User32.dll")]
public static extern Int32 SetForegroundWindow(int hWnd);

private void triMain_Click(object sender, System.EventArgs e)
{
Show();
int hWnd = FindWindow(null, "Pacemaker"); // Win32 API, don't want
to use this
SetForegroundWindow(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****************@TK2MSFTNGP10.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
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...
2
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...
3
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...
20
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...
1
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...
6
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...
2
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...
35
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. ...
2
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...
7
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?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.