I am trying to get a CHM file to open to a specific topic using C#.
I have tried using
Help.ShowHelp(this, path, HelpNavigator.Topic, "TopicTitle");
but it doesn't find the page. I must not be keying in the topic title correctly. Is there a way that I can programatically retrieve all of the topics from a CHM file so that I can see what they are?
No, the HtmlHelp API function is far too primitive to support enumerating topics. You could use the 7-zip file manager to look inside the .chm file. Right-click the file and choose "Open Inside". Or use the help authoring tool that was used.
If you open a CHM file, and right click on a help page, you can choose the Properties command.
In the middle of the Properties page there is a property called: Address (URL).
The end of the URL contains the topic string used to open the help file to the correct page.
Here is an example:
mk:#MSITStore:C:\Program%20Files\Sisulizer%202010\Sisulizer.chm::/OutputFiles.htm
If the URL is too long to see the topic at the end, you can select the address with your mouse and scroll to the end.
Here is a screen shot.
You may also use the following, where path is path to the chm file:
using System.Windows.Forms;
Help.ShowHelp(this, path, HelpNavigator.KeywordIndex, "Topic title");
I am not sure about how to programmatically retrieve topics from CHM.
But I changed the one line code this way and it worked.
Help.ShowHelp(this, path , HelpNavigator.TopicId,"TopicTitle");
Related
How and in which folder should I store the file(xml)? The file will need to delete and add data using "linq to xml"
I use Visual studio. Cross-Platform project.
Assuming that this is not a user document (like a Word doc), but rather a settings file, then the most appropriate place to store it would be in the user's application data folder, which is one of the folders under C:\Users\username\AppData
You would find this as follows...
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
However, a bit more information about what you're actually trying to achieve might help you get a better answer.
Hope that helps
How can I retrieve the system icon associated with a file/folder so that
I can show it in the list view adjacent to the file/folder name?
You need to use Icon.ExtractAssociatedIcon
Icon icon = Icon.ExtractAssociatedIcon(filepath);
Take a look at Icon.ExtractAssociatedIcon documentation
Note: this works only for files. For folders you need P/Invoke sample is here Edit: Page is now defunct, please refer to this copy on the Wayback Machine.
See Obtaining (and managing) file and folder icons using SHGetFileInfo in C#.
I have a few questions. Yes this is homework and I am just trying to understand it.
This is what is being asked.
• When the button “Load” is clicked, read the file specified in the textbox (txtFilePath: Absolute path not relative) and add the objects found within to the listbox
• When the user clicks the “Save” button, write the selected record to the file specified in txtFilePath (absolute path not relative) without truncating the values currently inside
Can someone please explain to me as I am still learning this. I have the button and the textbox there and the same with the save. Now with the save button will I just have the same code as you would if you just wanted to save it. But from what I am gathering there is a database so you can load the file that you saved. Or am I making this harder than what it is?
No, no database. In these instructions, record == some selected item that needs to be appended to an existing file. Just use a stream and a writer to save the file to disk and you satisfy the requirement.
No, there is no database. What you do is interact with the Windows file system (eg, the files on your hard drive). You use the classes in the System.IO namespace to load and save files.
'Absolute path' refers to the unique location of a file in the drive expressed as a rooted expression; a 'relative path' is a partial path that points to a file relative to a given location:
c:\foo\bar\baz\my files\homework.txt
..\..\homework.txt
Those are an absolute and relative paths.
I'm not sure how much detail you are looking for here, it's hard to give a complete overview of the way filesystems work. You might want to look at the basic examples in MSDN that deal with file management.
It's hard to give a detailed analysis of this subject as it is quite a wide topic.
For file interaction you must use the System.IO namespace which has classes to easily load and save files.
http://msdn.microsoft.com/en-us/library/system.io.aspx
The link above is a good reference on MSDN on how you can get started with File Management using System.IO.
Good luck!
If I understand you correctly, your question is wether or not you need to read the file a second time before saving or otherwise treat if differently than if you created a new file.
I would say "no". You have already read the content of the file into the listbox. You just need to get the edited content from the listbox (when the user is done with it) and save it to the file (overwriting whatever is there).
First of all read up on how to read and write files. Here's a good link I found:
check it out
Next what you'll want to do is put your read/write code in the Button_Click event of each button (double click on your buttons to auto create this event assuming your using Visual Studio)
You can easily retrieve the path from your text box by accessing the .text() property of your textbox
string path = myTextBox.Text;
It's been a while since I've coded anything in c# but this is pretty basic and I think it should help.
For Load:
Read the file line by line
Add each line to the ListBox Items
For Save:
Open your save file without truncating (ie append to the file)
For each item in your ListBox Items, write it to the save file
I downloaded a zipped archive from Apple that consists of a C++ header file and source. Included in this was a help file. For some reason this help file opens but I cannot read the content. Is there any other documentation outside of a help file for this? For c++ or c#?
If you are on Windows, you probably are looking for the "iTunes COM for Windows SDK".
Get a free ADC login here if you haven't done so already. Once you have done that, you can go to http://connect.apple.com and log in.
Click on "Developer Tools", and somewhere in the massive list of results is "iTunes COM for Windows SDK". Download that, it's just an ordinary zip file, and somewhere in there is a directory named iTunesCOMWindowsSDK. In that directory, there is a iTunesCOM.chm file that contains all the reference material you need.
If this is the help file you already have, you could consider decompiling the chm file using the hh.exe tool that comes with Windows.
It seems the only source for the iTunes COM documentation is now archived on github by https://stackoverflow.com/users/188792/joshkunz
The nice web page is here
http://www.joshkunz.com/iTunesControl/
And the github project is here
https://github.com/Joshkunz/iTunesControl
Solved.. The problem was a Windows Security feature was blocking the compiled help file from opening. I found the solution here:
http://weblog.helpware.net/?p=36
Note: this is not relevant but it feels like this code complements the question nicely - I would have put this in comments but comments don't seem to allow code formatting (d'uh).
Anyway, here is a C# example of how to dump all songs in the library:
dynamic iTunesApplication = Activator.CreateInstance(Type.GetTypeFromProgID("iTunes.Application"));
dynamic mainPlaylist = iTunesApplication.LibraryPlaylist;
for (int i = 1; i <= mainPlaylist.Tracks.Count; i++)
{
dynamic track = mainPlaylist.Tracks.Item(i);
Console.WriteLine(track.Location);
}
Thanks to Hogan for the great pointer to the documentation!
I need to extract some bitmaps from an .msstyles file (the Windows XP visual style files) and I'm not sure where to start. I can't seem to find any documentation on how to do it, and the file format seems to be binary and not easily parsed. I have been able to extract the bitmap by itself using:
IntPtr p = LoadLibrary(UxTheme.ThemeName);
Bitmap bmp = Bitmap.FromResource(p, "BITMAP_NAME");
FreeLibrary(p);
However, I also need the information related to the bitmap, like the margin sizes, spacing and number of "images" per bitmap. Does anyone have any experience with this or any links to documentation that I can use?
This site claims the file format is documented though not by Microsoft.
Also found this in the Wine Crossreference.
Hope that helps!
If you want to get files out of a dll directly (remember, msstyles are dlls with another extension), you could have a look at the Anolis Project.
As for actually parsing that stuff you should look at the various tutorials on creating msstyles for information on how the various text resources in that file work.
This codeproject article seems to have exactly what you want, with a little interop involved. A managed wrapper exists and it seems rather good. The .Net WindowsForms also has the functionality built in, you might want to look at the System.Windows.Forms.VisualStyles namespace if you want simplified read only access.
You can open the msstyles using 7-zip, install it, then right click the msstyles > 7-zip, ther's 2 open inside, one as a normal button and the other with a arrow, choose the second one, then select "#"
You're now inside the msstyles, now right click to 1..mst > Open inside
You're inside the actual theme now, now just extract it's resources
Image of the msstyles open (is in spanish tho)