当前位置:网站首页>给程序界面增加音乐,加载背景照片。
给程序界面增加音乐,加载背景照片。
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表示照片放的位置。
这样就把照片加载上去了。 下次把运行结果写上,这次写的有点草率,如果有不对的地方,欢迎大家改正。
边栏推荐
- 类的六大关系——依赖和关联的区别
- 用slmgr命令激活正版Win7旗舰版系统
- JDBC connection database reading foreground cannot display data
- [Southwest University] information sharing of postgraduate entrance examination and re examination
- mysql解决唯一索引重复导致的插入失败问题
- Operation of simulated examination platform for 2022 low voltage electrician examination questions
- Wechat applet cloud function batch delete multiple data error: errcode: -502005 database collection not exists
- TCP connection status identification (syn, fin, ACK, PSH, RST, urg)
- 注释中的{@code}、{@Link} 与<p>等标签
- 知物由学 | 易盾移动端同构实践,几步改善官网交互体验
猜你喜欢

Error launching IDEA

vue使用keep-alive实现页面缓存

工信部再治数据安全,网易易盾“隐私合规”守住企业经营底线
How to improve the security of Android applications?

WPF做登陆界面

Code compliance: five reasons why developers use helix QAC

Learn from things | Yidun mobile terminal isomorphism practice, improve the official website interaction experience in a few steps

【Codeforces】 A. Computer Game

canvas根据坐标点绘制图形

The global cloud market is growing rapidly, and data security has entered a strong regulatory era of rule of law
随机推荐
Telecommuting can be easily realized in only three steps
Wechat applet to make calls
org.gradle.api.UncheckedIOException: Could not load properties for module ‘gradle-kotlin-dsl‘ from C
【cf】#681 A. Kids Seating (Div. 2, based on VK Cup 2019-2020 - Final)
卷积神经网络——YOLOV1论文翻译
Convolutional neural network -- Translation of yolov2 (yolo9000) papers
Resolve merge fields in salesforce
How to improve the security of Android applications?
hutool- 数字计算
Understand │ what is cross domain? How to solve cross domain problems?
PostgreSQL 14 支持winserver2022吗?
浅论分布式训练中的recompute机制
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
Bug records using distributed framework WCF
Convolutional neural network -- SSD thesis translation
【云图说】 第249期 移动应用安全服务—App的体检中心,全面检测,安全上路!
Personal understanding of convolution calculation process of convolution neural network
Numpy array matrix operation
hutool 字符串工具类
Count the six weapons of the domestic interface cooperation platform!