C# - Get Current Names Of Windows Special Folders?
Jan 11, 2012
Users can easily rename special folders like Computer, Network etc. to whatever they like. Also if the computer is using a different locale, the name of those folders will also be different.I want to get the current names of all special folders like Computer, Recycle Bin, Network etc. in my app. Is there a way to do this? A specific API? A registry value?For eg, user renames My Computer to Super Computer. My app should show that My Computer's name is Super Computer.
I'm trying to make buttons that will open each of the "special folders" in Windows Vista. Here's an example:
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Process.Start("explorer.exe", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) End Sub
As you can see in the above code, the button will open the Documents folder. My problem is the only folders this method can open are the documents, pictures and music folders, while I also want to open these folders below:
Downloads Videos User folder (aka the folder that has the user name on it) Computer (aka My Computer in XP)
I need a Collection of Image Paths. The images for this list will be in a known location. So for practice, I decided to use the images that are installed in the Special Folders, using this snippet:
Dim paths As ReadOnlyCollection(Of String) = New String {"C:UsersPublicPicturesSample Pictures", Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)} Obviously, this wont work yet. The squiggle line reads "End of Statement Expected". I just dont know where to go to understand the proper construction.
I am currently using the following to Get Path of all Open Explorer Windows:
foreach (SHDocVw.InternetExplorer j in new SHDocVw.ShellWindows()) { if (j.Name == "Windows Explorer") { ListView1.Items.Add(j.LocationURL); } }
But it doesn't return the location of special folders like Computer, Recycle Bin, Network etc. Is there a way to identify those folders so I can put the path on my own like shell:MyComputerFolder for Computer?
Where can I get the paths for "My Network Places" and "Recycle Bin"?nvironment.SpecialFolder contains the following entries but not "My Network Places" and "Recycle Bin":
Where can I get the paths for "My Network Places" and "Recycle Bin"? Environment.SpecialFolder contains the following entries but not "My Network Places" and "Recycle Bin":
A.) When I use code to delete lets say Image123.jpg in folder Pics and I upload another image and rename that image also Image123.jpg and place it into folder Pics for some reason the new image get's displayed but its using the dimensions of the Image I delete. Using a Repeater over here to display the image.................
B.) When I just copy and past say Image99.jpg into my Pics folder that all ready contain a Image99.jpg then of course it changes the original one. So for some reason it must get cached because when I run my page it is still shows the first Image. Using a normal Image control over here................
Why is it doing A and B........and how can I go around this.....Problem A it more important to me because I need to change the Images names when the User clicks on "Change Logo" button.
I'm attempting to create folders from various files within one folder, based on the file names - extensions. I found this code snippet from this link, however I'm getting a loader lock error ("Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.").
I'm trying to retrieve the names of X number of folders... I know that the names are strings, but i don't now how to get the names of, for example, 6 folders inside the "Group" folder.
I have a directory with about 200 files in it. Is there a way to create a folder for each file with the folder name being the same as the file name minus the extension and then put the file in the folder.For example: Folder "test" would be created from file "test.doc". Then the file "test.doc" would be moved into folder "test".I have some experience with visual basic, and my thought process for this was: make a loop that brought in each file name > store as a variable > create folder with the name in the variable > remove the last four characters from the folder name > move file into the folder > clear variable > repeat.
The code below creates multiple folders based on different file names and moves those files into the new folders. For example, files ABC and XYZ are moved into a newly created folder named ABC and XYZ. I want to advance the code to allow slightly different file names to go into a common folder. Example, I want file ABC_rock, ABC_soil, and ABC_water to be put into a folder named ABC still, AND file XYZ_rock, XYZ_soil, and XYZ_water to be put into a folder named XYZ. I do not want a separate folder created for ABC_rock, ABC_soil, and ABC_water.
Dim strOutputLocation As String = "C:\Temp" Dim rootPath As String = strOutputLocation For Each filepath As String In IO.Directory.GetFiles(rootPath)
I have been trying to create folders for database backup purposes. These folders were to be based on the current date and time as the name of the folder.[code]...
if they choose to use a networked version of my software, I will need the main server doing the authenticating. This is a problem, because from what I understand, it is quite easy to clone MAC addresses. I have looked into using the CPU ID and the HDD ID, but those are not unique, well at least I don't think so. Reason why I say they are not unique is because someone has the exact same CPU ID as me, and the HDD ID changes from partition to partition (same drive). Maybe the HDD ID is a partition ID instead? Anyways, I was thinking maybe I could get the Physical serial number of both the HDD and CPU, but I have not been able to find anything yet.
We have a network share that is used for transferring files between users on a daily basis. Every day at 3:00 am we run a vb6 program to clear the directory of this network share.
I am working on a project where my class has to execute VB code provided by the user, to make it simple I am trying to recreate my own eval function, I am using the following code I found on the web to do this task.
The problem with code is that it can't access any variables or there values, so I have decided to get the variable names, there values types and there types dynamically and recreate them in the class that is being created dynamically. Any way to get the variable names there types and values in the current class or method, so that I can recreate them, and execute the user passed code, the user knows what variables are in the current class or method and there datatypes but he don't know there values as they may have changed, so he can't initialize them. Is there a way to do this, this code will be called in an asp.net page on page_load event, the code passed by the user is stored in the variable vbCode that is passed as a parameter.
I have a packing program which monitors putting barcoded items into a box, it works fine but if the user accidentally hits the windows start key (next to left ctrl), the windows start bar appears and the vb app loses focus, and no longer registers scans. Sometimes the user does not notice and will carry on scanning . . . .
how to force this form to be on top and maybe disable the windows special key ??
(I have made the form modal, but it is only modal within the vb app - the user can still press the windows special key)
I'm trying to acheive something similar to this in my VB.net application: But is there a way I can get this with custom text in it like this: and have my application show it?
at I do not know the number of or the names of the folders, they can be different in different cases, I only have the root path.how I can display folder contents in VB.net and the code worked but couldn't figure out how to create the arrays and display only folders within folders starting with "ad_".
System.IO.DirectoryInfo and System.IO.FileInfo to be used for getting the folders.A literal control can be used to create javascript arrays in ASP.NET. These js arrays can then be used on the client side.
I create special character by Windows XP Operating System Program Start/Run/eudcedit But, i can't reduce width of charater Ex: I create number 2 in string H2O but 2 is subscript then width of "2" is short, and i can't make "2" character shorter.
At my workplace, we're having troubles with Windows 7. Folders that are supposed to be in the libraries (e.g. Documents Library) aren't appearing. While we sort the issue out via Group Policy, I'd like a "DIY fix" that people can run and keep working instead of flooding IT support with requests. From snooping around, I've found that the folders are stored in an XML file here:
[Code]...
I can edit it by hand or programatically, but there is a node called <serialized> which is a long string of alphanumeric characters. It's not necessary (I can manually add folders without this and it works fine) but I was thinking there must be a better way to go about this, so my question is:
Is there a VB.NET function or class that lets me add and query folders in the library without manually creating the XML and inserting it myself? I'm happy to do it myself, but if there is a better way to go about it, I'm all for it!
im working on a drag and drop project, currently im able to drag and drop desktop shortcuts and launch them by click on them.Now im wondering how would i be able to drag and drop folders (My Pictures, My Documents) etc. im using multiple pictureboxes , only picturebox 1 code is shown here.[code]
I have a very simple VB.net Windows Service written using VS.net 2008. The program after doing several other functions writes a log in one of the network folders. The code is as shown below: If I change the path from "Y:Activity_Log" to "C:Activity_Log" it is working like a charm.What is the problem if I use Y drive which is a valid one and I am able to access it from other VB.net desktop apps. Please help.
Dim strFile As String = "Y:Activity_Log" & DateTime.Today.ToString("dd-MMM-yyyy") & ".txt" Dim fs As FileStream = Nothing Dim activityfolder As String = "Y:Activity_Log" Dim di As System.IO.DirectoryInfo
I am writing an application that searches for a particular file in the C:Documents and Settingsuser accountsApplication Data folder. Now i am trying to make this application generic. I can make this application search in a particular users application data folder. But what i am tryin to do is take the user name from a certain file or place where windows xp stores it. Then make it search for that user. Is there a particular way to do it.
I am writing an application that searches for a particular file in the C:Documents and Settingsuser accountsApplication Data folder. Now I am trying to make this application generic. I can make this application search in a particular users application data folder. But what I am tryin to do is take the user name from a certain file or place where windows xp stores it. Then make it search for that user. Is there a particular way to do it.
i have a little Application where i read the names of Services from the Registry.In Windows XP no Problem at all but in Windows 7 they are not permanently in the Registry.They can be found in HKEY_USERS.DEFAULTSoftwareClassesLocal SettingsMuiCacheA246693477 but not permanently since its a cache it works after reboot but after a few hours these get deleted and i have no readable Names anymore only those Values like
@%SystemRoot%system32audiosrv.dll,-204
So the Problem is i need a way to get Service Names no mattter how long the PC is running ^^.Is there another way to get the clear Service Names permanently so i dont have to reboot after a few hours?
I am writing an application that searches for a particular file in the C:Documents and Settingsuser accountsApplication Data folder. Now i am trying to make this application generic. I can make this application search in a particular users application data folder. But what i am tryin to do is take the user name from a certain file or place where windows xp stores it. Then make it search for that user. Is there a particular way to do it.