Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有文件,可以调用它document.doc,我想用 MS Word 或其他程序(默认)打开它。解决方案(在 C++ 或 Java 中)是什么?我更喜欢 Java,但我以后需要 C++,所以我要两者兼得。
document.doc
爪哇:
Desktop.getDesktop().open(file);
详情请参阅Desktop.open(File):
Desktop.open(File)
启动关联的应用程序以打开文件。
用 C++ 应该是这样的:ShellExecute(0, 0, L"document.doc", 0, 0 , SW_SHOW );
ShellExecute(0, 0, L"document.doc", 0, 0 , SW_SHOW );
爪哇:java.awt.Desktop.getDesktop().open("document.doc");
java.awt.Desktop.getDesktop().open("document.doc");