Post by Gaurav Mall on Jul 7, 2016 15:56:22 GMT 10
Hey! My name is Gaurav Mall and I am 10 years old.I am making an advanced media player in vb.It is complete but there is one thing I want to put in That is :
When you right click on a video and go to the open with section you see right there a list of media players.What I want to do is that when the Media Player is installed it goes to the open with section in the right click menu and also when I open a video with my player it plays the video.
Gaurav ---------- Mall
|
|
Post by Nathan Lecompte on Jul 7, 2016 21:36:43 GMT 10
|
|
Post by Gaurav Mall on Jul 7, 2016 23:31:27 GMT 10
Thanks Nathan!I really appreciate it...And I will use clear titles from now and on!
Gaurav ---------- Mall
|
|
Post by Gaurav Mall on Jul 10, 2016 3:34:08 GMT 10
Actually Nathan after a lot of researching I didn't found any resource which followed my rules.You know I don't want file association only,I also want my app to be shown in the open with section.I tried to tweak the registry but nothing seems to work properly.I tried to use the method you gave me but it didn't work again.I also tried finding other resources such as Sharp Shell.The problem with all of these is there are written in C# and not in VB.But if I use them in C# they didn't work too.I get no Errors but some things are impossible to done.Can you suggest me a better way of using File Association? I did little research on the File Association located in the Publish Tab in the my project window.Thanks if you can do something about this problem!
Gaurav ---------- Mall
|
|
Post by Nathan Lecompte on Jul 10, 2016 11:36:05 GMT 10
Hey Gaurav Mall, Sorry you couldn't find what you were looking for, I am aware that a lot of the resources related to file association are in C#; it's a very popular language, and most people would rather use C# than VB.NET to create programs (which explains why most, if not all, of the file association stuff is in C#). You could try translating/converting a C# version of the resource to VB.NET, there are a lot of similarities between the two languages; so it shouldn't be too difficult; you can always use an online converter for certain parts that don't make sense (however it's not recommended to rely solely on the converter, there'll always be some errors). Here's one: converter.telerik.com
|
|
Post by Gaurav Mall on Jul 10, 2016 17:39:44 GMT 10
I used that converter when I was working with sharp shell.I wanted to use sharp shell because you can also work with it in vb.The code was C#,so I searched for a converter.And I found what you gave me.I translated all the code and followed the steps but It didn't work.I also now discovered that you can associate you application when you deploy Install shield Setup into your app.I didn't found any resources on it.Can you tell me some info?
Gaurav ---------- Mall
|
|
Post by Gaurav Mall on Jul 15, 2016 5:53:16 GMT 10
The Code is : <ComVisible(True)> _ <COMServerAssociation(AssociationType.ClassOfExtension, ".txt")> _ Public Class CountLinesExtension Inherits SharpContextMenu
Protected Overrides Function CanShowMenu() As Boolean ' We always show the menu. Return True End Function
Protected Overrides Function CreateMenu() As ContextMenuStrip ' Create the menu strip. Dim menu = New ContextMenuStrip()
' Create a 'count lines' item. Dim itemCountLines = New ToolStripMenuItem() With { _ Key .Text = "Count Lines...", _ Key .Image = Properties.Resources.CountLines _ }
itemCountLines.Click += Function(sender, args) CountLines()
menu.Items.Add(itemCountLines)
Return menu End Function
Private Sub CountLines() Dim builder = New StringBuilder()
For Each filePath As var In SelectedItemPaths builder.AppendLine(String.Format("{0} - {1} Lines", Path.GetFileName(filePath), File.ReadAllLines(filePath).Length)) Next
MessageBox.Show(builder.ToString()) End Sub End Class
Gaurav ---------- Mall
|
|