Hi,
How do I detect when a form is minimizing? specifically when a user clicks
the show desktop button on the taskbar, rather than the minimize button on a
form.
thanks in advance 7 9335
Sorry I forgot to add, I am using a borderless form.
"Lee" <le*****@hotmai l.com> wrote in message
news:Ov******** *****@TK2MSFTNG P03.phx.gbl... Hi,
How do I detect when a form is minimizing? specifically when a user clicks the show desktop button on the taskbar, rather than the minimize button on a form.
thanks in advance
On 21/04/2006 Lee wrote: Hi,
How do I detect when a form is minimizing? specifically when a user clicks the show desktop button on the taskbar, rather than the minimize button on a form.
thanks in advance
I spent yesterday puzzling this out and ended up over-riding the
WndProc as follows:
protected override void WndProc(ref Message message)
{
base.WndProc(re f message);
switch (message.Msg)
{
case WM_SYSCOMMAND:
if ((int)message.W Param == SC_MINIMIZE)
{
this.ShowInTask bar = false;
notifyIcon1.Vis ible = true;
this.Visible = false;
m_blnInTray = true;
}
break;
}
}
The constants are:
const int SC_RESTORE = 0xF120;
const int WM_SYSCOMMAND = 0x0112;
const int SC_MINIMIZE = 0xF020;
To restore the Window I use:
SendMessage(thi s.Handle, WM_SYSCOMMAND, SC_RESTORE, IntPtr.Zero);
I couldn't find a .NET way, but if there is one I would appreciate
knowing about it:-)
--
Jeff Gaines - Damerham Hampshire UK
Using XanaNews 1.18.1.3
Jeff & Lee, I couldn't find a .NET way, but if there is one I would appreciate knowing about it:-)
Just override the OnResize or OnSizeChanged methods (or handle the
corresponding events). The WindowState will tell you whether the form
is minimized or not.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
I cannot seem to detect the minimizing event (even by overriding WndProc as
you have), is the minimize event triggered by clicking on the minimize
button on a form somehow different to the show desktop event?
I have noticed however that a form that is set as Topmost does actually stay
displayed when the show desktop button is pressed! Could this be
manipulated somehow?
thanks
"Jeff Gaines" <jg************ @yahoo.co.uk> wrote in message
news:xn******** *******@news.in dividual.net... On 21/04/2006 Lee wrote:
Hi,
How do I detect when a form is minimizing? specifically when a user clicks the show desktop button on the taskbar, rather than the minimize button on a form.
thanks in advance
I spent yesterday puzzling this out and ended up over-riding the WndProc as follows:
protected override void WndProc(ref Message message) { base.WndProc(re f message);
switch (message.Msg) { case WM_SYSCOMMAND: if ((int)message.W Param == SC_MINIMIZE) { this.ShowInTask bar = false; notifyIcon1.Vis ible = true; this.Visible = false; m_blnInTray = true; } break; } }
The constants are: const int SC_RESTORE = 0xF120; const int WM_SYSCOMMAND = 0x0112; const int SC_MINIMIZE = 0xF020;
To restore the Window I use: SendMessage(thi s.Handle, WM_SYSCOMMAND, SC_RESTORE, IntPtr.Zero);
I couldn't find a .NET way, but if there is one I would appreciate knowing about it:-)
-- Jeff Gaines - Damerham Hampshire UK Using XanaNews 1.18.1.3
I have tried this;-
protected override void OnResize(EventA rgs e)
{
base.OnResize(e );
if (this.WindowSta te.Equals(FormW indowState.Mini mized))
{
MessageBox.Show ("minimized" );
}
}
however it still does not fire, just the same with overriding WndPrc, and
OnSizeChanged. Am i missing something obvious?
thanks
"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:e9******** ******@TK2MSFTN GP05.phx.gbl... Jeff & Lee,
I couldn't find a .NET way, but if there is one I would appreciate knowing about it:-)
Just override the OnResize or OnSizeChanged methods (or handle the corresponding events). The WindowState will tell you whether the form is minimized or not.
Mattias
-- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
On 21/04/2006 Mattias Sjögren wrote: Jeff & Lee,
I couldn't find a .NET way, but if there is one I would appreciate knowing about it:-)
Just override the OnResize or OnSizeChanged methods (or handle the corresponding events). The WindowState will tell you whether the form is minimized or not.
Mattias
Thanks Mattias, don't know why I couldn't get that working a couple of
days ago but it works fine now :-)
--
Jeff Gaines - Damerham Hampshire UK
Using XanaNews 1.18.1.3
On 21/04/2006 Lee wrote: I cannot seem to detect the minimizing event (even by overriding WndProc as you have), is the minimize event triggered by clicking on the minimize button on a form somehow different to the show desktop event?
I have noticed however that a form that is set as Topmost does actually stay displayed when the show desktop button is pressed! Could this be manipulated somehow?
Hi Lee
I have now got my form to minimise using the Resize event as Mattias
suggested,and I restore it when its NotifyIcon is Left Clicked.
You're right though about the Show Desktop thing, if I click that my
form disappears but it stays in the TaskBar and its NotifyIcon doesn't
appear so I wonder if it is made hidden rather than minimised? I'm
afraid you need somebody more techy than me to give a definitive answer.
--
Jeff Gaines - Damerham Hampshire UK
Using XanaNews 1.18.1.3 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gav |
last post by:
Hi,
At the moment i am checking that all the fields have been filled out, at the
moment i am using the following...
if firstname = "" and surname = "" and address1 = "" and town = "" and
county = "" and country = "" and postcode = "" and phone = "" and email11 =
"" and email2 = "" and password1 = "" and password2 = "" then
is there a better more efficient way of doing this??
|
by: Deano |
last post by:
In my app I have lots of forms with data presented in various ways
using all kinds of controls.
Is there a simple way of detecting if the user has changed any data? I
would like to do this so I could set a boolean value to True and then I
could use that to modify what is displayed on my reports.
In my dim memory is there a dirty property for forms that would do
this? Would that always work for every form? Most, if not all, of my...
|
by: NL |
last post by:
Hi,
Does anybody know how to turn off the animation Windows does with a window
as it's minimized/maximized to the taskbar?
I have an app which, when minimized, syncs to any other open instances of
the app and tells them to minimize. If I have more than a couple instances
open, the user ends up waiting quite a while for all of windows to minimize,
since each minimizing animation is done consecutively and not in parallel.
|
by: needin4mation |
last post by:
Hi, I have an asp.net 1.1 application that populates data from a
database. When the user changes data, they have to hit a button to
update the data. The data entry form (same form that is populated) is
from several different tables. To the user, of course, this is not
seen.
Scenario: After the page is populated, assume a change is made to the
form and the user hits update. The page then goes back, reads the
database for that record...
|
by: Dean Slindee |
last post by:
In my application there is a main form with a tabcontrol. On each page in
the tabcontrol is a panel upon which is painted a "sub" form. The main form
acts as the "application host", while the subforms are where data values
contained in underlying tables are displayed, inserted, updated or deleted.
I don't make the user press an "Edit" button to enable the textboxes on the
subforms. Rather, the subforms and their textboxes are always...
| |
by: Tony Clark |
last post by:
Hi,
How can i tell when a form is minimizing or closing by use of the button in
the top right of the form?
thanks in advance
|
by: Dag Sunde |
last post by:
Is it possible to detect if the user minimizes the browser-window?
I do some polling, and want to stop it while the window in minimized,
but not when it only is blurred...
TIA...
--
Dag.
|
by: shrestha.mahesh |
last post by:
I have used System.Drawing.Graphics and Form.CreateGraphics to draw
line in my form during runtime. Everything is working fine but when
the form is minimized or some other windows are temporarily placed on
top of the form, the lines disappear.
Any help will be very much appreciated.
|
by: wwwords |
last post by:
Is there a general method for detecting that a user has changed the
record currently visible on a form, whether this is by hitting PgUp or
PgDn or clicking on a navigation button, even if no change has been
made in any control?
I'm thinking of a situation in which a number of records have been
entered on a form and the user is cycling through them to check the
data entered. I want to be able to detect this and update certain
information...
|
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: 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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
| |