【C】用C语言做一个很简单的音乐播放器

这篇博客介绍了如何使用C语言实现一个简单的音乐播放器,具备播放、暂停、继续和关闭功能。开发者需要掌握C语言基础、数据结构、string.h和mmsystem.h库的使用。文章提到,实现过程中需注意设置多字节字符集以正确读取中文歌名,并展示了运行截图。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

要求:实现音乐的播放、暂停、继续、关闭,只有这四个功能,当鼠标放在按钮上的时候按钮会变颜色

需要的知识储备:
      1.C语言基本语法
      2.数据结构的结构体
      3.string.h 内置函数的使用
      4.mmsystem.h 内置函数的使用
      5.graphics.h 内置函数的使用

先上代码:

#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<graphics.h>
#include<conio.h>
#include<mmsystem.h>
#pragma comment(lib,"winmm.lib")

//设置一个按钮的结构体,后面会用到
typedef struct Button
{
   
	int x;
	int y;
	int xx;
	int yy;
	COLORREF color;
	char* buttonStr;
}BTN, * LPBTN;

//1.创建按钮的属性
LPBTN creatButton(int x, int y, int xx, int yy, COLORREF color, char* buttonStr)
{
   
	LPBTN button = (LPBTN)malloc(sizeof(BTN));
	button->x = x;
	button->y = y;
	button->xx = xx;
	button->yy = yy;
	button->color = color;
	button->buttonStr = (char *)malloc(strlen(buttonStr) 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值