Replacing Webbrowser control with Listview - does Listview offer all features as Webbrowser? - vb.net

I'm currently using Webrowser control on my form for navigating to paths on my PC. Everything is perfect - you can drag/drop files, cut/copy/paste them, navigate through folders, create new ones, files and icons are shown - as in Windows Explorer. Only problem I have is windows system security settings (PC at office). I keep getting Windows security alert "Do you want to allow files from this website to run on your computer?".
I wish to create Explorer on my own, so I started dealing with Listview. It's hard for my level of vb.net knowledge so before I proceed further I need to know this:
Can I show files + folders from desired path in Listview (like "C:\Myprograms\SomeFolder\") with all icons ?
Can I navigate in Listview - like when I have a folder in Listview and double click it to view It's contents
And can I drag/drop files in It and cut/copy/paste files, which will ultimately change my folders on PC ?
I'm asking this because I allready started and I've bumped into many problems - folder icons not showing (using different methods), folders and files not showing together in Listview, cut/copy/paste issues etc.
I just want to know If It's even possible. Thanks for response in advance.

Related

VB.net or Windows API: How to find out which icons the file explorer uses?

I am currently working on a Windows desktop application using VB.net where I would like to have a file and folder browsing interface directly integrated, i.e. the user does not have to open a file browser dialog to select files.
My file browser should resemble the original Windows file explorer at least in that it uses the same icons for the most common locations. For example, I would like to include the "Favorites" folder with the appropriate icon (please note that this is NOT the IE favorites folder, but the folder which comes up when you type shell:links into the address bar of the file explorer).
My problem is fetching the icon. So far, I have written a wrapper class for some functions of the Windows API, notably SHGetKnownFolderPath and SHGetFileInfo. My approach is the following:
1) Use SHGetKnownFolderPath to get the full path to the respective location (which depends on the Windows version and localization). This part works like expected. For example, on my system (W7 Pro x64), SHGetKnownFolderPath returns "C:\Users\Administrator\Links" when queried with the respective rfid.
2) Use SHGetFileInfo to fetch the icon which Windows considers the default icon for the path obtained in 1). This part technically works as well, but the wrong icon is returned - wrong in the sense that it is another icon than Windows file explorer uses for the same location.
I have tried that with four different locations (MyLibraries, MyFavorites (Links), MyComputer, MyNetwork). The icon for MyLibraries was the expected one, the other three were completely different from the icons Windows file explorer uses.
So I have got some questions:
1) Is there any way to detect which icons are used by the standard Windows file explorer for certain folders, e.g. "Favorites" (C:\Users\Administrator\Links on my machine)? I would be interested in a general solution (i.e. a solution which works for all locations described here).
2) If there is no such way, I will find out the number (index) of all icons of interest in shell32.dll (actually, there are only a few at the moment). Can I be sure that those indexes won't change in the future?
3) According to this document, I have to call CoInitialize before using SHGetFileInfo. I believe that the .NET framework automatically does this for the main thread before starting it and thus have not done it on my own yet (the development of the application has just started, and there is only one thread at the moment).
I think that the missing call to CoInitialize can't be the cause for the "wrong" icons. If I'm wrong here, please let me know.
A potential solution could be using a .NET language or the native Windows API / SDK. As long as there is some way (even an extremely complicated one) to use the solution from within VB.net, I will be happy with it.
Explorer uses 2 ways to detect icon of any object, file or folder.
1) call IShellFolder.GetUIObjectOf(IExtractIconA/W) and work with IExtractIcon.
2) query IShellFolder.QueryInterface(IShellIcon) and call IShellIcon.GetIconOf.
You can do the same.

How to load a video permanently into a project

If you add a picture into a project, then remove the picture from it's original source, the picture is still in the project even though it doesn't exist in its original location.
I want to do the same thing with a video.
How can I add a video to a project in such a way that it can be deleted from its original location and it will still exist in the project?
I guess what you are looking for is dynamic ressources and not static(local) ones. You can input them by drag&drop into your solution explorer or if you double click on your project in the solution explorer the project properties open - there you have a tab called ressources where you can input any kind of ressources.
If you dont know how to play a movie within a VB Form - here is a tutorial on YouTube.

Mimic Explorer.exe So I can Customize It's Toolbars

I am trying to make a form of explorer.exe so I can customize the toolbars to do more things that I want, such as create a list of what is in the current directory I'm looking at.
I'm currently trying to put a pannel onto the windows form and am using the code:
panel1.display("C:\")
I've also tried:
panel1.url("C:\")
And:
panel1.navigate("C:\")
When I used Java in class I could construct something similar to this with panels, so can someone please tell my why I can't get the panel to display the contents of the C: drive?
You are extremely close, on the right track. What you should do instead is use a simple web browser. It can do more than just browse internet pages. If you use the following code it should work:
webbrowser1.navigate("C:\")

VB.2010 form not showing controls in the IDE

I have a VB.2010 Windows Desktop App that has been running for years.
As of this morning there is 1 form out of dozens of forms the app has does not show any of the controls in designer mode and not even the correct size. Look like a brand new form except the form does not any text (new form would be form1, etc.). Yesterday there was no problem.
The designer module is there as is the resx module.
When looking at the Solution Explorer showing all files the modules appear but no indented under the vb module. It is almost like VB is treating them as totally separate modules.
Went to a back of the source folder from 5 months ago and it has the same problem for the same form.
If I run the app the form does show all the controls but I am not able to see / change the controls in designer mode.
Every tried re-booting the machine.
Since the 5 month old backup has the same problem it is not something in the source. So restoring the source would not help.
Looked at another VB.2010 app that is very similar to the above that uses the 'same' forms but in a different folder and this program does NOT have the problem.
HELP!!
All the controls where there. I fixed it by removing and deleting the 'bad form'. Then doing an add existing items from a backup folder (actually created when the form was still bad).
So there is/was nothing wrong with the source and I have no idea what caused it, why backups didn't work on 2 PCs, etc. etc.
Don't know if it will stay fixed but I am ending the day (yesterday) on the above good :)
Filed in: X-Files

Dragging Files on the Dock Icon

I know how handle dragging of files on the dock icon, and it has been asked before.
However, I'm wondering, can I somehow get more control?
For example, can I make the dock icon reject files that are not in the user's folder and allow only files that are in the user's folder?
I'd rather do that instead of the app appearing as if it handles files outside the user's folder, and then within the app delegate afterwards reject the files by detecting the file paths. That doesn't seem good from a user's perspective.
I realized that my question is kind of meaningless, as Option-dropping files on the dock icons forces the operation to be allowed, in any case. So there is simply no getting around handling the thing after the drop operation has been allowed. Thus, ignore this question :)