如何在程序中打开.mp3, .exe, .chm文件? ---介绍一下ShellExecute的用途

来源:互联网 发布:android商城数据接口 编辑:程序博客网 时间:2024/05/01 18:41

       下面, 我们看看ShellExecute的重要用途, 用它来打开.mp3, .exe, .chm, 当然啦, 在当前工程中必须有这些文件。

#include <windows.h>int main(){ShellExecute(0, 0, "beauty_voice.mp3", 0, 0, 0);return 0;}
      上面程序会唱歌。


#include <windows.h>int main(){ShellExecute(0, 0, "test.exe", 0, 0, 0);return 0;}
      上面程序会启动test.exe


#include <windows.h>int main(){ShellExecute(0, 0, "help.chm", 0, 0, 0);return 0;}
      上面程序会打开help.chm



       而且我发现,system函数也可以打开test.exe和help.chm, 但打不开.mp3. 所以有局限性。 而且, 用system会弹出一个黑框框, 不好。

      





0 0