473,405 Members | 2,344 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,405 software developers and data experts.

c# FORM - Keep My Application Always On Desktop (not always on top)

Hello,

I want information about how can I place my application always on desktop.The best example for this is vista sidebar.Please Help me in doing this.

I tried to override wndproc method but im not understanding how to reach it..

Thanks in advance
Jan 8 '08 #1
10 13372
levik
3
Hi dmnreddy!
Did you found any solution for this issue?
I need exactly the same.
Oct 8 '08 #2
myusernotyours
188 100+
Checkout the SHAppBarMessage Windows API function here

There is also a Visual Basic implementation here

Regards,

Alex.
Oct 8 '08 #3
levik
3
Checkout the SHAppBarMessage Windows API function here

There is also a Visual Basic implementation here

Regards,

Alex.
Hello Alex,

Thank you for the response, but is not exactly I'm looking for.
This API function makes my form as TaskBar - it reduces the desktop area.
I need to create a form that appears on desktop even if a user minimize all windows (show desktop, minimize all, etc.).
Actually, I'm looking for non mimimizable form.
Oct 8 '08 #4
myusernotyours
188 100+
Hello Alex,

Thank you for the response, but is not exactly I'm looking for.
This API function makes my form as TaskBar - it reduces the desktop area.
I need to create a form that appears on desktop even if a user minimize all windows (show desktop, minimize all, etc.).
Actually, I'm looking for non mimimizable form.
Oh, I do not think that's possible in a direct way, the show desktop command is sure to try minimizing your window all the time. A work around would be to detect when the window is about to or gets minimized and get it back immidiatelly or discard the minimize message. If you want you could try subclassing it's winproc function.

Regards,

Alex.
Oct 8 '08 #5
Curtis Rutland
3,256 Expert 2GB
You could also try to handle the SizeChanged event. Then, test if the form's WindowState is equal to FormWindowState.Minimized. If so, set the WindowState = FormWindowState.Normal

The only issue is you will see a bit of a flicker.

EDIT:
This still won't stop the Show Desktop command. But even the Vista Sidebar is minimized when you Show Desktop
Oct 8 '08 #6
levik
3
You could also try to handle the SizeChanged event. Then, test if the form's WindowState is equal to FormWindowState.Minimized. If so, set the WindowState = FormWindowState.Normal
This is almost what I need, but in this case my form stay always visible over another windows, that is to say "always on top" window
Oct 8 '08 #7
joedeene
583 512MB
This is almost what I need, but in this case my form stay always visible over another windows, that is to say "always on top" window
What about the this.SendToBack() method? You can implement a timer for it too?

joedeene
Oct 8 '08 #8
Hello
I think i got it.

Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
_timer.Interval = 1000

_timer.Start()

' Add the CheckTcpListner method as the handler for _Timer Tick events
AddHandler _timer.Tick, AddressOf CheckTcpListener
End Sub

Private Sub CheckTcpListener(ByVal sender As Object, ByVal e As System.EventArgs)
Me.TopMost = False
Dim chars As Integer = 256
Dim buff As New StringBuilder(chars)

' Obtain the handle of the active window.
Dim handle As IntPtr = GetForegroundWindow()

' Update the controls.
If GetWindowText(handle, buff, chars) > 0 Then
'Console.WriteLine(buff.ToString())
'Console.WriteLine(handle.ToString())
Me.TopMost = False
Else
Me.Activate()
Me.Visible = true
End If

End Sub
<DllImport("user32.dll")> _
Private Shared Function GetForegroundWindow() As IntPtr
End Function

<DllImport("user32.dll")> _
Private Shared Function GetWindowText(ByVal hWnd As IntPtr, ByVal text As StringBuilder, ByVal count As Integer) As Integer
End Function
Feb 2 '10 #9
Well i noticed that the application wasnt always visible for som reason.
So i added a button and made it visible = false and then changed the code below to

The code is now:
Else
Me.Activate()
Me.Visible = true
ToolStripButton3_Click_1(Nothing, Nothing)
End If

Also decreased the timer so one want see the switching beween application and desktop.
Feb 3 '10 #10
esould
1
There is a program (the only one i found) that makes this happen in a really smooth manner. It is a sticky notes utility and you can find it here: http://bradcoweb.com/tim/programs.html. I don't know, however, how he does it. It is for sure, though, that it is a win32 application not a .net one.
Jan 22 '14 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: WebRod | last post by:
Hi, i use Net_POP3 from PEAR to get emails. I realized today that the UIDL associated to an email is not always the same!! That's terrible. I really need to find a way to download only NEW...
3
by: bradwiseathome | last post by:
I have this in my <head> tag: <script type="text/javascript"> function overlay() { document.getElementById("divoverlay").style.visibility = "visible"; } </script> And this in my <body>:
3
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a...
3
by: JavaConvert | last post by:
I would like to create form that simply hold textboxes that I log info to during the execution of a single-thread application. In Java, I found JFrame ideal for the task, but I can't recreate the...
9
by: ad | last post by:
I use the codes below to clear the cookie: HttpCookie myCookie = new HttpCookie("us_id"); myCookie.Expires = DateTime.Now.AddDays(-1d); Response.Cookies.Add(myCookie); It do well when the...
0
by: kjheaney | last post by:
Hi, Im new to all this and i have bluffed my through to designing a few websites, but i now have a problem with a form . I am using Matt Wrights formmail.pl, and i have used dreamweaver to build a...
4
by: active | last post by:
At the statement: FormEdit.ShowDialog() I get the following: Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before...
1
by: Max58kl | last post by:
Hi I am trying to setup a form that automatically sends the form values via email to a specific address. I have uploaded the script, which when I run loads a page with the following error...
5
by: vidishasharma | last post by:
Hi, I have a windows from with few controls over it. Now I have to see if the cursor goes outside the bounds of the windows form then I have to close the form. I added mouse leave for 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...
0
agi2029
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,...
0
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...

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.