How to make an html page open automatically on a C

2019-01-17 17:59发布

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 way to do this (the MSDN cds do this) either by purchasing software or otherwise?

标签: html dvd cd
6条回答
虎瘦雄心在
2楼-- · 2019-01-17 18:02

ShelExec is your ticket. It is free and allows you to specify an optional ico file too.

查看更多
狗以群分
3楼-- · 2019-01-17 18:04

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.

查看更多
ら.Afraid
4楼-- · 2019-01-17 18:05

It's dead simple. I use a program called Autorun Pro. Check out this guide.

查看更多
可以哭但决不认输i
5楼-- · 2019-01-17 18:17

I used (the free version of) AutoRunPro

I remember when I was confronted with the problem once

[autorun]
shellexecute=path\to\htmlfile.html

just wouldn't work on most PC's. I used a program called AutorunPro.EXE, just copied it in the root, and the autorun.inf was :

[Autorun]
open=AutoRunPro.exe

[AutorunPro]
; Here are some sample uses for Autorunpro. It keeps processing Them in Run1..RunN         order until it doesnt find one.
Run1=index.htm
Run2=.

Moreover, you can open several programs, pages, ... with this method in one go.

In either case : test your method beforehand, you don't actually have to burn a CD/DVD in order to do that : look here

查看更多
老娘就宠你
6楼-- · 2019-01-17 18:23

You should be able to do with a relatively simple autorun.inf file in the CD/DVD's root directory:

[autorun]
shellexecute=path\to\htmlfile.html
查看更多
闹够了就滚
7楼-- · 2019-01-17 18:25

If you don't want to trust to third party programs, or skip over them entirely you can read the MSDN AutoRun Reference. It's not too bad.

查看更多
登录 后发表回答