A Simple application that can run in windows task bar - c#

I want to write a very simple application, containing a pop-up menu when user click on it, that will appear in windows task bar, exactly like language bar, this is the only need. it does not concatin any more functionality at the time being.
Does anybody know where to start or do you have any sample code for it. I really do not know where to start since I am a Newbie!
Thanks in advance

Try having a look at the NotifyIcon class.

You are looking for ITrayDeskBand but good luck with getting anything out of the MSDN documentation.
I suggest a web search for ITrayDeskBand and looking at the top hits that aren't on MSDN!
For example, this from the Code Project looks useful. Note that since this is a shell extension, most of the code you find will be native because .NET shell extensions are somewhat frowned upon.

You need to develop a ToolBand for this.
You can either develop one yourself or use a library like EZShellExtensions.

Related

Extending Task Manager Windows 8

I would like to know if there is any way to extend the task manager in a language like C# preferably but i'm also ok with C++, or anything else that works.
I would like to add some new features like, search, kill all processes with the same name, and what ever else comes to mind, but i have no idea were to start.
Note: I don't want to replace it or rewrite it from scratch, just add some new features.
I also found this link Is it possible to add functionality to Vista/7 taskmgr.exe? but it's for VIsta/7 i'm just hoping something change in 8, considering that it was completely redesigned.
Thank you
If i am correct, what you want to know is if there is a way to extend TaskManager via a plugin based approach( like Office/Ie/Outlook plugins).
The answer is no.
I however have a different approach which may help you do what you want but would be a lot more work.
What i suggest is Com interop based injection and override.
using Spy++ you can see what are the window classes/properties of the TaskManager window. Then you would need to write a program which works minimized(system tray?!) and watches for some identifying window/class name to pop up in the messages system. Windows messages can be intercepted and hooked. http://www.codeproject.com/Articles/33459/Spying-Window-Messages-from-the-Inside may be of some help.
Once you get your window handle. you will probably need to find the tabs control group. and inject a new tab element. Post which you can put anything which you deem into the tab element.
This is speculative, and involves the assumption that all the new changes you want to add would end up in a new tab.
I hope this helps you in some way.
PS: The answer is not totally speculative though. For some internal use at my workplace, I had made a prototype which would do something similar to outlook and override some default functionality which wasn't exposed by the Add in framework per se. Beware that this would require lots of testing and was somewhat unreliable/unstable

Can we inject our code to another sub process?

Is it possible to inject the code into another sub process? Let's say we have Silverlight plugin in the browser.. We want to inject our code (something like Snoop) into that plugin's process. When I'm using Spy++, I can receive the event from the plugin.. SO, I'm assuming that it is possible to inject the code as well..
Thanks in advance.
Edit: I'm currently looking at the code of Snoop and this article http://www.codeproject.com/KB/threads/winspy.aspx.. I understand that we can inject our code into other process.. My question is how to hook to other "sub" process..
Please take a look at this screenshot.. I'm trying to hook into "Microsoft SIlverlight" (Red arrow) but it doesn't work.. It would be great if you guys can share me some code example for hooking sub-process.. Thanks..
It's not quite "injection", but SetWindowsHookEx is pretty useful.
If you really need injection, take a look at what Process Hacker does.
Yes, it is possible to hook to other process.
For more information read the chapter 22 from the book “Programming Applications for Microsoft
Windows” by Jeffrey Richter. It contains different ways of hooking. I think this may help you.
API’s like SetWindowsHookEx(),CreateRemoteThread() ect will help you to hook to other process.
Windows doesn't have 'sub-processes,' but processes can have child processes. If child processes couldn't be hooked, you wouldn't be able to hook most running applications as they're child processes of explorer. Spy++ is showing you child windows, not processes. If you want to hook only input on a particular window you'll need to filter based on the active control.
Note: You're in Spy++ windows view, you can switch to processes view with the gears button.

C# app that uses Notepad

