Windows file association to open with Eclipse/CDT editor - eclipse-cdt

How can I open a file with Eclipse/CDT when I double click it in windows explorer?
I set the file association in windoes to eclipsec.exe and it opened Eclipse/CDT, but not the file.
If Eclipse is open, it says "Workspace in use..."
Ideas?
mcb

this Might be what you are looking for
http://wiki.eclipse.org/Eclipse/OpenFileFeature

This article may be somewhat helpful, it talks about associating content types with specific editors:
http://www.developer.com/java/other/article.php/3648736/Eclipse-Tip-Define-Custom-Content-Types-to-Identify-Your-Data-Files.htm
In addition, an [Eclipse book on Google Books gives instructions on associating file types.][2]
Also, see this.
[2]: http://books.google.com/books?id=6Ob1ANNVcXcC&pg=PA59&lpg=PA59&dq=how+to+associate+a+file+extension+with+eclipse&source=bl&ots=jlFv9NRjyt&sig=OrWkd8nvLFVXuM5SWexG2uWeAHM&hl=en&ei=_GTWSqePBtPTlAf85JWjBg&sa=X&oi=book_result&ct=result&resnum=14&ved=0CDwQ6AEwDQ#v=onepage&q=how to associate a file extension with eclipse&f=false

Associate the file type with eclipse.exe, not eclipsec.exe.
If the file type is not already associated with an application then you can choose the application by double-clicking the file, otherwise you will need to open the "Set Associations" app from control panel.
a. In Windows 7 this is done via the "Default Programs" item in "Control Panel".
b. Inside that item there's an option labeled "Associate a file type... with a program".
c. Look for the filetype, in my case I looked for .java. Select it and click "Change program..." in the upper right.
From there click "Browse..." and find eclipse.exe, not eclipsec.exe, in your filesystem, select it and click ok.
Now when you double-click the file it will be opened in eclipse regardless of whether eclipse is already open.

Related

How to register an ActiveX control?

If I don't even know its name...
I dowloaded VC++ project and it crashes because of the dialog's ActiveX control.
The error is:
"The ActiveX control "09551E46-E250-11D2-9A56-0080C605ADA4" is not registered on this computer. Register the control and try again."
Which .ocx file do I need?
Based on a quick search on the web, that GUID may identify the MMWaveEditX - Advanced Wave File Editor Control

How to prevent "How do you want to open this file" dialog?

In my app I open a report using HTML file as such:
//pStrPath is file:///C:/Users/appts/AppData/Local/Temp/Report_View.htm
ShellExecute(hParentWnd, L"", pStrPath, NULL, NULL, SW_SHOW);
On my development machine it opens up in a web browser, but when I just tested it on a new installation of Windows 10, it showed this dialog instead:
So how can I prevent it from being shown and go with "keep using this app" option from the get-go? Otherwise it may be very confusing for my users.
PS. Note that Edge is installed and can open .htm files if I double-click them.
Referring to Launching Applications (ShellExecute, ShellExecuteEx, SHELLEXECUTEINFO) we note the text
Object Verbs
The verbs available for an object are essentially the items that you find on an object's shortcut menu. To find which verbs are available, look in the registry under HKEY_CLASSES_ROOT\CLSID{object_clsid}\Shell\verb
Commonly available verbs include:
edit - Launches an editor and opens the document for editing.
find - Initiates a search starting from the specified directory.
open - Launches an application. If this file is not an executable
file, its associated application is launched.
print - Prints the document file.
properties - Displays the object's properties.
Given that a double-click is the generally equivalent to selecting "open" in the object's shortcut menu, if we supply the function with the open verb, we can expect the behaviour to mirror that of a user's double-click. - Please see Ken's comment below
As such, we can expect the following code to achieve the desired result.
//pStrPath is file:///C:/Users/appts/AppData/Local/Temp/Report_View.htm
ShellExecute(hParentWnd, L"open", pStrPath, NULL, NULL, SW_SHOW);
If you are trying to open the default program FROM a 32 bit program in 64 bit Windows the ShellExecute and ShellExecuteEX may display the "How do you want to open this file?" dialog box each time. This is due to the way that the default program registered itself in Windows I think.
I could reproduce this error on Windows 11 fresh install where the Photos is set to the Default Program for .jpg files.
In my case, I found that if I use the ShellExecuteExW function and pass the extension into the .lpClass of SHELLEXECUTEINFOW Type that it works.
It should also work with the ShellExecuteExA function
Make sure it's not an exe, reg, bat file, or a URL you are trying to open. It has to be a document type of file.
Use the .lpClass to pass the extension like ".jpg"
Add the SEE_MASK_CLASSNAME As Long = &H1 to the .fMask parameter you are passing in like .fMask = YourMaskValue Or SEE_MASK_CLASSNAME
The reason I think this works is it bypasses any redirection and reads directly from the HKEY_CLASSES_ROOT.jpg

