Associate .txt files with VB.NET Program - vb.net

I created a super basic text editor which can read .txt files. I would like to know how I can set my basic text editor to the default .txt file extension so whenever the user clicks on a .txt file, at first it will show the "default program" window. If the user clicks on my program then the text files will be always opened using my program. How can this be done?

It depends on your version of windows, but in Windows 7/Vista you can click Start->Default programs
http://windows.microsoft.com/en-us/windows/change-default-programs#1TC=windows-7
In Windows XP it's a little more difficult:
Go to the Start menu and select All Programs.
Select Set Program Access and Defaults.
To select an option, click on the radio button beside it.
If you need to expand the option, click on the double arrows for that option on the right side of the window.
http://support.microsoft.com/kb/332003
If you want to do this programatically, you have to edit some registry settings. See here: http://msdn.microsoft.com/en-us/library/windows/desktop/cc144154%28v=vs.85%29.aspx

Related

How do I open a file with a specific application rather than its default application?

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.

In Intellij IDEA how to compare 2 text files that are not part of an open project

I would like to compare 2 files in intellij. Both files are not part of a specific project.
Is there a way to do so?
I am running Intellij 15 and 16.
The following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:
Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
In the view menu, choose "Compare With…"
In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).
It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.
You can use the "compare with clipboard" feature.
From https://www.jetbrains.com/help/idea/2016.1/comparing-files.html#clipboard:
Comparing a File in the Editor with the Clipboard Contents
Open the desired file in the editor.
Right-click the editor pane and
choose Compare with Clipboard on the context menu.
View and manage
differences in the Differences Viewer for Files.
You can use intellij to compare 2 files/clipboard/blank text etc
Use command Shift+Command+A to search Actions
Type "Open Blank Diff Window" to compare random text
type diff for all diff options.
I use this on the command line (with IntelliJ IDEA CE on a Mac):
/Applications/IntelliJ\ IDEA\ CE.app/Contents/MacOS/idea diff ~/Junk/file1.txt ~/Junk/file2.txt
Window > Editor Tabs > Split Vertically
Is that what you're looking for? It's what I was looking for.
Worked for me on Mac OS High Sierra + IntelliJ IDEA 2018.3
- File -> Open
- Select file 1
- View -> Compare with ...
- Select file 2
To use intelli's difference comparison between 2 different files, you can use the Compare With (Right click the file in Project window). There is also an option to Compare File in Editor. To use that option, ensure one file is open and selected, then right click the 2nd file, clicking Compare File in Editor

How do you configure IntelliJ IDEA to place the cursor in the editor window after hitting enter on a file in the project window?

I'm big on not using the mouse, especially while writing code. I've noticed in IntelliJ IDEA 2016.1 that when I'm navigating in the project window, hitting Enter while a particular file is selected opens the file in an editor, but it doesn't place the cursor in the editor. Interestingly, if I double-click on the file in the project window, the cursor is placed in the editor.
How do I configure IntelliJ to place the cursor in the editor after opening the file via Enter from the project window?
To the best of my knowledge, I do not believe there is a way to configure what you are looking for. A search for focus in the settings didn't turn up anything.
That said, hitting Esc when in the project view will return you to the editor. So you would need to do Enter, Esc. If having to type two keys in a row bothers you, you could always record a macro (Edit > Macros) to do that key sequence and map it to a shortcut.

Highlight file opens up file in a preview window functionality instead of double click

Coming from a Visual Studio environment and Xcode environment, if you highlight a file on the project window (LHS), the file opens. IntelliJ doesn't open a file until you double click it.
It's kind of a different feel since it opens it up in a new tab each time vs just using the last active window or a preview window to flip between files. Is there a way to make it more like VS or Xcode that where highlighting the file actually opens the file in the current window?
There is Autoscroll to Source option in the project view settings. Unfortunately it doesn't open the focused files in the current tab, but in new tabs.
I haven't found an option to change this behavior anywhere, but there is already a feature request on IntelliJ's YouTrack asking for this, so feel free to vote for it :)

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.