How do I do it in c#?
My current solution works sometimes, but sometimes the form comes
behind the fullscreen application.
I am using the following in the forms constructor
this.WindowStat e = FormWindowState .Normal;
this.Focus();
this.BringToFro nt();
this.TopLevel = true;
All I want to do is to put a message on the screen, and I want it to be
visible no matter what application has the top level window.
All suggestions are very welcome!
thanks 6 8528
Marcus, this.TopLevel = true;
I believe you want to set TopMost to true. TopLevel is true by default.
However there is no top on the the TopMost. When you set form to be TopMost
it will be over all "normal forms", but will
compete with all other topmost that you may have.
--
HTH
Stoitcho Goutsev (100)
"Marcus" <ma************ @koping.net> wrote in message
news:11******** *************@y 43g2000cwc.goog legroups.com... How do I do it in c#?
My current solution works sometimes, but sometimes the form comes behind the fullscreen application.
I am using the following in the forms constructor
this.WindowStat e = FormWindowState .Normal; this.Focus(); this.BringToFro nt(); this.TopLevel = true;
All I want to do is to put a message on the screen, and I want it to be visible no matter what application has the top level window.
All suggestions are very welcome!
thanks
Hi Marcus,
You might want to use a P/Invoke approach. Namely, you can use User32's
SetForegroundWi ndow() API to give your window focus without having to set
Window State, TopLevel (Did you mean TopMost ?) and other Form properties.
The declartion for the API is:
[System.Runtime. InteropServices .DllImport("Use r32")]
private static extern bool SetForegroundWi ndow(
IntPtr hWnd
);
A call to this function can be done in a Form's Load event handler method:
private void Form1_Load(obje ct sender, EventArgs e)
{
SetForegroundWi ndow(this.Handl e);
}
That way your window will be given focus and it will most likely be in front
of any other windows, even if they consume the whole workspace.
--
Stanimir Stoyanov www.stoyanoff.info
"Marcus" wrote: How do I do it in c#?
My current solution works sometimes, but sometimes the form comes behind the fullscreen application.
I am using the following in the forms constructor
this.WindowStat e = FormWindowState .Normal; this.Focus(); this.BringToFro nt(); this.TopLevel = true;
All I want to do is to put a message on the screen, and I want it to be visible no matter what application has the top level window.
All suggestions are very welcome!
thanks
Unless something special is done all applications start with their main
windows on the foreground. I believe this step is redundant.
--
S uvajenie,
Stoitcho Goutsev (100)
"Stanimir Stoyanov" <admin{at}stoya noff{dot}info> wrote in message
news:5F******** *************** ***********@mic rosoft.com... Hi Marcus,
You might want to use a P/Invoke approach. Namely, you can use User32's SetForegroundWi ndow() API to give your window focus without having to set Window State, TopLevel (Did you mean TopMost ?) and other Form properties.
The declartion for the API is:
[System.Runtime. InteropServices .DllImport("Use r32")] private static extern bool SetForegroundWi ndow( IntPtr hWnd );
A call to this function can be done in a Form's Load event handler method:
private void Form1_Load(obje ct sender, EventArgs e) { SetForegroundWi ndow(this.Handl e); }
That way your window will be given focus and it will most likely be in front of any other windows, even if they consume the whole workspace.
-- Stanimir Stoyanov www.stoyanoff.info
"Marcus" wrote:
How do I do it in c#?
My current solution works sometimes, but sometimes the form comes behind the fullscreen application.
I am using the following in the forms constructor
this.WindowStat e = FormWindowState .Normal; this.Focus(); this.BringToFro nt(); this.TopLevel = true;
All I want to do is to put a message on the screen, and I want it to be visible no matter what application has the top level window.
All suggestions are very welcome!
thanks
Stanimir,
It is better to use .NET tools for bring Form on foreground using
Form.Activate()
Regards,
Galin Iliev[MCSD.NET] www.galcho.com
I sounds like this would do the same thing as this.Focus(), but I will
give it a shot.
thanks
Stanimir Stoyanov wrote: Hi Marcus,
You might want to use a P/Invoke approach. Namely, you can use User32's SetForegroundWi ndow() API to give your window focus without having to set Window State, TopLevel (Did you mean TopMost ?) and other Form properties.
The declartion for the API is:
[System.Runtime. InteropServices .DllImport("Use r32")] private static extern bool SetForegroundWi ndow( IntPtr hWnd );
A call to this function can be done in a Form's Load event handler method:
private void Form1_Load(obje ct sender, EventArgs e) { SetForegroundWi ndow(this.Handl e); }
That way your window will be given focus and it will most likely be in front of any other windows, even if they consume the whole workspace.
-- Stanimir Stoyanov www.stoyanoff.info
"Marcus" wrote:
How do I do it in c#?
My current solution works sometimes, but sometimes the form comes behind the fullscreen application.
I am using the following in the forms constructor
this.WindowStat e = FormWindowState .Normal; this.Focus(); this.BringToFro nt(); this.TopLevel = true;
All I want to do is to put a message on the screen, and I want it to be visible no matter what application has the top level window.
All suggestions are very welcome!
thanks
thanks for answering,
I have tried this approach already, but it seems like when I play
applications like "World of Warcraft" which has the topMost (yes I
meant the topMost not the topLevel as I wrote previously) window my
message does not always get displayed in front of WoW's full screen
window.
My application which creates the message window form is always started
before the full screen applications, which could have the negative
effect that the most recently started application trying to claim to be
topmost gets to be. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Duane |
last post by:
Hi ... here is my situation: I am building an application that is
driven by a main menu. When the user chooses an option from the main
menu that spawns a new window (or module). From that(or any) module
window there is a menu where the user can choose to go to or switch to
any other module. So ... lets say that the main menu has 4 options.
The user chooses option 1 which will open a new window (replacing the
main menu). On that new...
|
by: genetic.error |
last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up
before...
The VS.Net MSDN file seems to state that the following should work:
Form1.Show
Form1.Visible = True
Form1.Hide
Form1.Visible = False
Load (Form1)
|
by: Hamed |
last post by:
Hello
I have employed as a developer in a software company that its team uses
FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to
migrate to VS.NET. There is a project modified that is to upgrade a big,
more than 100,000 lines DOS based program developed by FoxPro 2.x to .NET
platform. The design is as previous and the implementation will be
reprogrammed. As a duty in my job I should find an answer about the
|
by: Brad Burke |
last post by:
From a windows .Net app, I need to 1) check if MSAccess is already open to a
certain Access application. If so, then open a form and find a certain
record. 2) If not open, then open MSAccess and open a secured Access
application and then open a form and find a record. (The Access App is
secured not with a database password but with full user name and password
security.)
I can open the form and find the record OK. I am having problems...
|
by: HL |
last post by:
Hi,
I need to enumerate windows and find the sum of the rect of all the windows
of a specific application. In C++, I use the APIs - 'EnumWindows ,
GetWindowRect and UnionRect to accomplish the same.
How to perform the above in c#? Is PInvoke the only way to do it or Is there
some inherent c# way?
| |
by: =?Utf-8?B?QWxiZXJ0IEZ1?= |
last post by:
Hi,
my function: myAdjustForm.Show();
I am using the Show method to show the pop-up window to the users
in my C# program.
I found that I have invoke this function TWICE at the beginning before I can
see the pop-up window poping up.
|
by: JB |
last post by:
Hi All,
I have a VB.NET application that constantly executes queries through
ODBC connections. The application consists of a simple Form type UI
where the query parameters can be edited, and a simple scheduler that
executes the queries.
The application works fine as "standalone" but it now needs to be
installed on a server and left running permanently even when no user
is logged on.
I think a Windows Service would be perfect for this,...
|
by: matthewr |
last post by:
I want to create a fully-transparent fullscreen form which records
clicks but also passes on the 'click' to the desktop. Specifically, I
have an existing application which displays a webpage fullscreen. I
want my new application to run transparently over the top of the
existing app, and when the user clicks the mouse button, my
transparent application records the location of the click while
'passing on' the click to the application below...
|
by: Prats |
last post by:
MessageBox::Show(Window, String)
How do I pass the value for the Window parameter, rather how do I get the
value for the active window
Also,there are two forms open at the same time, one overlapping the other.
Now if I click the form at behind how do I bring to to front. I tried giving
BringToFront() didn't work.
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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();...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |