要求:实现音乐的播放、暂停、继续、关闭,只有这四个功能,当鼠标放在按钮上的时候按钮会变颜色
需要的知识储备:
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)