How do I open a file with a specific application rather than its default application? - vb.net

I am trying to open files using a specified executable; just like as if you were to right mouse click on a file then scroll to "Open with"
I tried what kaymaf said and reviewed the docs, but I cannot seem to get this to work.
Dim FI As New FileInfo(GetFileNameFromListViewItem(ListViewCollection.SelectedItems(0)))
Dim GetExif As Process = System.Diagnostics.Process.Start("C:\Users\*username*\Downloads\exiftool.exe", FI.FullName)
This just ends up open the executable and rather than opening the file with the executable.

You would like to open a file with your program using the Windows context menu; and do you want to get an entry in that menu? If that is not correct, the answer can be deleted.
I found this in a German forum, and they refer to this site:
This is the translated text:
One possibility would be that you register your file extension and your program in the system to open this file extension. As soon as the system knows everything, you only need to right-click on the file(s) and in the context menu, in addition to the standard entries, another menu item for opening these files is displayed. If you select this menu item, your program will start automatically if it has not yet started, and you can read out / determine the path to this file or several files in your program and process it accordingly. How it all works is described here: ookii.org/Blog/opening_files_via_idroptarget_in_net
On this page there is also a sample for download (start text files with your own program via an additional entry in the context menu / display paths to the files). It is not a VB, but it should be translatable without any problems. Corresponding information on the page and the comments should be observed.

Related

Features and Events in FileChooserWidget GTK#

I'm using GTK#(Newbie) on Xamarin Studio Community version 6.3, on Windows.
Recently, I was trying to build a Total Commander application. During the construction, I used the File Chooser Widget and found some issue that I can't solve:
1- When I click on a folder in Places box, a few buttons will appear: \ <icon button with a pen and a paper> enter image description here. When I click on the Icon Button, a Location Entry will show up. However, I don't know how to use that entry like opening a folder, folder path will show up on Location entry or enter folder path, folder will open on the widget. My temporary solution is create a entry:
FileChooserWidget fcw1 = new global::Gtk.FileChooserWidget(((global::Gtk.FileChooserAction)(0)));
Entry e1 = new Entry();
e1.Text = fcw1.CurrentFolder;
I hope to find the way to capture that Location Entry and use it.
2- On the workplace I have a problem in open a file by using Double-Click Event. My code:
[GLib.ConnectBefore]
protected void OnFcw1ButtonPressEvent(object o, ButtonPressEventArgs args)
{
if (((Gdk.EventButton)args.Event).Type == Gdk.EventType.TwoButtonPress)
{
entry1.Text = fcw1.Filename;
if (File.Exists(fcw1.Filename))
Process.Start(fcw1.Filename);
}
}
3- The same problem of find The use of the Search and Recently Used that Could not start the search process
The program was not able to create a connection to the indexer daemon. Please make sure it is running.
Please help me find the solution and teach me how to find the name of all these widgets. Thank you very much!
To answer #1 there's a Action property on the FileChooser widget which will allow you to set it up for what you want it to do (Open, Create, Select Folder etc). The Location field contains the filename (that you select if browsing, or can type in if creating a new file).
On #2, default behaviour for double-clicks on FCW is to drill-through on folders and select for files. Because you've got a Glib.ConnectBefore attribute your event handler will run before the default handler. Maybe whatever problem you have in #2 is related to the handlers?
On #3 sounds like an issue on your dev machine. The FCW will allow you to search the file system so long as it can connect to the daemon so it looks like that's not running. I've not had an issue with that in Windows, Mac OSX, Ubuntu or RHEL on other machines.

how to implement openwith in winrt xaml

i am working on pdf viewer kind app in winrt.
it is almost done .but i want to add a feature that
when user RIGHT click on any pdf File in win32 there should be an option to open with my reader. can any one please tell me how to achive this
You need to enable your application to handle the pdf file type. You can do this by double-clicking on the application manifest file in Visual Studio. In the Declarations tab, add a new File Type Association. Then fill in the fields for the file association.
For example, the following adds an association for the ".myfile" extension:
The other thing that needs to be done is that you must in code handle the OnFileActivated event handler. This will be called whenever the end user opens a file with the associated extension from Explorer.
Note that for the file association to work, your application must be run at least once.
See the following link for more info on associating a file type: How to handle file activation

