如何在 C 中打开 Windows 中的默认 Web 浏览器? [英] How to open the default web browser in Windows in C?

查看:56
本文介绍了如何在 C 中打开 Windows 中的默认 Web 浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 中的 C 语言中,如何使用默认浏览器打开网站?在 Mac OS X 中,我做 system("open http://url");

In C in Windows, how do I open a website using the default browser? In Mac OS X, I do system("open http://url");

推荐答案

你必须使用 ShellExecute().

执行此操作的 C 代码非常简单:

The C code to do that is as simple as:

ShellExecute(NULL, "open", "http://url", NULL, NULL, SW_SHOWNORMAL);

Microsoft 知识库文章 KB 224816 对此进行了记录,但不幸的是,该文章已被弃用,并且没有存档版本.

This was documented by Microsoft Knowledge Base article KB 224816, but unfortunately the article has been retired and there's no archived version of it.

这篇关于如何在 C 中打开 Windows 中的默认 Web 浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