How to make an html page open automatically on a CD/DVD

前端 未结 6 1339
梦毁少年i
梦毁少年i 2020-12-09 06:10

I need to include an html page (table of contents) on a CD/DVD. I\'d like the html page to open automatically when the user puts the CD/DVD in their machine. Is there a wa

6条回答
  •  暖寄归人
    2020-12-09 06:26

    You can create simple executable yourself. In Visual Studio in example.

    Not sure it can be call one-liner but it is not far from it :-)

    #include "stdafx.h"
    #include "windows.h"
    #include "Shellapi.h"
    
    int main(int argc, char* argv[])
    {
        ::ShellExecute(NULL, "open", "path\to\htmlfile.html", 0, 0, SW_NORMAL);
        return 0;
    }
    

    To avoid hard-coding you can try passing path as a parameter in command line.

    autorun file must be added to the CD. File can look like this.

    [autorun]
    icon=\MySexyIcon.ico
    label=MySuperCD
    open=YourExecutable.exe
    

    Please bear in mind that it will not work on iOS though.

提交回复
热议问题