I want to write an application (C# would be best, other are also welcome) that works in the background in Windows/Linux, but is able to put characters in inputs and textareas of currently active window, in applications like Notepad, Browser URL Address and so on. How is this possible?
Take a look at the SendKeys class. This should handle your situation.
Edit: If you want a Java solution, take a look at the Robot class.

how to Make a program intangable with c#?

I just wanted to know, if there is someway to make a program (or part of a program) intangable with c#. I want to make it so that people can see the program is there, but if they were to click, it would click whatever is underneath it. I would also like to know if you can do that backwords. Is there someway to make an item that is invisable, clickable?
Thank you for your help!
To your vague question, I offer a vague response:
Sounds like your option one is possible. You would need to send the click event (message) that you receive to the appropriate window (the one underneath yours). I suspect that you would have to DllImport some stuff to do this from c#.
Your option two, while more difficult, is probably also possible because you can inject code into other running executables. This will be a privileged operation, and you will likely again have to use stuff from non .NET dlls to do it from c#. See Three Ways to Inject Your Code into Another Process on CodeProject.
If you want to display something to a user without it getting in the way of whatever it was they were doing at the time you could pop up your messages in bubble from the task bar perhaps?
The answer to this question covers this. Or if you're lazy here's the code project link.
Ok so it sometimes might be necessary to show something on screen and not let it be clickable (like On-Screen-Display for video playback to show volume increase, etc..)
Here's an example of how to this in C# - from codeproject: http://www.codeproject.com/KB/cs/OSDwindow.aspx
This uses the Win32 API ShowWindow(hWnd, SW_SHOWNOACTIVATE) to present the window without losing focus (can't be selected).
And here's the MSDN page for this call ShowWindow
To display a window that is invisible but clickable you can use a window with no border (FormBorderStyle=None) and set transparency to 1%.
Hope that helps!

C# Making a Frontend to a Console Program?

I wrote a console program in c# that takes up to three files as input, and does some data calculations on them.
I'd like to make a simple frontend that allows the user to easily
import files - basically choose up to three files to be routed to the backend code
change settings - I have about 10 settings that I'm currently storing in an app.config file. maybe a simple settings box would be nice
see what's going on - the console program shows some status messages that might be useful to display on a GUI
I have practically no experience with windows forms or GUI design, so I really don't know where to begin. I compiled the backend stuff into a *.dll and am currently playing around in design mode of sharpdevelop...but i really have no idea how to get the two to work together.
any pointers would be greatly appreciated!
The usual pattern, in cases like these, is to make the main features of the application into a class library and call that from a wrapping executable, such as a console app, winforms app or webforms app (if possible). That way you can easily adapt the interface as needed and simply route input and output to and from the class library.
Edit: I realize this isn't a very indepth answer, but I hope it helps to get started at least, together with any other answer that may arrive.
If you want to get started with GUI design in .NET, I recommend you choose WPF (Windows Presentation Foundation). This is the latest technology released in the UI/graphics area by Microsoft and is where everything is heading now. (Windows Forms won't be obsolete for a long time, though it is surely but slowly becoming deprecated.) I noticed however that you are using SharpDevelop, which doesn't yet have real support for WPF (as far as I know), whereas it certainly does for WinForms. If there's any chance you can use Visual Studio, I recommend you begin by learning WPF. You have the advantage of not being confused by previous experience with the styles and methodologies of WinForms, so it would very much be the right way to go.
Whichever you wish to learn, the Getting Started page of WindowsClient.NET (the official MS site for both WinForms and WPF) would be a great resource. There's also a few MSDN articles on getting started with WPF.
Hope that helps.
Have you tried Visual Studio Express editions? They're free and come with a designer for either WinForms or WPF applications.
As a first pass you'll need 3 text areas for the filenames, with associated buttons to bring up the file open dialog (it doesn't actually open the file just returns the filename).
A label to display the status - updated from your worker code.
Then either the various radio buttons, check boxes etc for your configuration settings.
Oh and don't forget the "Start" button to set off your process.
If your process takes a while you ought to use a background worker thread. You can then implement a "Cancel" button to safely abort the process and tidy up if it goes wrong.
There will be optimisations and reorganisations that you can do once you've got it working.
Your question is quite indistinct. If you're asking about working with GUI, you should read some book on Windows Forms.
And if you're asking about how to put your dll in your new windows forms application, then you should just add a reference to it in winforms project's properties and then use classes from dll's namespace.

Categories