当前位置:网站首页>给程序界面增加音乐,加载背景照片。
给程序界面增加音乐,加载背景照片。
2022-07-27 15:59:00 【wangdong1328】
经过上次分享的图形界面插件,现在给大家介绍一个简单的使用,首先介绍给界面增加音乐,增加头文件#include<mmsystem.h> 在增加一个静态链接库#pragma comment(lib,"winmm.lib")
播放音乐有分格式,有.wav格式和mp3格式的音乐,他们播放音乐的代码是不同的。假如想要wav格式的音乐,可以使用百度音乐进行格式化转换。
播放WAV格式的音乐,playSound("音乐名称.wav",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC); SND_FILENAME是文件名,SND_LOOP是音乐循环播放,SND_ASYNC是playSound后立即返回。
播放MP3格式的音乐,mciSendString("open 音乐路径 alias music",0,0,0); alias是给音乐取别名为music,后面的参数全部为零。 mciSendString("play music repeat",0,0,0); 这句是为了播放音乐,两句一起用来播放音乐,repeat是重复播放。
加载背景照片的时候,在你下载后图形库插件以后,用#include<graphics.h> 这是图形库编程的头文件。
initgraph(int width,int height); 这是初始化窗口的大小,宽高代表以屏幕的左上角为(0,0),开始向下为高,向右为宽。
定义照片变量IMAGE bg;
loadimages(&bg,"照片路径");
putimages(int x,int y,&bg); //x,y表示照片放的位置。
这样就把照片加载上去了。 下次把运行结果写上,这次写的有点草率,如果有不对的地方,欢迎大家改正。
边栏推荐
- Anaconda uninstall again
- Dbeaver connection MySQL error: the server time zone value 'Ö Ð¹ ú±ê ×¼ ʱ ¼ ä‘ is unrecognized or represents more than
- Salesforce dynamic dashboard dynamic reports, limitations and Solutions
- 6月第1周易盾业务风控关注 | 新东方学而思等15家机构被顶格罚款
- Hutool digital computing
- Bug records using distributed framework WCF
- 面试常见问题一二
- JS中的冒泡排序
- Telecommuting can be easily realized in only three steps
- Learn from what you know | Yidun self-developed text real-time clustering technology, and wipe out the same kind of harmful content in social networks
猜你喜欢

机器学习之评价指标(二)——分类评价指标
![[MCU] 2.3 CPU of AT89S52](/img/4c/7b9d235bf8a919339d75a7ec95789f.png)
[MCU] 2.3 CPU of AT89S52

机器学习之评价指标(一)——回归评价指标

7月第4周易盾业务风控关注 | 最高法对APP强索个人信息进行规制

卷积神经网络——从R-CNN,Fast R-CNN到Faster R-CNN,Mask R-CNN

浅论分布式训练中的recompute机制

Notes on standardized management of "ancestral warehouse" of meituan meal

How to restrict root remote login so that ordinary users have root privileges

Interview FAQs 12

Code compliance: five reasons why developers use helix QAC
随机推荐
知物由学 | 易盾移动端同构实践,几步改善官网交互体验
How to resolve the public domain name to the intranet IP server -- quickly resolve the domain name and map the Internet access
【云图说】 第249期 移动应用安全服务—App的体检中心,全面检测,安全上路!
The global cloud market is growing rapidly, and data security has entered a strong regulatory era of rule of law
vue使用keep-alive实现页面缓存
防止sql注入
golang 自定义once,当出现error第二次重新设置
【cf】#681 A. Kids Seating (Div. 2, based on VK Cup 2019-2020 - Final)
Golang Chan implements mutual exclusion
CPU introduction
WPF做登陆界面
知物由学 | SO加固如何提升Android应用的安全性?
hutool- 数组工具
Profiles vs Permission Sets
7月第4周易盾业务风控关注 | 最高法对APP强索个人信息进行规制
Class not found: “com.parkManagement.dao.DaoTest 测试找不到测试类
Salesforce dynamic dashboard dynamic reports, limitations and Solutions
Convolutional neural network -- from r-cnn, fast r-cnn to fast r-cnn, mask r-cnn
Fast parsing combined with Huatu document encryption software
In the first week of June, risk control of e-shield business paid attention to 15 institutions such as New Oriental XRS, which were fined