How to Run Ada Code in GPS

In GNAT Programming Studio, how do you run the program? I see it compiled successfully, but I do not see where my program has started running. I would like to test it.
First, you have to select your Main procedure in the project properties (see the "main files" tab). You can actually choose multiple files for multiple executables.
Next, you have to build it - either by pressing F4 for the first Main File in the list, or by choosing it in the Build->Project submenu, or by choosing "build all" in the Build->Project submenu (or use the toolbar for the menu entries).
Last, you can choose, which of your Main Files to run by choosing it in the Build->Run menu, or by pressing shift+F2 for the first file in the list. Enter the parameters in the dialog and press OK.
There should be a new Tab next to the Messages panel, where all output is placed, and you can use it for input, too. You could choose to use an external terminal in the run dialog.
If you want to debug it, have a look at the Debug menu. Read the documentation for more information.
Last, you can choose, which of your Main Files to run by choosing it in the Build->Run menu, or by pressing shift+F2 for the first file in the list. Enter the parameters in the dialog and press OK.
Whatever I enter here, e.g. either the name of the project, Primes_Count or the name of what I see to be the 'executable', Primes_Count.o, it just does not run.
And I get this message output on the Messages window :
Could not locate executable on path: Primes_Count.o
I don't see why Ada is making such a big deal out of the Run step.
If there is another stage between making the .o file and a finished Ada executable, then surely it is something that the GPS system can take care of itself . . .
December.
OK now, sorted. The GPS panel governing this [ Project menu > Edit Proj Props > Main Files tab ] setting was blacked out until clicked.
Running available now and working well.
it is Project->Properties-> Main Files add your file to run. This will sort out the issue.

VB.NET call desktop application from 2 shortcuts - supply different parameters

I have a desktop application which reads files from a specified folder, then deposits the files to a folder in a third party document management system based on criteria that the user provides.
My question is:
is it possible to somehow provide different parameters to the code, depending on which shortcut of the application the user clicked on to start it up?
You can add command line parameters to a shortcut icon. Here's how you can do it in Windows:
On the Start Menu, navigate to Notepad.
Right click on Notepad and choose Send To > Desktop (Create Shortcut)
Right click on the newly-created desktop icon and choose Properties
Add your command line parameters to the Target text box.
For example, if you want notepad to open up the hosts file, this would be the content of Target property:
%SystemRoot%\system32\notepad.exe "C:\WINDOWS\system32\drivers\etc\hosts"
You can put pretty much anything into the Target property of a shortcut that you would put into a command line.
Yes.
The easiest way would be to have the shortcut pass those parameters in via the command line.
You could also use conditional compilation variables, and have 2 different .exes. You should be able to find samples of both approaches (command line and conditional compilation variable) in help.

Application crashes when calling embedded resources

I'm writing a console application in Visual Basic 2008 Express.
I added several text files to my project as resources. Specifically...
I went to my project's "Properties" page and selected the "Resources" tab.
I clicked the "Add Resource" dropdown and chose "Add New Text File".
I entered some simple text and saved the file as "Welcome.txt".
I built the entire solution.
In my code, I use console.writeline(My.Resources.Welcome) to display the text.
If I run my code through the IDE, it works fine.
If I run the EXE that's in the /bin/release folder, the app crashes.
My system logs show the error as "System.IO.FileLoadException".
I have tried setting the properties on the embedded text file to "Embedded Resource", but the result is the same.
Has anyone encountered this issue? Thank you in advance.
Copy Welcome.txt to your bin\release folder.
OR
To make Welcome.txt an embedded resource, right-click either the text file or the bitmap, and then select Properties.
In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource.