How to find Windows Taskbar location and size? [duplicate] - c#

This question already has answers here:
How do I get the taskbar's position and size?
(10 answers)
Closed 9 years ago.
I have created an application that runs in the system tray. When the user single- clicks the try icon, a small form comes up in the bottom right corner of the screen, i.e. right above the system tray. The form is basically "sticky" to the tray.
Here is my question: How do I accomplish the same thing, even if the user has the taskbar docked somewhere else? Like at the top of the screen, or one of the sides?
It shouldn't be hard, since I figure all I have to do is find out where the taskbar is. Is it at the bottom, the top, or one of the sides. But I can't find any documentation anywhere, that explains how to get the location and position of the taskbar.
Any one has any idea about this ?

It's a window, so find it's HWND and then get the window coordinates. The class name you're looking for is "TrayNotifyWnd".

Related

Making a form that marks end of screen [duplicate]

This question already has answers here:
How do you do AppBar docking (to screen edge, like WinAmp) in WPF?
(8 answers)
Closed 7 years ago.
Sorry for the vague title but I wasn't sure how to describe my wish/problem.
A while ago I made a sidebar with a few widgets that I can add.
It displays time, date, windows volume, how many % my phone is charged (once connected), some equalizer bars and song + artist currently playing on Spotify.
At the moment the bar is on the right hand side of my main monitor. What I want is to put it on the left side of my secondary monitor. (not quite relevant)
I would like this sidebar to act as if its the end of the screen.
So if I would maximize an application it would end at the border of my sidebar.
I made a little image to illustrate the goal.
Red is the sidebar and blue is a random application.
Does anyone know if and how this can be achieved?
If anything else is unclear let me know :)
Thanks in advance.
You can use WpfAppBar to add such functionality

How can I get the coordinates of a click on the screen [duplicate]

This question already has answers here:
Getting Position of mouse cursor when clicked out side the form's boundary
(5 answers)
Closed 8 years ago.
i'm trying to automate some actions with a c# bot. The program should work in this way:
a. the user add actions to a list of actions that the bot will use after the setup.
b. for example the user add the "auto-click" action.
c. then the program hide his window to let the user click and get the coordinates.
Now, I know how to hide the program window but I don't know how to manage how to get the coordinates of the screen when the user clicks. do anybody know how to achieve this?
Edit: my question is a bit different from the one posted below, i'm not trying to detect mouse clicks in the main form...
you might be looking for this
How to get mouse pointer position using javascript for internet explorer?
One of the answer conrtains cross browser solution not just IE.

Change cursor while mouse dragging [duplicate]

This question already has answers here:
How can i change the cursor (image) in the whole windows OS
(3 answers)
Closed 7 years ago.
I would like to implement the next construction in .NET in a WPF application.
There is a window, and in it there is a little picture, e.g.: 16×16.
If i move the mouse above the picture, and pressed the left button (without release), the cursor will change to this picture until i release the button.
Between the press and release i would like to drag out this cursor image outside the application window.
How can i implement this feature without modifying system registry values?
Thanks in advance,
Peter
You cannot change the Windows cursor without changing the registry. This has been discussed before: How can i change the cursor (image) in the whole windows OS

C# or C++ frozen pane that shrinks desktop [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How does Microsoft One Note 2010 implement a window that is docked to the desktop?
I was wondering how one would go about making a program (in C# or C++) that would have a frozen pane and shrink the active area of the rest of the screen. A good example of this is the Facebook client chat program in full screen mode because it is always on top as well as shrinks the area of the screen that is active, including shrinking the desktop. What I'm trying to achieve is the green bar in the picture below that can never go away:
(note please ignore the red circle in the photo below, the only picture I could find of what I'm trying to do was from a meme about how on all military sites they have a suicide hotline because the systems are all so slow, they make you want to kill yourself)
It's documented on MSDN as an "AppBar": http://msdn.microsoft.com/en-us/library/windows/desktop/cc144177%28v=vs.85%29.aspx
It's a regular Win32 window anchored to one edge of the screen and also reduces the area for other windows to maximize into.

Prevent window from snapping to screen edges [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do you disable Aero Snap in an application?
Is there a way to prevent a WPF window from snapping to screen edges (i.e. Aero snap)?
I know this can be disabled by the user in the OS, but I want to prevent only my window from getting rearranged.
For example, modal windows do not get snapped like that. I imagine it can be set for a WPF window as well, but I do not know how.
There's no direct way of doing this except you set ResizeMode="NoResize" and implement the resize behavior manually or EXTREME SOLUTION could be (on an application basis) modifying a shortcut to your .exe, on the Compatibility tab, check "Disable desktop composition".

Categories