Remember previous directory when adding existing resource - visual-studio

I have a collection of numerous icons, png files and other graphics data stored on a Icons folder in my secondary hard disk.
When I need a new resource I double click on the resource.resx file and add the new one via 'Add Existing file".
However each time I use this menu, it opens a browse window initially located at C:\Windows\System32. So, each time, I need to go to my Icons folder.
Is there a way to 'teach' Visual Studio how to remember the last folder opened? (Macro? Addin?)

This has annoyed me for quite some time, and just found this via a Google search. I voted it up, but per Microsoft's response on the bug page, it's unlikely it will ever get fixed(it might take all of 5 minutes, after all)...
Anyways, I did find a suitable work-around for my scenario that I wanted to share! Simply use Explorer to navigate to the path with your resources(icons, pngs, etc.) and drag/drop them into the resource list in VS2010. This is actually faster for me, as I have PNG's and an icon for each graphic I add, and this way I can add both with one step, instead of switching between the 'icon' resource section and the 'images' resource section, clicking 'Add Resource'->Existing->find path->select, etc... Hopefully this saves someone considerable time, as it's saved me.

Related

Trying to keep default icons when associating multiple file extensions with same app on Windows

So I have my own windows app, 'MyApp', that I want to associate with multiple existing file extensions such as .pdf, .doc etc. Associating the extension is no problem, but then all of the file icons inherit their icon from the app, which I don't want.
I noticed that pdf files were associated with MS Edge on my Win11 machine, but that .pdf files were being displayed with a regular looking 'pdf' icon rather than an Edge one, exactly as I want to do.
I found this ms page that seems to describe how to do it with a DefaultIcon key in the registry, but my icon remains as MyApp's when I try. I also found this page which sounds similar to my problem. Implementing the answer's solution does change something, but all it does is give all of the associated files a shared icon (I pointed it to a 7zip one just for kicks) that is different from MyApp's.
I've concentrated on creating my own fake extension (.qqq) rather than trash settings for others, although I have tried using .pdf with no luck either.
I also noted the existing use of DefaultIcon with 7zip file extensions, but I was unable to replicate their behaviour with MyApp and its associated extensions.
Can anyone point out where I might be going wrong please?

Pasted folder replaced old one without asking in windows

Was hard to describe my problem in Title. Basically I opened zip archive, and dragged a map out of it to desktop. Then I realized, that I had a map with the same name on desktop with different content and windows just replaced the old map with new one, without asking.
What I want to know is if there is any place I can find the old map, that got replaced? Can't really find it and the content was really important.
Any suggestions would be highly appreciated, because I myself have this situation for the first time and could not describe the problem to google.
So again, what I did:
Opened zip archive.
Dragged one folder on desktop
The folder replaced an existing folder on desktop, which apparently had the same name.
SOLVED
The solution was quite simple, but I will leave this post up, if anyone else gets this kind of problem, or by mistake clicked replace folder.
At least in windows 10, you can press properties of the new folder and there preview previous versions of the folder. Then click open and you can get the contents back. Or just click restore for restoring the folder to previous version.

Xcode can't find source files

I'm using Xcode 8. I recently inherited a project with several hundred files (including source and image files). I rearranged them on my local drive and the file names (appropriately) become red in the folder list on the left side of Xcode. I selected files/folders in this folder list, click on the "Hide or show Utilities" button to display the "Identity and Type" pane on the right side of Xcode, clicked on the little folder icon next to the Location, and selected the files'/folders' new locations. The text in that pane was updated to the new location and the file/folder names changed from red to black. So far, so good. I did this to all of the file/folder names until none of them were displayed in red.
However, when I go to build the project, I get numerous warning messages similar to, "image.png /Users/Me/Project/images/image.png is missing from working copy." The path shown in the error message is the file's OLD location. When I look at that image in the file list, it is displayed in black. When I select that file and look at the Full Path in the pane on the right, it shows the file's current location (e.g., "/Users/Me/Project/images/newfolder/image.png"). I'm unsure where in the project the old location is being stored. FWIW, I've tried Cleaning the project...
Thanks for insights.
So here is an approach that is perhaps not for the meek, yet it is something I do more often than one would expect to fix Xcode project files. I tend to be the one designated to do this on the teams I work with ... manually editing the project file. The .xcodeproj file is really just a special folder. The actual project file is project.pbxproj.
First back up the project file. Your choice on if you want to do the complete .xcodeproj or just the project.pbxproj.
Use your favorite text editor and open up the project.pbxproj file.
Search and replace the prefix to your path. For the sake of this exercise, you should try and keep your path as similar as possible to make it easier. For example, if the hardcoded path is /Users/Me/Project/Images/newfolder/image.png and all prefixes are generally "/Users/Me/Project", you can just do a search on "/Users/Me/" or "/Users/Me/Project" (the latter if you want more safety) and replace with "/Users/You/" or "/Users/You/Project". Note I am not searching on "Me" and replacing with "You". You want to search and replace but as controlled as possible.
Once done, save and open the project. If the project doesn't open at all, it means you messed something up. Start over. Note that changing the paths should not be sufficient to break the file. It will probably mean you accidentally added or deleted something.
If the project file opens now build. It should hopefully build.
Okay, so that gets you into a buildable state. Now you really want to fix things. Whomever did the project was a knucklehead for using absolute paths.
This next part will be tedious. There are probably ways to do this manually, but I'll leave that to an exercise for the reader right now. In file inspector within Xcode, you will want to change files to be anything but "Absolute Path". Here is an example, you can see the location is "Relative to Group".
Essentially you are going to have to around to Groups and files and fix things up to not be absolute. Make sure you backup incrementally and can build.
Wait, but unfortunately there is more. You'll then need to go into Build Settings to see if things are absolute paths. Then you'll need to decide how to adjust for that. For example, it is not uncommon for 3rd Party frameworks to be added with absolute paths.
Or I suppose if you want to, you can just get it working and skip the latter part of this and damn everyone else...

