放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!放暑假啦!
你是不是以为我要水一期 ???
请继续往down看!
开始工作!
嗯。。。上期说到哪了。。。。
是这个吧:
/*/
* Editor Chaunge:C/C++
* Compile:MinGW GCC 9.2.0 32-bit Debug
* Compile Place:Visual Stdio 2017
*
* Need Files:
*-as.png
* To Immersive Send Put.
*
*-Ceil.exe
* To Test.
*
*-*.mp3
* To Send.
*
* Them All You Do Not New!
/*/
/*********************************************************
* EGE (Easy Graphics Engine)
* FileName ege.h
* HomePage1 http://misakamm.github.com/xege
* HomePage2 http://misakamm.bitbucket.org/index.htm
* teiba1 http://tieba.baidu.com/f?kw=ege
* teiba2 http://tieba.baidu.com/f?kw=ege%C4%EF
* Blog: http://misakamm.com
* E-Mail: mailto:misakamm[at gmail com]
*
* FileName: ege.h
* 在 VC 下模拟 Borland BGI 绘图库,实现简单的绘图之余,扩展了较复杂的绘图能力
*
* 包含并使用本库时,不要包含conio.h头文件
* 这些头文件不应共存,否则可能会编译错误,
* 或者getch被conio.h内的覆盖(由包含次序决定),请注意
* 如需共存,请使用多文件分开包含的模式使用,
* 即不能一个cpp同时包含,但可以分开包含
* 使用本库,必须用C++编译,可支持的编译器:
* VC6/VC2008/VC2010/VC2012/VC2013/MinGW3.4.5/MinGW4.7.1/MinGW4.8.1
*********************************************************/
/****************************************************************************
** 注意事项:
* ★如果需要显示控制台窗口,请在包含本文件的前面加一行define SHOW_CONSOLE
* ★调用Sleep这个API时,或者调用delay,实际均会转化为调用delay_ms,如必需调用API请使用api_sleep
* ★delay_ms(0)能自行判断有没有更新的必要,连续多次但不大量的调用并不会产生帧率的影响
* ★调用delay_ms, delay_fps, getch, getkey, getmouse 时,窗口内容可能会更新,这些函数相当于内置了delay_ms(0),
* 如果你只需要更新窗口,而不想等待,可以用delay_ms(0)。注意delay只延时而不更新窗口
* ★合理地使用delay_ms/delay_fps函数,可以减少你的程序占用的CPU,否则一个都没有调用同时也没有getch/getmouse的话,程序将占满一个CPU的时间
****************************************************************************/
#include <Button.h>
#include <heker.h>
#include <ARTTEXT.h>
#include <lm.h>
#include "ege.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <tchar.h>
#define WM_SYSTEMTRAY WM_USER+100
#define info "E:\\OpenCV.ico"
#define Down 80
#define Up 72
#define Left 75
#define Right 77
using namespace std;
using namespace ege;
pid_t waitpid(pid_t pid, int *status, int options);
struct TIME
{
int year;
int week;
int day;
int shi;
int fen;
int miao;
int haomiao;
};
struct ATTRIBUTES
{
string name;
int harm;
};
Button RememberSummer = NewButton(1, 5, 12, "1、忆夏");
Button YourRiversAndMount = NewButton(3, 5, 14, "2、你的万水千山(原版)");
Button YourRiversAndMountDJ = NewButton(5, 5, 11, "3、你的万水千山(DJ版)");
Button Sometimes = NewButton(7, 5, 13, "4、可能 - 程响");
Button LetItGo = NewButton(9, 5, 10, "5、Let It Go - 随它吧");
Button Show = NewButton(11, 5, 9, "◆软件说明");
Button Tool = NewButton(13, 5, 15, "◆实用小工具");
Button Files = NewButton(15, 5, 13, "打开文件...");
Button Clock = NewButton(3, 11, 11, "钟表");
Button Input = NewButton(5, 11, 12, "录音");
Button Pictue = NewButton(7, 11, 13, "截图");
Button Empty = NewButton(3, 10, 11, "直接播放");
Button Repeat = NewButton(5, 10, 12, "单曲循环");
Button Sleepy = NewButton(7, 9, 13, "沉浸式播放");
LPCSTR Title;
TIME Time;
string MP3;
MUSIC bgMusic;
int WIN = 800;
int WINMOD = WIN / 10;
char OFMUSIC[100];
int level[5];
int project = 0;
double all;
double average;
void SendSong(const char *song);
void Cmd();
void ToolsWork();
void start();
void Loading();
const char * File();
VOID KillConsoleCloseButton();
VOID OpenConsoleCloseButton();
void BeepMusic(const char *musicname)
{
bgMusic.OpenFile(musicname);
bgMusic.SetVolume(1.0f);
if (bgMusic.IsOpen()) {
bgMusic.Play(0);
}
}
BOOL IsOsWin7OrAbove()
{
BOOL bOSWin7OrAbove = FALSE;
// 下面要调用NetWkstaGetInfo
DWORD dwLevel = 100;
LPWKSTA_INFO_100 lpWkStaInfo100 = NULL;
NET_API_STATUS statusRet = NetWkstaGetInfo( NULL, dwLevel, (LPBYTE*)&lpWkStaInfo100 );
if ( statusRet == NERR_Success )
{
// win8及以上版本
if ( (lpWkStaInfo100->wki100_ver_major == 6 && lpWkStaInfo100->wki100_ver_minor == 0) ||
lpWkStaInfo100->wki100_ver_major == 6 )
{
bOSWin7OrAbove = TRUE;
}
}
// Free the allocated memory
if ( lpWkStaInfo100 != NULL )
{
NetApiBufferFree( lpWkStaInfo100 );
}
return bOSWin7OrAbove;
}
BOOL CanRun = IsOsWin7OrAbove();
void WHILE()
{
system("mode con cols=30 lines=17");
HWND hWnd = GetConsoleWindow();
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
Art_Title("Maker Sound Player");
HideCursor();
system("color 0f");
while(1)
{
if(Preserve(RememberSummer) == 1 || -32767 == GetAsyncKeyState('1'))
{
//MessageBox(NULL, "按下ESC返回", "温馨提示", MB_OK);
Title = "忆夏";
Time = {0, 0, 0, 0, 2, 43, 0};
//SendSong("无标题.wma");
SendSong("忆夏.mp3");
}
else if(Preserve(YourRiversAndMount) == 1 || -32767 == GetAsyncKeyState('2'))
{
//MessageBox(NULL, "按下ESC返回", "温馨提示", MB_OK);
Title = "你的万水千山";
Time = {0, 0, 0, 0, 4, 9, 0};
SendSong("你的万水千山.mp3");
}
else if(Preserve(YourRiversAndMountDJ) == 1 || -32767 == GetAsyncKeyState('3'))
{
//MessageBox(NULL, "按下ESC返回", "温馨提示", MB_OK);
Title = "你的万水千山DJ";
Time = {0, 0, 0, 0, 4, 45, 0};
SendSong("你的万水千山DJ.mp3");
}
else if(Preserve(Sometimes) == 1 || -32767 == GetAsyncKeyState('4'))
{
//MessageBox(NULL, "按下ESC返回", "温馨提示", MB_OK);
Title = "可能 - 程响";
Time = {0, 0, 0, 0, 3, 38, 0};
SendSong("可能.mp3");
}
else if(Preserve(LetItGo) == 1 || -32767 == GetAsyncKeyState('5'))
{
Title = "Let It Go - 随它吧";
Time = {0, 0, 0, 0, 3, 43, 0};
SendSong("随它吧.mp3");
}
else if(Preserve(Show) == 1 || -32767 == GetAsyncKeyState('6'))
{
system("start show.exe");
}
else if(Preserve(Tool) == 1 || -32767 == GetAsyncKeyState('7'))
{
ToolsWork();
}
else if(Preserve(Files) == 1 || -32767 == GetAsyncKeyState('8'))
{
const char * QQQ = File();
SendSong(QQQ);
}
if ((::GetKeyState(VK_CONTROL) & 0x80) && -32767 == GetAsyncKeyState('Q'))
{
system("start clock.exe");
_sleep(1000);
system("start 日历.exe");
}
else if((::GetKeyState(VK_CONTROL) & 0x80) && -32767 == GetAsyncKeyState('A'))
{
system("SoundLisen.exe");
}
else if((::GetKeyState(VK_CONTROL) & 0x80) && -32767 == GetAsyncKeyState('Z'))
{
system("screener_plugin.exe");
}
}
}
int main(){
if(CanRun == FALSE)
{
Hide();
MessageBox(NULL, "很遗憾!\n此产品不支持当前系统版本!\n(仅支持 Windows 7)\n","Sound Player.exe 系统错误!", MB_ICONERROR|MB_OK);
exit(0);
}
start();
Loading();
WHILE();
return 0;
}
void Loading()
{
system("mode con cols=30 lines=12");
__color(11);
KillConsoleCloseButton();
for (int i = 1; i <= 2; i++)
{
for (int i = 1; i <= 5; i++)
printf("\n");
printf(" ■□\n");
printf(" □□\n");
_sleep(200);
system("cls");
for (int i = 1; i <= 5; i++)
printf("\n");
printf(" □■\n");
printf(" □□\n");
_sleep(200);
system("cls");
for (int i = 1; i <= 5; i++)
printf("\n");
printf(" □□\n");
printf(" □■\n");
_sleep(200);
system("cls");
for (int i = 1; i <= 5; i++)
printf("\n");
printf(" □□\n");
printf(" ■□\n");
_sleep(200);
system("cls");
}
BeepMusic("SNA.wav");
OpenConsoleCloseButton();
_sleep(1000);
KillConsoleCloseButton();
_sleep(350);
OpenConsoleCloseButton();
}
VOID KillConsoleCloseButton(VOID) {
DeleteMenu(GetSystemMenu(GetConsoleWindow(), FALSE),
SC_CLOSE, MF_DISABLED);
DrawMenuBar(GetConsoleWindow());
}
VOID OpenConsoleCloseButton(VOID) {
DeleteMenu(GetSystemMenu(GetConsoleWindow(), TRUE),
SC_CLOSE, MF_DISABLED);
DrawMenuBar(GetConsoleWindow());
}
void start()
{
system("mode con cols=100 lines=30");
HWND hWnd = GetConsoleWindow();
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
Art_Title("Of Cookie Maker ");
HideCursor();
system("color af");
BeepMusic("WIN.wav");
for (int i = 1; i <= 15; i++)
printf("\n");
for (int i = 1; i <= 5; i++)
printf("\t");
printf("Cookie MaKer %c\n",1);
_sleep(1000);
system("color 8f");
_sleep(400);
system("color 08");
_sleep(200);
system("cls");
_sleep(1000);
system("color 0f");
}
void ToolsWork()
{
//screener_plugin.exe //截图软件
//SoundLisen.exe //录音软件
system("mode con cols=30 lines=11");
Art_Title("实用小工具");
while(1)
{
if(Preserve(Clock) == 1 || -32767 == GetAsyncKeyState('1'))
{
system("start clock.exe");
_sleep(1000);
system("start 日历.exe");
}
else if(Preserve(Input) == 1 || -32767 == GetAsyncKeyState('2'))
{
system("SoundLisen.exe");
}
else if(Preserve(Pictue) == 1 || -32767 == GetAsyncKeyState('3'))
{
system("screener_plugin.exe");
}
else if(-32767 == GetAsyncKeyState(key_esc))
{
Art_Title("Maker Sound Player");
HideCursor();
system("mode con cols=30 lines=13");
break;
}
}
}
void Cmd()
{
mciSendString("pause music", NULL, 0, NULL);
system("cls");
system("color 8e");
printf("请输入指令: ");
cin >> MP3;
if(MP3 == "gettime")
printf("\n0%d:0%d:%d",Time.shi, Time.fen, Time.miao);
if(MP3 == "close")
exit(0);
if(MP3 == "chang" || MP3 == "change")
{
system("mode con cols=100 lines=30");
mciSendString("close music", NULL, 0, NULL);
cout << "请输入您需要播放的SongID:";
cin >> MP3;
system("mode con cols=30 lines=11");
if(MP3 == "你的万水千山")
{
Title = "你的万水千山";
Time = {0, 0, 0, 0, 4, 9, 0};
SendSong("你的万水千山.mp3");
}
else if(MP3 == "你的万水千山DJ")
{
Title = "你的万水千山DJ";
Time = {0, 0, 0, 0, 4, 45, 0};
SendSong("你的万水千山DJ.mp3");
}
else if(MP3 == "忆夏")
{
Title = "忆夏";
Time = {0, 0, 0, 0, 2, 43, 0};
SendSong("忆夏.mp3");
}
else if(MP3 == "可能")
{
Title = "可能 - 程响";
Time = {0, 0, 0, 0, 3, 38, 0};
SendSong("可能.mp3");
}
else if(MP3 == "随它吧" || MP3 == "Let it go" || MP3 == "Let It Go" || MP3 == "Letitgo" || MP3 == "LetItGo")
{
Title = "Let It Go - 随它吧";
Time = {0, 0, 0, 0, 3, 43, 0};
SendSong("随它吧.mp3");
}
}
if(MP3 == "ceil")
{
printf("del YiXia.Send\n");
_sleep(100);
printf("del YouHanDie.Send\n");
_sleep(100);
printf("del Windows.Bat\n");
_sleep(300);
printf("mmself\n");
_sleep(400);
printf("del gdp.*\n");
_sleep(1000);
printf("del IMAGE*\n");
_sleep(600);
printf("Sleep of opp pga\n");
_sleep(2000);
printf("WAIT TIME 1\n");
_sleep(100);
printf("del IMAGE *\n");
_sleep(600);
printf("To ComePuter Of An ProJect ProBlem Printf In Put Xi Ma To : TanYuPM*\n");
_sleep(2300);
}
if(MP3 == "feedback")
{
printf("现在开始进入评价打分");
for(int i = 1; i <= 3; i++)
{
_sleep(700);
printf(".");
}
printf("\n最高分5分!\n");
_sleep(300);
printf("\"鼠标选择\"评分:");
cin >> level[project];
project++;
printf("\"按键控制\"评分:");
cin >> level[project];
project++;
printf("\"画面优美\"评分:");
cin >> level[project];
project++;
printf("\"音乐流畅\"评分:");
cin >> level[project];
project++;
all = level[0] + level[1] + level[2] + level[3];
average = all / project;
printf("平均分是:");
_sleep(400);
cout << average;
printf("\n");
if(average > 5)
average = 5;
if(average <= 2)
printf("抱歉让您失望了,本公司将会继续努力,直到您满意奥!");
if(average == 5 || average == 4)
printf("非常感谢您对本产品的信赖和支持!");
printf("\n谢谢反馈!");
}
system("pause");
system("color af");
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%d",WINMOD);
mciSendString("resume music", NULL, 0, NULL);
}
void SendSong(const char *song)
{
system("mode con cols=30 lines=11");
CHAR PRESS;
BOOL ISPLAY = TRUE;
char beep[60] = "open ";
char alias[20] = " alias music";
int BEEPOF;
char arr;
int i = 0;
char ss[100];
mciSendString("close music", 0, 0, 0);
system("color 0f");
system("cls");
system("color 1f");
system("color 2f");
system("color 3f");
system("color 4f");
system("color 5f");
system("color 6f");
system("color 7f");
system("color 8f");
system("color 9f");
system("color af");
system("color bf");
system("color cf");
system("color df");
system("color ef");
system("color 1f");
system("color 2f");
system("color 3f");
system("color 4f");
system("color 5f");
system("color 6f");
system("color 7f");
system("color 8f");
system("color 9f");
system("color af");
system("color bf");
system("color cf");
system("color df");
system("color ef");
system("color 1f");
system("color 2f");
system("color 3f");
system("color 4f");
system("color 5f");
system("color 6f");
system("color 7f");
system("color 8f");
system("color 9f");
system("color af");
system("color bf");
system("color cf");
system("color df");
system("color ef");
strcat(beep, song);
strcat(beep, alias);
system("color 0f");
system("cls");
while(1)
{
if(Preserve(Empty) == 1 || -32767 == GetAsyncKeyState('1'))
{
BEEPOF = 0;
break;
}
else if(Preserve(Repeat) == 1 || -32767 == GetAsyncKeyState('2'))
{
BEEPOF = 1;
break;
}
else if(Preserve(Sleepy) == 1 || -32767 == GetAsyncKeyState('3'))
{
BEEPOF = 2;
break;
}
}
system("color 0f");
system("cls");
printf("\n\n\n\t好的,马上开始...");
_sleep(1000);
system("color 08");
_sleep(500);
system("cls");
_sleep(1500);
system("color af");
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%d",WINMOD);
Art_Title(Title);
if(BEEPOF == 0)
{
mciSendString(beep, NULL, 0, NULL);
mciSendString("play music", NULL, 0, NULL);
}
if(BEEPOF == 1)
{
mciSendString(beep, NULL, 0, NULL);
mciSendString("play music repeat", NULL, 0, NULL);
}
if(BEEPOF == 2)
{
mciSendString(beep, NULL, 0, NULL);
mciSendString("play music", NULL, 0, NULL);
/**/
setinitmode(1, 0, 0);
initgraph(-1, -1);
PIMAGE a = newimage();
getimage(a, "as.png");
putimage(0, 0, a);
/**/
}
while(1)
{
sprintf(OFMUSIC, "setaudio music volume to %d", WIN);
mciSendString(OFMUSIC,0,0,0);
PRESS = getch();
if(PRESS == ' ' && ISPLAY == TRUE)
{
mciSendString("pause music", NULL, 0, NULL);
ISPLAY = FALSE;
}
else if(PRESS == ' ' && ISPLAY == FALSE){
mciSendString("resume music", NULL, 0, NULL);
ISPLAY = TRUE;
}
else if(KEY_DOWN(VK_LBUTTON) && ISPLAY == FALSE)
{
mciSendString("resume music", NULL, 0, NULL);
ISPLAY = TRUE;
}
else if(KEY_DOWN(VK_LBUTTON) && ISPLAY == TRUE)
{
mciSendString("pause music", NULL, 0, NULL);
ISPLAY = FALSE;
}
else if(PRESS == 27)
{
//mciSendString("close music", NULL, 0, NULL);
if (BEEPOF == 2)
closegraph();
WHILE();
}
else if(PRESS == 't' || PRESS == 'T')
{
Cmd();
/*/
命令行
指令:
close
gettime
change
chang
feedback
/*/
}
else if(PRESS == '+' || PRESS == '=' || PRESS == Up)
{
int WINMOD = WIN / 10;
if(WINMOD >= 100)
{
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:100");
}
else
{
WIN += 5;
WINMOD = WIN / 10;
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%d",WINMOD);
}
}
else if(PRESS == '-' || PRESS == '_' || PRESS == Down)
{
WINMOD = WIN / 10;
if(WINMOD <= 0)
{
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:0");
}
else
{
WIN -= 5;
WINMOD = WIN / 10;
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%d",WINMOD);
}
}else if(PRESS == Right)
{
i += 5000;
sprintf(ss,"seek music to %d", i);
mciSendString(ss, 0, 0, 0);
mciSendString("play music", 0, 0, 0);
}else if(PRESS == Left)
{
i -= 5000;
sprintf(ss,"seek music to %d", i);
mciSendString(ss, 0, 0, 0);
mciSendString("play music", 0, 0, 0);
}
}
}
const char * File()
{
// 初始化OPENFILENAME结构体
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL; // 父窗口句柄,若无则设为NULL
ofn.lpstrFilter = "Music Files\0*.mp3;*.wav;*.aac;*.flac\0"; // 文件过滤器
ofn.lpstrFile = new char[MAX_PATH]; // 用于接收用户选择的文件名的缓冲区
ZeroMemory(ofn.lpstrFile, MAX_PATH);
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; // 设置对话框标志
// 显示打开文件对话框
if (GetOpenFileNameA(&ofn))
{
// 用户选择了文件,此时ofn.lpstrFile包含完整的文件路径
const char * selectedFile = ofn.lpstrFile;
return selectedFile;
// 对selectedFile进行处理,例如读取音乐文件等操作
}
else
{
//delete[] ofn.lpstrFile;
}
delete[] ofn.lpstrFile; // 释放内存
}
好吧,836行代码,我又崩溃了!
What?你还没走?
真的没了!
恭喜你发现彩蛋!:耐心者!