LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Receive a file from the 'send to' menu in Windows Explorer

Hello,

I have put some of your suggestions together and came up with a solution. I wrote a little example program that does the trick. The program is called RegisterTest. After installation, the user is asked if he wants al *.regtest files to be opened automatically with the program RegisterTest.exe (All this program does is show the filename).
How it works:
In the Advanced Distribution Kit options I enter RegisterTest.exe as the executable to run after setup, and "Register File Type" as command line. This causes the program to run after setup wit the arguments "RegisterTest.exe", "Register", "File" and "Type". If these arguments are detected in the main function, some values are added to the registry, so the system recognises the extension *.regtest as a RegisterTest file.

The code:

int main (int argc, char *argv[]){
    char projectdir [MAX_PATHNAME_LEN];
    char reg_str [MAX_PATHNAME_LEN];

    if (argc > 1){
        if (!StrICmp (argv[0], "RegistryTest.exe") && !StrICmp (argv[1], "Register") && !StrICmp (argv[2], "File") && !StrICmp (argv[3], "Type")){
            if (ConfirmPopup ("","Do you want to register the filetype *.regtest to RegistryTest.exe?")){
                RegWriteString (REGKEY_HKCR, ".regtest", NULL, "RegistryTest");
                GetProjectDir (projectdir);
                sprintf (reg_str, "%s\\RegistryTest.exe %%1", projectdir);
                RegWriteString (REGKEY_HKCR, "RegistryTest\\shell\\open\\command", NULL, reg_str);
            }
        }
        else MessagePopup ("Filename", *argv);
    }
    return 0;
}

Message 11 of 11
(794 Views)