Set Application name in Task Manager's Applications Tab - c#

I have a WinForms application written in C# for .NET 3.5 that needs to show a specific name in the Task Manager's Applications tab. However, I need for this text to be different from the Form's text.
The behavior I've seen so far is that the Task Manager Applications tab will show the value of the Text property of the System.Windows.Forms.Form being displayed. However, I'd like to display the long name of the application in the Form.Text property, and use an abbreviated name in the Task Manager's Applications tab.
I know this behavior was supported in VB6, where the Application Title (Set through Project Properties -> Make tab -> Application Title field, or in the .VBP file itself) would be the name displayed in the Applications tab. Is there a way to replicate this functionality in C#/.NET?
This bit of information from MSDN seems to indicate that the Text property is the only source in .NET: App Object for Visual Basic 6.0 Users. However, I'd like to know if there's a way around this.

VB6.0 forms applications used a hidden "parking window" as the true main window of the application. This is how it allowed the task manager name to differ from the main window name. In .Net applications the main window is the true main window of the application.
You could replicate the behavior by starting a hidden form which calls your displayable form but I don't recommend it since you risk getting your application into a state where there is no visible UI but the process is still running.

Related

How to add my custom menu commad to installed applications in windows 7 and above

Actually, I created a simple app in C# which creates a snapshot of the screen and upload to One Drive automatically. But the problem is I need to open my application when i want to do the operation. So, to minimize the effort and enhance the accessibility, am trying to add an extra menu option to the context menu of title bar of all the installed applications. Is there any method to do the same. Please suggest.
Expected UI

How to read and change text in a TextBox control in another process in a .NET application?

I need the following for a specific corporate application that we use in our office. The goal is to create something similar to what password managers do with forms in a web browser -- fill out the login credentials automatically. I need it only for this specific application.
When the application loads, it shows a login window:
My goal is to read Corp Code, Location Code and User Name & fill out the Password accordingly from my application that I'm writing.
I do not have the source code for the corporate application in question. I know that it is a .NET 4.0 process:
From Windows Spy++ I can see what those text boxes are:
So they have this WindowsForms10.EDIT.app.* class name, where * I believe can be changed from build to build:
My first instinct was to use native EnumWindows API with conjunction with GetClassName and GetWindowText to locate those text boxes and get their text, but the issue is telling them apart.
So I was hoping that their Control ID properties could be used for that:
but unfortunately their Control ID value seems to change every time the application runs.
So my only hope in this case is to identify these TextBox controls by their name, natively like .NET does:
Is there a way to do it from another .NET process?
I do not believe it is possible to expose the .NET names of the textboxes that way. You are going down the correct path with p/invoking the EnumWindows, GetClassName, etc.
You might have luck checking the Z-Order of the child windows, which would be the effective tab order, which is probably consistent for each run.

Choose text appearing in taskbar

I have a c# application and have thought it could be fancy that it displayed current time. So I used form.text property of my main form and put the time into it (picture A)
Unfortunately when I point to the application icon in taskbar in Windows 7 it shows my time where it should show application name (picture B)
Is it possible to have some text on main form top bar and still display different text in Windows taskbar?
In .NET 4 the TaskbarItemInfo class was introduced. Unfortunately it does not directly support changing the application title show in the taskbar.
However, you might be able to achieve this using the Windows API Code Pack library. Yochay Kiriaty wrote an article called Developing for the Windows 7 Taskbar – Application ID which shows an example of what you might be trying to achieve.

How do I launch a window from an already running WPF system-tray application?

I have a WPF application that runs in the system-tray & monitors HTTP activity.
When I right-click my system tray icon, I can launch a "Control Panel" from a context menu command.
However, when a user goes to StartMenu\Programs\MYAPPLICATION and clicks on menu item called "Control Panel" I would like to fire a method that displays the control panel (just a regular WPF Window),
How can I achieve this?
On application launch you could check if there is another instance running. Then via interprocess communication of your choice (e.g. WCF, named pipes, .NET remoting, a drop file, etc) you could instruct the original instance (via whatever means the chosen communication method provides) to show the required window.

Hosting WPF/Surface application within WPF/Surface application

I am trying to create a parent WPF/surface application which will host multiple WPF/surface applications. I am looking for some pointers of how to implement such functionality. Was reading http://msdn.microsoft.com/en-us/library/ms742522.aspx but it talks about hosting Win32 content in WPF and vice versa.
My idea is to have something similar to MDI forms where you have a main form and you can instantiate multiple child forms.
In my case, these would be different applications which will be launched using a config file and loaded within the main application.
Also, since is there a way to ensure that the main window's process memory is not hogged by the child process initiated.
Edit:
The host application will launch different applications based on what user selects. One can say its like an application launcher which are build on WPF/Surface touch SDK. Now once the application is launched the launcher goes in the background(except showing small button to bring it forward again at some point later) and when the user ends the current application launcher comes back again in foreground. The only interaction i feel which is necessary is knowing the launched application is terminated or invoking applications in a limited screen area. If someone has seen the Microsoft surface application launcher, even when the application is launched there are corner buttons which bring the app launcher to foreground.
I would first look at using Microsoft Prism, specifically the Modularity namespace.
Except for the "different applications" part, it sounds like a classic case for MVVM. Are these "different applications" actually separate applications, or could they simply be separate projects within the same application? That may simplify the choice of presentation.
I suppose you could still have a View called "Host" that presents a different app.
Of course, WPF doesn't have the concept of MDI, but you can open multiple, non-modal windows.
It really depends on what you mean by "hosting". Does the main window need to somehow handle and/or interact with the other applications, or is it just a launching pad for other applications?
I followed this approach to solve this problem. The launcher was not hosting the application within itself but would launch a new application and hide itself.
Steps I followed:
The main launcher application will run in Kiosk mode i.e always on top/no option to close by capturing the close event/No instance shown in taskbar/no title bar/killing the explorer.exe/hiding the taskbar.
The launcher populates a horizontal listbox (data templated for UI) which lets occupied main center area of screen and can be scrolled either ways.
When user selected an item on listbox, click/tap event a separate process is launched with launcher window's visibility set to hidden and a small button(basically a window with just a button inside and size set to height/width of button) created on the either corner of the screen with always on top option.
The functionality of button is to minimize the current working application and set visibility of launcher back to visible and setting the focus to this window.
Since the process is launched by launcher, i trap the close event for the launched window to know user ended the application and then again pop up the launcher back.

Categories

Resources