How can I execute a search as if it was the search programs and files box in the start menu?
I want to start an application with a partial word search.
To be more specific.
If I put in the word skype.
I want skype to run.
Normally I can do this by entering the word into the search bar in the start menu and pressing enter. But I want to do this though some less obvious means.
Guess you could try opening an exporer with this string search-ms:displayname=Search%20Results&crumb=$$$$SEARCHSTRING$$$$
http://msdn.microsoft.com/en-us/library/h6ak8zt5.aspx to open an explorer.
You could take a look at the Windows API Code Pack. It makes it much easier to integrate a managed application with Window 7/Vista.
If you are asking how to launch an external program from your own C# program, you can do this:
Process launchProcess = new Process();
launchProcess.StartInfo.FileName = "Notepad.exe";
launchProcess.Start();
Here are couple links that get you started on using Windows Search:
Windows Search Overview http://msdn.microsoft.com/en-us/library/aa965362.aspx,
Using Managed Code with Shell Data and Windows Search http://msdn.microsoft.com/en-us/library/bb286799.aspx
Use Windows Vista Search API from a WPF Application http://www.codeproject.com/KB/WPF/Vista_Search_in_WPF.aspx.
Related
First off, I had this idea from the Windows Command Prompt
I mean.. like:
- If you launch it from Win+R or "RUN", it will say "C:/Windows/system32/cmd.exe " in the title
- If you launch it from Cortana or the Search-type of stuff, it will show "Command Prompt" on its title
Anyways, is it possible to extract that kind of information using C#?
EDIT:
To get things straight, Is it possible to extract the "LAUNCH" information of the application? Like, for example, if I launched it from a shortcut, I am able to know the shortcut name, etc.
If you want to find the start path of the current application you can use the following sniped.
Process.GetCurrentProcess().MainModule.FileName
I am building a vb.net application which monitors external process and kills the process based on certain conditions. The application works great with monitoring .exe process but i m unable to use it with control pannel items.
Suppose a user launches programs and features , I want my vb.net app to detect it and kill it. Under task manager the process is shown as explorer.exe.
I can successfully launch programs and features using Process.Start(System.Environment.SystemDirectory + "\appwiz.cpl")
but i cannot kill it this way, can anyone tell me how i could kill this process??
Thanks!
You can use the following:
Process.Start("taskkill.exe /im explorer.exe")
Just replace explorer.exe with the process you wanna stop/kill...
Also works with the PID (Process ID):
Process.Start("taskkill.exe /pid /*yourPID*/")
Do not kill applications until there is other way to exit them.
It is like finishing your day by instantly turning off your computer.
First, at least ask applications to close themselves:
Please see Microsoft article How to use Visual Basic .NET or Visual Basic 2005 to close another application how to implement closing request.
Also please have a look at this Q&A how to prevent application to be uninstalled by a user (w/o admin rights)?.
I want to create a program that won't close when you click the close button but, only when a exit function is run from within the form.I was thinking i could have it run in the background without the window needing to be open (Like the steam client and dropbox, mediafire, google drive, google chrome extension notification), and was wondering how to do that.
I was thinking of some ways to do it but i wasn't sure how to do them:
A starter program that keeps it open in the background
Running a background process that keeps information stored
I am running c# 2010 so i will need answers relating to that. I would also prefer to not use 3rd party extensions/tools except a basic text editor(Notepad++).Thank you in advance!
There are a number of possible options:
Hide the main form
Create a Tray application
Write a Windows Service
My Desktop Application is just a single exe file. For reasons that aren't important, I can't use an installer which would add an icon to the Windows 8 Start screen. Can one be added programatically with C#?
Thanks
If you right click on the exe you can click pin-to start
This worked for my example in the image, which is a stand-alone exe without any sort of installation. It will then appear on the start bar.
Hope this helps.
EDIT: I realized after that you said programmatically.
It looks like a link to the start page is put in C:\Users[UserName]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
So perhaps you could tell it to deposit a short cut there?
EDIT 2 this previous question may also be helpful: Creating application shortcut in a directory. It is in C#
Take a look at the code samples for enabling desktop notifications, a prerequisite of which is the existence of a shortcut installed to the Start screen. The sample is C++ w/COM, but you should be able to incorporate this small bit into a C# app (or rewrite the sample code in C# directly).
is it possible ? any samples/patterns or ideas on how to go about it ?
Update -
this essentially becomes a text browser which displays various tables of information based on various commands on the prompt like typing the url in a browser
now instead of typing various commands like
prompt>command arg1 arg2
if only you could say "click" on the text in a certain "column"/"row" which would execute the command say
prompt>commandX arg1
it'd be somewhat faster/easier
Now, before someone mentions doing a typical browser/asp.net mvc/whatever app, i already have that running but have encountered some limitations esp. with accesing network files. etc. Now that's taken care of using a service-broker service which reads the file etc. but having added numerous extensions to it, it'd be somewhat easier if you could just run the app as a console prompt with a mvc pattern and add extensions to it etc. etc.
if only the text is clickable, it'd make it more friendly for use !!
Assuming no mouse, I would just launch the URL as a new process based on some keyboard trigger.
// this will launch the default browser
ProcessStartInfo psi = new ProcessStartInfo("https://stackoverflow.com");
Process p = new Process(psi);
p.Start();
VB syntax:
// this will launch the default browser
Dim psi = New ProcessStartInfo("https://stackoverflow.com")
Dim p As Process = Process.Start(psi)
The window's shell doesn't support clickable hyperlinks, so no, this isn't possible.
What are you trying to do that warrants the need for hyperlinks in the command shell? Perhaps this application would be better built as a WinForms/WPF or ASP.NET application.
I don't know what a "hyperlink" is for you, but in the context of a Console Application, you can have numbers or letters that you are expecting the user to press
(imagine a simple menu with 3 options)
Press one option
1 - Open ServerFault
2 - Open StackOverflow
3 - Open SuperUser
and in the readline you have a switch that start the IExplorer process for example and opens the webpage.
Is that what you call regarding "hyperlinks in a console application"?
For an idea of what it can look like, get your hands on a copy of links. It's a text-mode web browser that works just fine in several operating systems.
you can access the mouse from the console, if you wish to have clickable elements in your console application. you'll have to build the logic yourself of course for the clickable areas.
http://cboard.cprogramming.com/windows-programming/38680-win32-console-app-mouse-input.html