无法在C++中启动网站

Can't launch website in C++

本文关键字:启动 网站 C++      更新时间:2023-10-16

尝试在Visual C++ 2010 Express中启动网站,每个研究的解决方案都没有奏效。所以我收集我需要更深入的帮助。这是我的代码:

#include <stdafx.h>
#include <stdio.h>
#include <iostream>
#include <io.h>
#include <string>
#include <string.h>
#include <conio.h>
#include <windows.h>
using namespace System;
using namespace std;
int main()
{
char name[240];

cout<<"nHello, Please enter your name: ";
cin.getline(name,240);
cout<<"nHello "<<name <<", your ID has been confirmed!";

cout<<"nContinuing to launch website 'xyz' now.";
//  system("C:\Program%Files\Google\Chrome\Application\chrome.exe");
ShellExecute, TEXT("open"), TEXT(c:\program                                     
    files\google\chrome\application\chrome.exe), NULL, NULL, SW_SHOWNORMAL;
goto end;
end:
cout<<"nnProgram completed, Pess any key to exit. ";
_getch();
return 0;
}

像这样。

ShellExecute(NULL, TEXT("open"), TEXT("c:\program files\google\chrome\application\chrome.exe"), NULL, NULL, SW_SHOWNORMAL);

您的路径中缺少参数,缺少双引号,并且很可能在"程序"和"文件"之间有虚假字符。您还缺少 ShellExecute 的参数。

阅读一本书并学习最少C++语法将是一个好主意。这些都是非常基本的错误。

system(""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://heise.de");

为我工作。请参阅如何使用参数调用外部程序?