
Audax321
Avatar/Signature-
Posts
90 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Audax321
-
Hello, The application I am making can work with a variety of extensions that other applications may also be using. So, I am putting a listbox in where the user can select whatever file types they would like to assign. My question is how would I register file types programatically at runtime??? Thanks.
-
Hello, I'm just starting out with VisualBasic.NET (I used VB6 before) and I'm creating a quick mp3 player to get used to the program. It's almost completely done. However, I'd like to add support for registering file types with it. But, I also want to get the application that the file type was originally registered with so that if a user unselects an item (deregisters it) the program will register the file type with the other application if it still exists. I know how to change values and read them in the registry and I'm hoping that is all I need to do. The problem is that I'm not exactly sure what values Windows alters when it registers a filetype. If any of you can help me out, I'd appreciate it... thanks :confused:
-
Okay, I got the code working and it lets the listbox scroll up and down when the user has their mouse over either the topmost visible listbox item or the bottom most visible listbox item. It will also still let you use double click or any other type of click such as right click as well as externally dragged items. If anyone needs the code (although you should try doing it yourself to learn it better) it is right here: Dim StartIndex As Integer Dim EndIndex As Integer Dim InternalDrag As Boolean Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown If (e.Clicks = 2) Then Call ListBox1_DoubleClick(sender, e) ElseIf (e.Button = MouseButtons.Right) Then '''Mouse Button Click Code Goes HERE '''''''For Example (to popup a menu): '''ListBox1.ContextMenu.Show(ListBox1, ListBox1.PointToClient(ListBox1.MousePosition)) Else Dim lb As ListBox = CType(sender, ListBox) Dim pt As New Point(e.X, e.Y) StartIndex = lb.IndexFromPoint(pt) EndIndex = StartIndex If StartIndex >= 0 Then InternalDrag = True lb.DoDragDrop(lb.Items(StartIndex).ToString(), DragDropEffects.Copy) End If End If End Sub Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop If (e.Data.GetDataPresent("Text")) Then If (InternalDrag = True) Then ListBox1.Items.RemoveAt(StartIndex) InternalDrag = False End If ListBox1.Items.Insert(EndIndex, e.Data.GetData("System.String", True).ToString()) ListBox1.SetSelected(EndIndex, True) End If End Sub Private Sub ListBox1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragOver Dim lb As ListBox = CType(sender, ListBox) Dim pt As New Point(e.X, e.Y) Dim NumVisibleItems As Integer EndIndex = lb.IndexFromPoint(lb.PointToClient(pt)) NumVisibleItems = (ListBox1.Height / ListBox1.ItemHeight) - 1 If (EndIndex = ListBox1.TopIndex And EndIndex <> 0) Then ListBox1.SetSelected(EndIndex - 1, True) ElseIf (EndIndex = ListBox1.TopIndex + NumVisibleItems And EndIndex <> ListBox1.Items.Count - 1) Then ListBox1.SetSelected(EndIndex + 1, True) End If End Sub Private Sub ListBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter If (e.Data.GetDataPresent("Text")) Then e.Effect = DragDropEffects.Copy End If End Sub Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick MsgBox("DoubleClick Event Called") End Sub
-
(REMOVED THIS CODE... SEE BELOW FOR WORKING CODE :) )
-
Hello, I was wondering if it is possible to drag an item in a listbox to another location in the same listbox... Kind of like if you open Windows Media Player, make a playlist, and drag the individual songs up and down. And of course, the program would need to return the old and new indices. Thanks. :)
-
Hehe, nevermind I figured it out.... Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.SizeChanged If (Me.WindowState = FormWindowState.Minimized) Then MsgBox("Minimized") End If End Sub
-
Hello, Is there a way to use the minimize button on the form (the one at the top right of every window) to hide the form when you click it instead of minimize it to the taskbar in VB.NET? That way, I can make my form 'minimize' to a notification icon in the systray without having to add a new button to the application. Thanks...
-
Ahh, nice try, but it still didn''t work. C++ has this thing called IActiveDesktop that allows you to refresh the entire desktop by simply using the ApplyChanges method. Does anyone know if this will work in VB.NET??? I'm looking into it, but I can't seem to find anything about using it in VB.
-
I just tried my application, and if you go run it and then go into the Desktop Properties menu and click on another wallpaper and then reselect the existing wallpaper (so the APPLY button is clickable) and click the button, the desktop refreshes and the icons disappear or appear like they should. The problem know is how do I get that to occur after the registry key is changed programmatically?
-
Hello, I'm writing a simple program that will show or hide the icons on the desktop without any user interaction (they simply run it). The reason I am doing this is to show/hide icons by using a link to the app that is always visible on the taskbar rather than have to right click on the desktop everytime. I'm just wondering how I can tell Windows that the value of the registry key that it uses to determine if icons hide or not has changed... Here is the registry information it alters (works in XP, and might in NT or 2000): Hive: HKEY_CURRENT_USER Key: Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced Name: HideIcons Type: REG_DWORD Value: 0 And here is the working code I have... it just needs to have the refresh part added: Dim rkey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", True) Dim ValueNames As String() Dim ValueName As String Dim Value As Integer ValueNames = rkey.GetValueNames For Each ValueName In ValueNames If (ValueName = "HideIcons") Then If (rkey.GetValue("HideIcons") = 0) Then Value = 1 rkey.SetValue("HideIcons", Value) ElseIf (rkey.GetValue("HideIcons") = 1) Then Value = 0 rkey.SetValue("HideIcons", Value) End If End If Next rkey.Close()
-
Anybody have any idea how to accept dragged hyperlinks from internet explorer??? I can't figure it out...
-
Thanks, but is there a way to just check if a file exists on a server without attempting to download it?
-
Hello, I have three questions listed below that I would appreciate answered. Here are the questions: 1. Is there a way to point a URL to the OpenFileDialog control, because it downloads and points the path to the one located in the temporary internet files folder, without displaying the actual dialog box? That way the user could drag/enter a URL and the program would use the OpenFileDialog control to download the file if it exists without user intervention and point it to the temporary internet files location. This would be easier than downloading the file yourself, because this method should also work for local files. 2. Is there a way to check if a file actually exists on a http/ftp server. For example, if the user enters a URL such as http://www.files.com/text.txt, the program can tell if the file text.txt exists on the server or not. A method that works for local and internet files is preferred. 3. How do I drag and drop a hyperlink from Internet Explorer to a textbox in my application. This worked fine in VB6 using text dragging, but doesn't seem to work in .NET. Thanks for any help :)
-
Woohoo, just checked my code, I forgot to replace the path in the listbox.dodragdrop command with the variable for the data object .... it worked... Thanks... :)
-
That is what I want, but it doesn't work. I made a file search utility that searches specified directories for files... I want to be able to drag (copy) these files onto the desktop (or any other folder) from their current location. I also want any mp3s found to be dragged into WinAmp. Dragging a string containing the path doesn't work. I think WinAmp requires a path to be dragged as a file.
-
I wanted to initialize a drag from my program as a file... Kind of like Windows Explorer does. I found a way to do this on VB6 (see code below). But I'm not sure how to add this to my program in VB.NET. Currently I have it dragging a string containing the path to the file. Here is the VB6 code: Private Sub Picture1_OLEStartDrag(Data As DataObject, AllowedEffects As Long) ' this evant allows us to implement dragging *from* our picturebox to other drag targets in the system ' make sure there is a file name in the tag property (you would probaby want to use a "file ' exists" routine here but for this demo we are doing it simply) If Picture1.Tag <> "" Then On Error GoTo EH ' set the drop effect to create a copy of the file wherever it get's dropped AllowedEffects = vbDropEffectCopy With Data ' clear the contents of the data object .Clear ' tell the data object we will be dragging files .SetData , vbCFFiles ' add the file name that we storred in the tag eairler .Files.Add Picture1.Tag End With End If ExitNow: Exit Sub EH: Err.Clear MsgBox "Unable to initiate drag." Resume ExitNow End Sub
-
I figured it out.... I was assuming that visual basic would consider the dragged string a file because it was a path. Instead, I got it to work by having vb6 handle it as a string. Then to make sure that the string was a file, I just evaluted the following: len(dir(draggedstring)) If its not 0 then the program processes it. Hope it helps someone else... I was complicating things for myself for no good reason LOL :)
-
The drag is being initialized with a string but is being processed using drag.files which is an array of strings that point to paths to files. I have to get .NET to add its string to this array like Explorer does... I think :)
-
Here is the code initializing the drag: Private Sub lstResults_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstResults.MouseDown If (lstResults.Items.Count > 0 And lstResults.SelectedIndex < lstResults.Items.Count) Then lstResults.DoDragDrop(lstPath.Items.Item(lstResults.SelectedIndex) & lstResults.Items.Item(lstResults.SelectedIndex), DragDropEffects.Copy) End If End Sub and here is the code that process the drag in the other program: Private Sub lstPlaylist_OLEDragOver(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer) If (Button = vbLeftButton) Then DragOpen = False Else DragOpen = True End If End Sub Private Sub lstPlaylist_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single) On Error GoTo Drophandler If (Data.Files.Count > 0) Then MsgBox ("drag initiated") For Each DragFile In Data.Files intstrsearch = InStr(1, DragFile, ".") Do While (intstrsearch < InStr(intstrsearch + 1, DragFile, ".")) If (intstrsearch < InStr(intstrsearch + 1, DragFile, ".")) Then intstrsearch = InStr(intstrsearch + 1, DragFile, ".") End If Loop strFileToOpen = Mid(DragFile, intstrsearch + 1, Len(DragFile)) If (strFileToOpen = "mp3" Or strFileToOpen = "mp2" Or strFileToOpen = "m3u" _ Or strFileToOpen = "mpg" Or strFileToOpen = "mpeg" Or strFileToOpen = "mpe" _ Or strFileToOpen = "mlv" Or strFileToOpen = "mpv2" Or strFileToOpen = "mp2v" _ Or strFileToOpen = "mpa" Or strFileToOpen = "cda" Or strFileToOpen = "au" _ Or strFileToOpen = "aif" Or strFileToOpen = "aifc" Or strFileToOpen = "aiff" _ Or strFileToOpen = "ivf" Or strFileToOpen = "wav" Or strFileToOpen = "avi" _ Or strFileToOpen = "mid" Or strFileToOpen = "midi" Or strFileToOpen = "rmi" _ Or strFileToOpen = "wmv" Or strFileToOpen = "wvx" Or strFileToOpen = "wma" _ Or strFileToOpen = "wax" Or strFileToOpen = "asf" Or strFileToOpen = "asx" _ Or strFileToOpen = "wm" Or strFileToOpen = "wmx" Or strFileToOpen = "wmp") Then strFileToOpen = DragFile If (DragOpen = False) Then Call CommandAddFiles End If If (DragOpen = True) Then Call CommandOpenFiles End If End If Next Data.Files.Clear End If Drophandler: MsgBox ("the drop was lost") End Sub I'm sure there is some way to do this, because it would be very counter productive for Microsoft to not allow .NET and VB6 applications to communicate in this way. The thing is that I really suck at this dragdrop stuff. I just wrote that code for the dragdrop procedure in the VB6 app a few days ago. It works great if you drag from Explorer, but I can't get it to work with the .NET application.
-
Okay, I got the drag to initialize. The problem I am having now is getting the drag into my other program which is made in VB6. The string containing the path is being dragged into a listview control on the other application. But, I'm getting the following error: Run-timer error '461': Specified format doesn't match format of data My other application accepts files using the data.files array. So is there anyway to get the path to be added to this when the drag is initialized? If not, then how do I get the other application to read the string? I'm not too sure what this error means.
-
VB6 had oleDragDrop, what is the equivalent in .NET and how do you use it? I have an application that searches user selected directories for files that match a search string. I want to allow the user to drag a line from the search results that appear in a listbox to another application. The drag must contain the path to the file being dragged. I've never really done any dragdrop in this manner in VB6 so I'm not very sure how to initialize a drag. Thanks for any help! :)
-
Thanks.... the me.refresh() didn't work, but the Application.DoEvents() worked great. I was trying to invoke that as just plain DoEvents earlier... completely forgot how to call that in .net. :)
-
I have my program displaying a label (just says Please wait... blah blah blah) while some code is being run (it takes a while). Well, if my form loses focus and then gains focus... it turns all white until the code is done executing. Since this could cause the user to think the application is crashing, is there anyway to prevent this. This happened in VB6 too but wasn't as much of a problem with programs I wrote under that. Thanks... :)
-
LOL, Thanks... I had frmSearch (the name of my form) in the left-hand dropdown...
-
I have code I need run when the user closes the application. From what I understand vb.net has a mybase.closing event. So, I have my code set to first call mybase.close() and then Application.exit() So mybase.close should call the closing event right? Well, the main problem I have is where is the closing event? Does anyone know where I should put this code I need run? Thanks..