c# creating msc file - c#-4.0

How can I create *.msc file? I see a lot of articles about creating snap-in's.
My goal is to create msc file so people can double click it and bring defined snap-in
Thanks

open the MMC and import your snap in from
FILE>Add/Remove Snap
then
File>Save As
you get what you want. BTW, you could rename the console, change icon.. in the
File>Options

Related

File association and thumbnail preview in Windows 10

I have created an application and associated on registry a file extension on Windows 10, so when you double click a file associated with my extension, it opens my app with the file as parameter.
Now, I want the files associated to my application to behave in Windows 10 just like images - I mean, having a thumbnail preview, so when the user selects "large icons", he would be able to see a preview of the file.
I wonder how can I do it. What kind of metadata my file should have so Windows would recognize it and show a preview. Of course, I don't want just large icons, I want a file preview just like image files.
It isn't hard for me to generate a preview bitmap and integrate it to the file format I created (or even to change the file format completely, since I didn't publish anything yet), but how would windows recognize it? Is this even possible?
Thanks in advance
After some research, I found a sample code that does exactly what I need. It creates a thumbnail provider, which have access to the file's contents (binary), and then I can use it to generate the thumbnail of the file.
The sample that creates a IThumbnailProvider can be found here:
https://code.msdn.microsoft.com/windowsapps/CppShellExtThumbnailHandler-32399b35/view/SourceCode#content
The project should generate a dll, that we should register on Windows. It might be done using the following lines:
system32/regsvr32 ThumbnailProviderx64.dll
syswow64/regsvr32 ThumbnailProviderx86.dll
unregistering is like this:
system32/regsvr32 /u ThumbnailProviderx64.dll
syswow64/regsvr32 /u ThumbnailProviderx86.dll
Another nice sample could be found at:
http://www.codemonkeycodes.com/2010/01/11/ithumbnailprovider-re-visited/

How to convert .eap file?

I have a situation here:
I have a .eap file and i have a tool available i.e., StarUML. I need to import the .eap file contents into StarUML.
Basically, i need to know how can i convert the .eap to some format to import into StarUML.(StarUML takes .mfg and .xmi as import)
Thanks in advance.
The .eap files I'm familiar with are Enterprise Architect.
There may be another approach, but I suspect you'll need to get a copy of EA and open your file. Whatever models it has in it, open each and right click on the model, you'll see an Import/Export menu. You can then export .xmi format.
You can open and edit eap files with MS Access.
For EAP files created in EA version 12.1 it is Access 2007.
Here is an overview of the internal structure.

How to change root directory of J2ME sun emulator?

I need to change the default root directory of sun mobile emulator. I know that you can create and delete roots in the appdb/filesysytem directory, but I need the root to be outside that directory lets say at my hard drive C:/root , is it possible? Thanks, hope you can help me.
I think the root folder is a property of Device configuration.
If you are working with the toolkit that ships with Netbeans looks for an ini file in the same directory where you found the appdb directory.
My best guss is tmp_jwc_properties.ini is the file you need. I haven't yet tried it though.
update
I spent some time trying to do this. But with no success so far.
The property we need to change is probably system.storage_root .
But the ini file gets over written with original values every time the IDE is restarted.
Found the original source of this temporary file in
My-NetBeans-path\mobility\Java_ME_platform_SDK_3.0\runtimes\cldc-hi-javafx\bin\jwc_properties.ini
As far as I could figure out, the IDE loads settings from this file and adds default values for settings that are not specified in this file.
I'm also new to these tool kits. Please leave a response here if you succeed in doing this.

How Do I Let the User Save to a Directory?

Language: C++
Development Environment: Microsoft Visual C++
Libraries Used: MFC
Question: I am creating a large preference editing tool with pages of dialogs with different settings for the user to customize. Each "page" of settings will be written to its own XML file.
The user will have two options: 1) Save These, where they will be prompted to specify which pages they wish to save, and 2) Save All, which will save each page into their own XML files.
For the Save All function, I'd like it if the user only had to specify a directory into which he/she wishes to save all of the files. I'm fairly certain that I have to use the FolderBrowserDialog class, but I'm not sure how. I imagine it's very similar to an OpenFile dialog or a SaveFile dialog with one of the arguments specifying to save to a directory.
I found the FolderBrowserDialog class on the MSDN, but it wasn't very helpful. Any help would be greatly appreciated!
SOLUTION: I have found a working solution. It is essentially a combination of a few answers above, but for people seeking a similar solution in the future, I referenced THIS page. The author created a wrapper class for the messy code that is needed to create a directory-chooser dialog. Thank you for all the suggestions. You all helped me along in the right direction. Cheers.
~ Jon
Use ::SHBrowseForFolder(). It shows the standard "browse for folder dialog" (at least up to Windows XP; I've no idea if Vista/7 have a new one).
I personally use it wrapped in a class, as seen here.
I think asking the user to save "individual" pages is weird, me think you should save all of them in one file (hey, but that just me).
If you need to save individual page, you will have to prompt the user with a small dialog that lists the pages and let the user select which page; or you can decide to save only the pages that were modified.
To select a folder, the simplest way is to use ShBrowseForFolder (http://msdn.microsoft.com/en-us/library/bb762115(v=vs.85).aspx)
Max.
Look into the OPENFILENAME structure and the GetSaveFileName function. The latter actually displays the save file dialog.

Changing vista file permissions programmatically

I want to add some files to C:\windows\XXX (windows protected folder, in Vista), under the "TrustedInstaller" for my application. I do not want to replace any file so no issues on Windows Resource(formerly file) protection.
I have the code to change "ownership" to the current logged in admin, however, I'm don't have any clue how to set its file permissions programmatically. I'm using VC++/MFC for development.
Thanks
I not 100% sure what you actually want (as do you want it to look like TrustedInstaller installed the files?) but look at this example of using SetNamedSecurityInfo. You generally need to constuct a Discretionary Access Control List (DACL) for your file, however you can "borrow" one off another file with the permissions you want to clone using GetNamedSecurityInfo as building a DACL from scratch is considerably more annoying.
An easy way to do it is to just use the system function to run icacls with whichever parameters you need. Note that it's found in cstdlib (#include <cstdlib>)
system("icacls <params>");

Resources