难度系数为1的送分题

hmk516 2004-05-08 08:53:41
求按钮单击事件,其响应内容为运行默认的浏览器,浏览器的URL在程序中指定。
...全文
50 5 点赞 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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
  • 打赏
  • 举报
回复
相关推荐
发帖
VC.NET
加入

7541

社区成员

.NET技术 VC.NET
申请成为版主
帖子事件
创建了帖子
2004-05-08 08:53
社区公告
暂无公告