我如何实现自动YouTube开放?

时间:2018-12-02 11:33:03

标签: c++ youtube

基本是瓷砖。

我该如何打开浏览器,然后打开youtube和特定的音乐。

请提前

3 个答案:

答案 0 :(得分:2)

使用system();要运行任何bash命令,请使用:

system("Browserpath http://youtube.com/");

显然,将Browserpath替换为浏览器的路径。

答案 1 :(得分:2)

在Windows上,这应该可以打开您的默认浏览器:

ShellExecute(
    NULL,                   // handle to parent window
    "open",                 // pointer to string that specifies operation to perform
    "http://youtube.com/",  // pointer to filename, folder name or resource
    NULL,                   // pointer to string that specifies executable-file parameters
    ".",                    // pointer to string that specifies default directory
    SW_SHOWNORMAL           // whether file is shown when opened
);

答案 2 :(得分:1)

您可以使用system()函数:     system("start https://www.youtube.com"); 如果使用命令“启动”,则Windows将打开默认浏览器,如果要使用其他浏览器打开,则必须用浏览器的路径替换start