I use a notify icon to create a small program. Unfortunately, it only appears after pressing the small arrow in the bottom right corner of the taskbar. Is there a way to display it on the first line?
The positioning of the notify icon in windows can be determined by the user. You can just move the icon with drag & drop into the taskbar and it should automatically reappear in the taskbar, if you restart your application.
You can drag and drop these icons yourself (i.e. you can drag the icon to the always visible portion and it will stay there).
If you're asking how to do this programmatically, I'm not sure of a way to do so. According to this answer on superuser it looks like you can update a registry key to rearrange these, but proceed with caution.
Related
TLDR: How to programmatically hide the mouse cursor for entire desktop no matter the application that has focus?
Even though I have "Hide pointer while typing" enabled in Windows Mouse Options, it doesn't work for most windows. It only seems to work on windows that use the standard Windows text box control (such as notepad.exe). Everywhere else, the cursor stays right on top of whatever I'm typing.
I want to programmatically hide the mouse cursor across the entire desktop no matter what application has focus, when I execute a specific action (for example, a hotkey is pressed). Then, when the mouse is moved, I want the cursor to reappear.
I can handle the hotkey etc. I just need to know how to hide the cursor.
What I have tried:
Cursor.Hide method only hides cursor for the current form. This is not an acceptable solution.
Windows API ShowCursor function - just doesn't seem to work at all... the cursor never disappears.
Currently my workaround is to listen for the Spacebar to be pressed (implies I'm typing more than a few characters), then move the mouse cursor to the top corner of the desktop, out of the way. However, this is not an ideal solution as it requires the mouse to be moved a lot to return to the original position, as well as messing up mouse position in apps such as Sketchup when entering dimensions containing spaces. I would prefer that the cursor simply become invisible in its current location, then reappear at the same location when moving the mouse, as it is supposed to work with the "Hide pointer when typing" option.
I'm not tied to C# but it's just easy to compile into an executable for Windows, which I can launch on Windows startup.
Thank you for any help!
I'm using Cursor.Current to change the cursor icon to my own custom bitmap when I'm doing a drag-and-drop operation. This works fine except for the fact that when I move the cursor over some external windows as I'm dragging the icon is changed to the disabled icon (circle with a cross through it). I need to be able to maintain my custom bitmap as the icon during this drag-and-drop operation regardless of which window I drag it over.
How can I get my cursor to remain my custom bitmap regardless of which external window the mouse is hovering over?
Your application is the sender in the drag/drop communication. The object is being dragged from your application and dropped on the other application. That means that your application has no say in the state of the cursor when it is over a potential drop target. Drag and drop is a cooperative process. The target has to consent to having something dropped on it. If the target doesn't want your object to be dropped on it, the system will let the user know by means of the cursor.
All this means that drag and drop is the wrong way to implement the UI that you desire. You need to stop using drag and drop. Instead you need to capture the mouse and paint your icon on the screen whilst the user is "dragging" it. Your requirement seems to be to implement something akin to the Spy++ window finder. This article shows how to do it: Code Project, MS Spy++ style Window Finder.
I'm making my own draggable controls similar to tabs in Visual Studio. Default system drag and drop cannot achieve the effect, so I just handle control's MouseDown, MouseMove and MouseUp events. The effect works as charm, but it would be perfect if I could change the cursor while dragging the control, but it is NOT windows drag drop operation. I don't have DragEffect available.
Is it completely impossible?
BTW, I don't use windows drag and drop because I need my control to be dropped both on another display's desktop area or another control of my application. Try to drag Visual Studio tab to see the effect. Mine works exactly the same. I mean while dragging Visual Studio tab the cursor doesn't change. I repeat the question: is it impossible to change it to a drag cursor?
I just need system drag cursors data and set system cursor to one of them. I suppose it could be done via pinvoke somehow, but it beats me how. I don't want to set external bitmap as cursor, it has to be real, original drag cursor. It's a challenge :)
is it possible to change the cursor even when the cursor is at outside of the form?
I used MouseHook by using Win32 API to capture the location of the Cursor when it is outside the form. However, I cannot change the cursor...
Programs decide what the cursor should look like. Most windows ask for the default arrow. But, say, a text box control asks for an I-Beam. A hyperlink control asks for the hand. Etcetera. And if you hover over a window edge of a resizable window then the program asks for one of the resizing cursors. Or a program goes off doing something for a while and asks for the hourglass cursor. Etcetera.
Replacing the cursor is thus fraught with trouble, you cannot make correct cursor choices for another program you know nothing about.
You can technically pinvoke SetSystemCursor() to replace one of the system cursors. But that's very troublesome as well, you won't restore it properly when your program bombs. A reboot is required to fix the problem. Also very detrimental to a user with visual impairments, you'll replace the Extra Large cursors she selected with a puny one.
This needs to be a user selection, they go Control Panel + Mouse to select cursors.
Maybe you should with try the events MouseEnter and MouseLeave
I'm writing a system tray app for Windows (with much info gleaned from this thread). I have the ContextMenu working - you can right click and execute functions that way.
I want to have a modern, rich interface pop up on a left click, however, much like most of the built in Windows 7 (and possibly Vista) tray icons have. By this I refer to the Aero lining, and apparent ability to add seemingly arbitrary controls (e.g. volume slider, network chooser).
I'm not really sure where to start. Is it a matter of creating a "normal" window and restricting it heavily? If so, how? (If it comes down to Windows Forms vs. WPF, the latter is preferable).
For what it's worth, you can display anything you like when you receive the mouse click on your notification icon. Usually it's a pop-up menu, but you could show a window instead.