Mark a large number of files as Build Action "None" in Visual Studio

I have a folder containing 12000 images. When I add them to my project they get marked as Resources, but I want to set their Build Action to None. If I select them all and go to the Properties tab and set None, VS starts working and engulfes itself.
Is there another way to do that? Or a way to set the default Build Action for newly added files to None?
Thank you!
Make a backup of your project file (e.g. by committing it to a branch in source control locally) before making manual changes to the file.
Right click the project node in Solution Explorer and click Unload Project.
Right click the project node in Solution Explorer and click Edit yourproject.csproj.
Replace all instances of
<Resource Include="Resources\
with
<None Include="Resources\
Save and close the project file.
Right click the project node in Solution Explorer and click Reload Project.
Optionally you could also remove all instances of these lines and use the following single line instead. You'll definitely want to mark your place in source control so you could undo the change if it doesn't work out like you expect.
<None Include="Resources\**\*.jpg"/>
12,000 files is a good two orders of magnitude beyond what you can reasonably expect to be performant during a build. Just checking if files need to copied can easily take 5 minutes on a spindle drive. Still uncomfortable on a solid-state drive.
You'll need a drastically different approach to solve this. Key approach is that you don't wait for it so cannot get annoyed at the delay. Like spinning this off into a separate project that builds a resource DLL, not included in the solution. Preferably done on another machine, build servers are good for that. Or a completely different approach to packing the files, like sticking them in a ZIP archive. A "wad" in gaming speak of old. Or taking your program to the files instead of the other way around, keeping them stored on disk and telling your code where to find them with a configuration setting.

.DLL:How to modify a Dynamic Link Library (.dll) file?

I have been able to open a Windows 8 shsxs.dll file in Visual Studio 2010.
But it's write protected.
Now, while in Visual Studio, I want to know how to modify an existing image or add a new image in
png format to shsxs.dll.
Also, I have been a to unpack/extract it too using 7-zip.
Thus, how can I repack the unpacked .dll file back to a .dll file?
PS: I'm new to Visual Studio, so question or tag may seem irrelevant. Please correct me & help me out asap.
Preface: I haven't got a chance to work with Windows 8 yet, so the information in this answer might be slightly off. Or completely useless.
I think by write protected you mean read-only. That's easily corrected. Locate your shsxs.dll and right-click on it. Select Properties and uncheck the Read-Only checkbox in the Attributes section, if it is checked. Then go to the Security tab, and click edit. Select your username (or the user Everyone if it's there) and tick the Full access checkbox in the Allow column. Click OK. Click OK again.
Next you want to know how to modify an existing image or add a new image in png format. These are two different things.
Let's tackle the modifying first.
You can't do that with 7-Zip. You can only use it to look at the DLL's content, but you can't modify it. You need a specialized tool for the job, I recommend the XN Resource Editor, which is basically a better Resource Hacker, which used to be the program to edit already compiled resources. I'm not sure whether they work with Windows 8 modules, though. If they don't, please link to an alternative which can in the comments, or edit this answer if you can.
After you install the XN Resource Editor, start it, and open your shsxs.dll. On the left side you have the resource tree. Expand the Bitmap subtree. You should see a bunch of numbers, each one represents one resource in the DLL. Expand each subtree until you find the desired image.
Once you find your image, you can modify it inline using XN Resource Editor's built-in picture editor. You can also remember the resource's number, right-click on the Image and select Delete Resource, then go to the Resource menu and select Import Image Resource, find your desired image. Then right-click on the newly imported image in XN Resource Editor, select Properties and enter the old resource's number (you remembered it, right?) and press OK.
Adding a new Image is not that different.
It's easy, simply go to the Resource menu and select Import Image Resource, find your desired image and click OK. DONE.
Edit: Since the file came from System32, I added instructions on how to grant the user full access to the file, additionally to removing the read-only flag.

Resources