I am creating a NotifyIcon and then calling this to show a balloon-tip from the system tray:
_trayIcon.ShowBalloonTip(100000, notifierTitle, notifierText, ToolTipIcon.Info);
Everything works fine but I wondered: is there any way to format the text in a system tray tooltip? (In my case, notifierText)
Obviously, I am adding newline characters etc. but I would like certain parts to be bold or italic and maybe even add blue hyperlinked text to separate lines in the tooltip.
I am aware of the events that are available and they don't cover this sort of thing.
I'm sure I've seen it done elsewhere...
So is it possible, and if so, how do I do it??
There's a ever so slight hint that this might be possible if you run on Vista or higher. From the documentation of NOTIFYICONDATA:
When uVersion is set to
NOTIFYICON_VERSION_4, the standard
ToolTip is replaced by the
application-drawn pop-up user
interface (UI)
But with any hints whatsoever how to actually make this work. Googling for +NOTIFYICON_VERSION_4 +ToolTip doesn't produce anything relevant. It also isn't wrapped by the Windows API Code Pack. I'm guessing that it takes listening for callback notifications.
At any rate, you will have to completely replace the NotifyIcon class to make this work. Maybe your google fu can get you a better hit.
Related
I want to make a menubar like window taskbar in C# but I'm wondering how can I make the form stay on the top of the screen and other program will not taped over it just like the window taskbar and when the mouse hover on a icon it will show a form like this:
I have made it like this:
And This is what I want
Windows has a facility for this, allowing you to basically create pseudo-taskbars that dock to the side of the screen and are always visible. It was used by the Office team (possibly publically documented for the Office team?) a long, long time ago to create a desktop toolbar.
Anyway, they are called Application Desktop Toolbars (or "AppBars"), and the documentation is here. To register one, you call the SHAppBarMessage function with the ABM_NEW message. Complete sample code is available in the linked documentation, unfortunately it is in C++.
To use this from a C# application, you will have to P/Invoke. As far as I know, it is not wrapped by the .NET Framework anywhere, probably because it never gets used by anyone anymore. This CodeProject article appears to have the necessary P/Invoke definitions written out. I can't vouch for their correctness, but armed with the documentation and that as an example, you should be able to cook up a working demo.
There is another CodeProject article here, written by Arik Poznanski as part of a series on using shell features from C#. It looks much more thorough, probably more than you need.
Set the property Form.TopMost unless you have other programs creating topmost windows. Doh!
In my extension I'd like to be able to show some text in the VS status bar all the time, so I can't use "alert" part (the leftmost area), since anybody (VS/other extensions) can overwrite it.
It seems that IVsStatusbar doesn't have such a facility, it only has SetText(string) which sets the alert area. However, ReSharper is able to use rightmost area as well, it puts its code inspection info there.
Is there a way either to write to a different area of the status bar, or to hook up into process of setting the text of it (so I could append all the incoming text after my block)?
I had the same requirement which I asked in MSDN Forum. I was told it is not possible through SDK.
I'm trying to make an application that will test some features of an existing app and I wanted it not to be window-size dependent and not to require focusing the window or etc.
I've already figured out how to get window handles for different controls in the tested app so I can click buttons, enter text to textboxes etc. with Send/Post Message but still got a few unsolved problems.
The first is selecting an item from a pop-up menu that can be triggered by button click (TAdvGlowMenuButton class) or right click somewhere- I can't even see any messages related to it in Spy++ so I have no idea how to do it, is it possible to select an item by name? as I don't have it's id
The second thing is clicking next to something, for example 10 pixels to the right of a button.
I have the button handle so I can get it's size and it's parent but I still don't know how to get it's position inside the parent - any ideas?:)
And also a quick one but I don't believe it is possible - can I somehow get position of a label in the tested app? I can't even see it in Spy++ .
I hope you can help me to find it out ;)
Edit: I forgot about the most important thing:P , I'd like to achieve it with Send/Post Message if only it is possible.
My recommendation would be to abandon the message sending/posting model altogether and instead use UI Automation. Automated testing tools is exactly what the UI Automation APIs were designed for, and they are much more capable than SendMessage/PostMessage.
Yes, I realize that this is exactly the opposite of the answer you were looking for. But you will have no end of trouble getting messages to do what you want. A fair number of them rely on the application having the focus, and it is completely reasonable for your code to make this assumption when you receive e.g. a WM_KEYDOWN message. A testing tool should not flag that as a bug.
I notice you've tagged this question with the C# and .NET tags. In that case, you may be interested to learn that the UI Automation APIs have been wrapped in the .NET Framework.
I need to create a window similar to this:
a window similar to the types of dialog boxes that have been included with windows vista.
but I could not find exactly the same dialog boxes. very similar - it's Credential dialog and Input dialog. In the first case there are differences in the UI, in the second - the number of input fields and the absence of label. How can I make exactly the same window? Sorry for bad English.
You want to create a dialog exactly like the first dialog you've shown, the one used by FluffyApp?
You'll have to create it yourself, by hand. It's not a standard Windows dialog; it's a custom dialog resource provided by the FluffyApp application. It's obviously modeled to look a lot like the standard Windows authentication dialog, which is a good idea—users are already familiar with the native UI and will find your application to be much easier to use if it strongly resembles what they're already accustomed to. I recommend that if you decide to create your own custom dialog that you follow Windows's example as well.
But it's not entirely clear why you need your dialog to look exactly like the one that FluffyApp uses. I'm not really even sure why FluffyApp needed to create a custom dialog! It seems like the standard Windows authentication dialog would be perfectly sufficient. They have the same number of input fields, the UI designers at Microsoft have just replaced labels with cue banners. Not anything to worry about.
Those are standard windows dialogs, but instead of letting the dialog manager draw the text, they use DrawThemeText to draw the text, using one of the themed elements (not sure what, because you have several examples). You can play around with the various parameters to DrawThemeText to come up with something that works.
Hey, I am trying to make a program that minimises any program to the system tray instead of normally minimising it. Is this possible? I have been looking around on google but cant find anything.
Icons in the system tray are called "Notification Icons".
To do this to your own application, If your using WinForms you can use the NotifyIcon class to display icons in the system tray. Then all you have to do it set the window to not be displayed in the task bar.
If you're using WPF there isn't a replacement, you still have to use the old WinForms NotifyIcon class, check out this MSDN sample for more information on this.
If you want to hide another app, what you need to do is use API calls to make the changes to the state of the applications window.
You can use FindWindow to get a handle to the window you want to hide, then you can use GetWindowLong to get the windows state. Then you need to remove the WS_EX_APPWINDOW flag from the state and use the SetWindowLong method to apply the new style, this will remove it from the task bar. You can then use the Get/SetWindowState methods to find out the state of the window and hide/minimise it.
You still just need to use the NotifyIcon class to display your own icon in the systray.
Good luck with all of that. It's not something I've tried personally, but I've used all these method calls in other ways. If you haven't done API stuff from C# before you might find you need to do a bit of googling to figure out your DllImports for the version API methods. Shouldn't be anything too hard though.
Crazyd22 has found a codeproject article that uses a slightly different set of API methods but achieves pretty much the same effect. (See comments below.)