How do you go about setting which program runs a particular file extension? So for example, I want program.exe to launch whenever a file with extension .ext is run. Is this info in the registry somewhere?
You could set the program that is associated with a particular file extension in the folder options menu item of the windows explorer, if that is what you mean.
srfink
OK. Here's an example of how you could do it programatically:
// The following code snippet sets the file program
// that is associated with the cnf extension to WORDPAD
char szProductType[80];
DWORD dwBufLen;
HKEY hTestKey = NULL;
LONG lResult = ::RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.cnf\\OpenWithList", 0,
KEY_ALL_ACCESS, &hTestKey);
if ((ERROR_SUCCESS == lResult) && (hTestKey != NULL))
{
strcpy(szProductType,"WORDPAD.exe"
lResult = RegSetValueEx(hTestKey, "a", NULL, REG_SZ, (LPBYTE) szProductType, dwBufLen);
RegCloseKey(hTestKey);
}
Hows this?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.