I am using the Windows API Code Pack for Microsoft .NET Framework to try out of some of the new UI features of the Win7 taskbar. I am coding in C#.
I have a question regarding jumplists. All of the sample code provided assumes that the entries on the jump list are used to call out to run a particular application or open a document, e.g. a text document in a MRU list or run mspaint.exe.
I would like to implement some items which allow me to set state in my own application (i.e. the app which is interacting with the taskbar). MSN Messenger does this, for example, when you can set your status (Busy, Offline etc.).
Try as I might, I cannot create a JUmpListItem or JumpListLink to behave in this way - it treats them as applications or documents.
Does anyone have any samples of how to create an item which raises an event in the same application that created it? I am sure it is simple but I am being very daft.
Many thanks for your help.
I believe what you'd want to do is to call your application with a special set of flags (i.e. launch the executable with certain arguments). At application start up, you'd check to see what flags are set, then send a message to the main instance of the application and then exit out of the new instance.
Using the TaskBarDemo, to open an item created by your application would have to be referenced, ie if your program created a PDF file you would do this:
jumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "C:\\Program Files\\Adobe\\Reader 9.0\\Reader\\AcroRD32.exe"), "Open Adobe Reader")
{
IconReference = new IconReference(Path.Combine(systemFolder, "C:\\Program Files\\Adobe\\Reader 9.0\\Reader\\AcroRD32.exe"), 0)
});
Otherwise you would have to ensure that your application registered file associations, for recent or frequent items.
I had a few problems with jumplists with the API Pack, i now use VS 2010 Beta 2 and let shell handle the jumplists.
Hope this is helpfull.
These tasks are some sort of IShellLink. Then, you should call ICustomDestinationList's AddUserTasks. Look up samples in Windows 7 Training Kit.
Related
I would like to get list of installed programs as shown in Add/Remove Programs of the control panel using C sharp
I know using SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (32bit) or SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall (64bit) can get program names but how to get its exe file name?
Example MS Word is the program name which the above mentioned registers help me to get but its application file is winword.exe. I need to get this information so that I can start those applications through the code
Edited:
I need to to get the list of installed programs along with their exe information so that when user selects that program name from my application I should be able to trigger that application
Windows Add/Remove does not contain that kind of information.
Let's take Office as an example, you install a whole package, having excel.exe, winword.exe among others.
What you could do, is cross that information with the one available from the Start Menu, where most of the shortcuts are.
Most people don't delete the Start Menu shortcuts, so maybe it is an option.
Another one, would be to read the installation folder and filter out every .exe
Check this for executing lnk: c# memory usage for starting lnk shortcuts
I am trying to open windows 7 help from a .Net form application to a specific bookmark, at printer installation for example.
I tried to open it in the same whay that I open Control Panel applets (Back & Restore in the example below).
ProcessStartInfo startInfo = new ProcessStartInfo(#"c:\windows\system32\control.exe", "/name Microsoft.BackupAndRestore");
startInfo.UseShellExecute = true;
Process.Start(startInfo);
But it doesn't work.
I didn't succeed neither to open the .exe.
Does anyone know how to do this?
IIRC HelpPane.exe works with .h1s files so if you have full path to such a file you can just use for example Process.Start (#"C:\myDir\myhelpfile.h1s"); to open it.
According to MS another option (most likely the recommenced one) is to host the HelpPane (which is basically a COM object!) - for details see http://msdn.microsoft.com/en-us/library/ms728715%28v=VS.85%29.aspx
Other important MSDN links are:
http://msdn.microsoft.com/en-us/library/bb757030.aspx
http://msdn.microsoft.com/en-us/library/ms728718%28v=VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms728713%28v=VS.85%29.aspx
From the above links:
The Help Pane API can only be used to display the Windows Help content
set. It can be customized by OEMs, system builders, and enterprise
customers under license agreement, but cannot be used by third-party
programs. Displaying content that is not part of the Windows Help
content set is not supported.
Depending on what you want to achieve you might need to first sign a license agreement with MS...
EDIT - as per comments:
To display a specific topic you need to call the method DisplayTask of the COM object with the URL of that topic.
EDIT 2 - as per comments the final solution:
Add a reference to C:\Windows\System32\HelpPaneProxy.dll to the project then you can use the HelpPane like this
HxHelpPane pHelpPane = new HxHelpPane();
pHelpPane.DisplayTask("mshelp://windows/?id=e725b43f-94e4-4410-98e7-cc87ab2739aa");
bla.exe (application alias) points to a .net application called wpfapp1.exe.
When i add a key&value to eg. this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\bla.exe
and then start application using Run -> bla.exe it starts
however when i start application using windows search i get an "windows cannot find wpfapp1.exe. make sure you typed the name correctly, and then try again."
I have successfully identified problem: this error only occurs to .net applications while native one start normally (eg. firefox.exe).
So is there any .net config that i've missed during development?
From MSDN:
The App Paths key is not used when
computing the DLL search path.
Maybe you're missing some dependent DLL...
I don't really understand your "points to" or if Windows search is specific to using the explorer search or using the start menu search.
I've had a similar problem with another application that the search could not find at all, neither in Explorer or Start menu (since it did not have an indexed folder to locate it) and solved it with a simple shortcut.
If you can create a shortcut of your application in your start menu or some other indexed folder, like a %PATH% folder, Windows search should be able to pick it up and then you can name your shortcut to whatever you want, for instance bla.exe.
I have a windows mobile 5.0 application (smartphone) that contains a flat data file (CSV), which contains a header row (two doubles), and a list of entries (two doubles, DateTime, and a string).
Occasionally, I need to "sync" the mobile application with a desktop application. The desktop application should read the CSV from the mobile device, and replace it with a new CSV file, based on the contents of the old one.
This seems pretty easy via RAPI (I'm guessing), but I need to ensure that the mobile application is not running. Is there a way to do this?
Mutex? Remote Process Viewer like stuff? File locking?
Thanks for any help you have
Mike
Just use a simple file locking mechanism for the file being read/updated.
Either rename the file before use or create a second 'lock' file which you can check for the existence of.
For whatever reason, the built-in RAPI Functions don't have anything for checking running processes like the ToolHelp API's. With C you could create a set of custom functions in a device library that call the ToolHelp APIs and in turn are called through CeRapiInvoke (which is a generic catch-all entry point for custom RAPI functions). Unfortunately there's no simple mechanism to do this in managed code.
Just thought of an easy way.
Every 3 seconds the program is running, update a registry key with the current datetime.
When I want to sync, check the mobile registry, check it again 5 seconds later. If the values changed, the program is still running.
How to open files from explorer into different tabs. I can associate an open with menu with the file type, now when I already have the program working, how to open the new file into another tab, instead of new program.
How to find the already running process exactly, not with the name and send the filename to it.
Let me make myself clear: I want my app to be single instance, so that when user select 10 text files and press enter key, my application will open all the 10 text files into 10 tabs, instead of creating 10 processes. How to do that? How to communicate between various instances of the same process.
EDIT SOLVED: Implemented the functionality using WM_COPYDATA in C# and the SingleApplication class from codeproject.
I am not quite sure what you mean in this question. Are you trying to open Windows Explorer windows into one window with tabs? If that is the case, then I recommend you look into QT TabBar, which extends Windows Explorer to allow for such behavior.
Or perhaps you are trying to have a link open to a new tab in a web browser. If that is the case, this behavior is defined by the web browser itself. For Internet Explorer 7, you can set this behavior under Tools > Internet Options.
In the General tab, click the Settings button next to the "Tabs" section. You will want to set the "Open links from other programs in:" option to open a new tab.
Keep in mind that this behavior is defined by each user, and you can't ever make any guarantees that they will have the same browser settings as you do.
After reading your comments, I think I understand a bit better. It sounds like you want your application to only allow one instance at a time. Since you tagged this post C#, I will assume that is what you are writing your program in.
Codeproject.com has a great tutorial on how to make your program only allow a single instance.
Here is a snippet of code from their site:
static void Main()
{
if(SingleInstance.SingleApplication.Run() == false)
{
return;
}
//Write your program logic here
}
You would want to write code just before the return statement to have the existing instance open the file in a new tab.
If you are able to provide detailed information about what your program is doing, we might be able to help you with some of the specifics.