Hi All,
OK, before I start coding, I want to make sure the process I need to use is
correct. I want the context menu in my app to look/act the same as the
system context menu for any given object. So, as an example, I want to setup
a context menu for a picturebox.
Let's say that I limit the contents of the picturebox to JPG files. So, when
the user right clicks on the picturebox, I need to look at the registry
(HKEY_ClASSES_ROOT) entry for .jpg (Default Value). If the user has not
added any Graphics packages to his system, the Default Value will be
jpegfile. I then go to the jpegfile registry entry (still in
HKEY_CLASSES_ROOT) and look at the shell subkey. The shell subkey may have
some subkeys like Open, Edit, Preview. I add these menu items to my context
menu. Whatever the command values are for these subkeys will be what I need
to use for each item in my context menu.
If the user has added some programs to the system, the default value for the
..jpg key may not be jpegfile. For instance, if the user has added ACDSee,
the default value might be ACDSee.jpg. In this case, I would go to that
registry entry and look at the shell subkeys.
In all cases I'll need to create a temporary copy of the image (maybe
something like C:\Temp\pictureboxname.jpg), then use the temp jpg file for
whatever action the user requested.
Now, I want to delete this temp jpg file when the user finishes doing
whatever they wanted to do (open, edit, preview, etc). So, I'll need to
create a thread for whatever command is executed, and when the thread
terminates I can delete the temp file. If the user selected the edit item,
when the thread terminates, I'll need to load the temp jpg file back to the
picturebox first, then delete the temp file.
Keeping in mind that I want the context menu in my app to provide the same
functions as the system context menu, does this process make sense, or am I
missing a much simpler way to accomplish the same thing?
Regards and TIA,
Lee