从设置位置播放文件 [英] Play files from setup location

查看:67
本文介绍了从设置位置播放文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要播放声音或从用户定义的位置显示图像,这是设置位置,我不想从资源中使用它

我想从设置位置的文件夹中调用它

任何人都可以帮我这样做吗?



我尝试了什么:



我不知道该怎么做^^

Hello guys,
I need to play a sound or display an image from a user-defined location which is the setup location and I don't want to use it from resources
I want to call it from a folder in the setup location
Can anyone help me to do this ?

What I have tried:

I don't know how to do this ^^

推荐答案

有几种方法可以做到这一点,但它们完全依赖于你的意思。

如果文件位于同一文件夹(或子文件夹)中,则应用程序EXE文件为在,然后获取应用程序文件夹,并从那里工作。

如果它位于用户安装应用程序时指定的位置,但不一定与应用程序EXE文件夹相关,那么您需要将文件夹位置存储在某处 - 在配置文件中或在绝对绝望中在注册表中,以便您的应用程序可以访问它。



我们不知道是什么操作系统或框架rk你的应用程序是为了编写的,所以我们不能给你明确的指示如何做到这一点(例如,本机linux应用程序的解决方案将与C ++ .NET CLI应用程序非常不同),但谷歌搜索配置文件C ++或可执行文件位置C ++,您的目标系统应该为您提供所需的信息。
There are a couple of ways to do this, but they depend on exactly what you mean.
If the file is in the same folder (or a subfolder of) the app EXE file is in, then get the app folder, and work from there.
If it's in a location that the user specifies when he installs the app, but not necessarily related to the app EXE file folder, then you need to store that folder location somewhere - either in a config file or (in absolute desperation) in the Registry so your app can access it.

We don't know what OS or framework your app is written for, so we can't give you explicit instructions on how to do any of that (the solution for a native linux app would be very different from a C++ .NET CLI app for example), but Googling "Config file C++" or "Executable location C++" and your target system should get you the info you need.


这篇关于从设置位置播放文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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