难度系数为1的送分题

hmk516 2004-05-08 08:53:41
求按钮单击事件,其响应内容为运行默认的浏览器,浏览器的URL在程序中指定。
...全文
77 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
milkbb 2004-05-12
  • 打赏
  • 举报
回复
System::Diagnostics::Process::Start(S"theURL");
这样就行了。
不仅URL,其它文件也能根据关联正确打开,就象在Explorer中双击文件名一样。
lxcc 2004-05-12
  • 打赏
  • 举报
回复
#using <mscorlib.dll>
#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;


/// <summary>
/// Opens the Internet Explorer application.
/// </summary>
void OpenApplication(String* myFavoritesPath) {
// Start Internet Explorer. Defaults to the home page.
Process::Start(S"IExplore.exe");

// Display the contents of the favorites folder in the browser.
Process::Start(myFavoritesPath);
}

/// <summary>
/// Opens urls and .html documents using Internet Explorer.
/// </summary>
void OpenWithArguments() {
// url's are not considered documents. They can only be opened
// by passing them as arguments.
Process::Start(S"IExplore.exe", S"www.northwindtraders.com");

// Start a Web page using a browser associated with .html and .asp files.
Process::Start(S"IExplore.exe", S"C:\\myPath\\myFile.htm");
Process::Start(S"IExplore.exe", S"C:\\myPath\\myFile.asp");
}

/// <summary>
/// Uses the ProcessStartInfo class to start new processes, both in a minimized
/// mode.
/// </summary>
void OpenWithStartInfo() {

ProcessStartInfo* startInfo = new ProcessStartInfo(S"IExplore.exe");
startInfo->WindowStyle = ProcessWindowStyle::Minimized;

Process::Start(startInfo);

startInfo->Arguments = S"www.northwindtraders.com";

Process::Start(startInfo);
}

void main() {
// Get the path that stores favorite links.
String* myFavoritesPath =
Environment::GetFolderPath(Environment::SpecialFolder::Favorites);

OpenApplication(myFavoritesPath);
OpenWithArguments();
OpenWithStartInfo();
}
iintsy 2004-05-12
  • 打赏
  • 举报
回复
使用CreateProcess

BOOL ret=CreateProcess("IEXPLORE.EXE http://www.edu.cn",NULL, NULL, NULL, TRUE, 0,
NULL, NULL, &siStartInfo, &piProcInfo);
bitsbird 2004-05-11
  • 打赏
  • 举报
回复
window.open()
小鸡射手 2004-05-11
  • 打赏
  • 举报
回复
在按钮的Attribute属性中Add("onclick","..."), ...为任何javascript

7,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