Is there a special method to remove a shortcut from a desktop?

I created a shortcut (.lnk) file on the desktop using the IShellLink interface similar to the code described at the bottom of this page.
So my assumption was that to remove this shortcut I could simply call DeleteFile on the .lnk file, but evidently it is not enough... if I do that I get a remnant of the shortcut file that looks like this:
But what is interesting is that if I browse files in the desktop folder, say with Windows Explorer, the .lnk file is not actually there. What I see is some artifact on the desktop GUI surface.
Any idea how to remove a shortcut (the way Microsoft wants it done?)
OK, per suggestion above, here's the API that needs to be called afterwards to refresh the shell:
SHChangeNotify(SHCNE_DELETE, SHCNF_PATH | SHCNF_FLUSHNOWAIT, pDeletedFilePath, NULL);

Is there a way to know if the user has enabled "single click to open an item" in the control panel?

My program needs to know when the user has enabled "Single-click to open an item (point to select)" in the folder options window in file explorer. I have a mouse aid program and I need to know what this setting is set to programmatically? Is this available in the registry or something?
I think it's SHGetSettings when fDoubleClickInWebView is false
I found this on Kelly's Korner
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"ShellState"=hex:24,00,00,00,13,a8,01,00,00,00,00,00,00,00,00,00,00,00,00,00,\
01,00,00,00,0d,00,00,00,00,00,00,00,02,00,00,00
I don't know which value sets the single click mode, so you'll have to disable it and compare the registry with this string to see which it is.
The same information is on a Microsoft support page, but as it's referring to IE 4 and IE 5 I was worried it was outdated.
There's a reg file you can download, but it appears to be missing the initial open double quote.

Adding an item to Internet Explorer's right-click context menu

I'm trying to add a new entry into Internet Explorer's right-click context menu. I understand that this can be achieved by creating an HTML file containing JavaScript, and then linking to this from a location in the registry. I have also read that you can also add the HTML to a resource file and compile it into a DLL (see the Microsoft KB: Adding Entries to the Standard Context Menu). This is where I have started to hit problems.
Here is a bit of background about what I have done so far.
I have the following JavaScript in the file C:\test.htm:
<script type="text/javascript">
alert('Hello, world!');
</script>
I have added a new REG_SZ value 'c:\test.htm' in the registry at the following location:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt
If I now restart IE, my new menu item appears in the context menu. If I select my new menu item, my message box alert appears as expected. So far so good. However, I can't seem to access the script if it's in a DLL. Here are the steps I have taken:
Created a new Visual C++ Class Library project in VS 2005 named 'IETest' in c:\IETest
Imported my C:\test.htm file into the default app.rc resource file. I have changed the ID to be TEST
Compiled the DLL in debug mode
Altered the registry entry to read
res://C:\IETest\debug\IETest.dll/TEST
If I now restart IE and try again, the message box does not appear when I right-click and select my new context menu entry. I have also tried a release build of the DLL without any luck, and also tried replacing the last forward slash with a comma and altering the path single-backslashes to double-slashes.
I can only presume that I've done something wrong when creating my DLL. Can anyone point me in the right direction? Is there any way I can examine the compiled DLL to examine the resources and associated IDs?
Thanks.
Have you tried having the ID be TEST.html? My guess is that IE doesn't know how to handle the file because it doesn't have an extension listed, but this is totally a guess based off the fact that's how certain MS .dlls identify them (i.e. res://c:\windows\system32\shdoclc.dll/navcancl.htm)
The only other thing I can think of is to make sure your resources are of type 23.
ResourceHacker can view the resource files like you want: http://angusj.com/resourcehacker/