Archived
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd651ef400 | ||
|
|
ea8240768c | ||
|
|
f8a1a4aff4 | ||
|
|
031c647784 | ||
|
|
49d6fa5aa9 | ||
|
|
13588da443 | ||
|
|
948f78da10 | ||
|
|
d4a7979c11 | ||
|
|
7b2f4cb455 | ||
|
|
26bf66f985 | ||
|
|
97f1988a11 | ||
|
|
e4a5088ce2 |
No files matched your search
File renamed without changes.
@@ -31,7 +31,7 @@
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PAiPlayer.rc">
|
||||
<ResourceCompile Include="ClickPlay.rc">
|
||||
<Filter>Pliki zasobów</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
@@ -39,12 +39,12 @@
|
||||
<Image Include="small.ico">
|
||||
<Filter>Pliki zasobów</Filter>
|
||||
</Image>
|
||||
<Image Include="PAiPlayer.ico">
|
||||
<Image Include="ClickPlay.ico">
|
||||
<Filter>Pliki zasobów</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="PAiPlayer.exe.manifest">
|
||||
<Manifest Include="ClickPlay.exe.manifest">
|
||||
<Filter>Pliki źródłowe</Filter>
|
||||
</Manifest>
|
||||
</ItemGroup>
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Binary file not shown.
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31129.286
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PAiPlayer", "Easy Audio Player.vcxproj", "{C734FDA7-262E-4202-8F4E-5E3031CB9935}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClickPlay", "ClickPlay.vcxproj", "{C734FDA7-262E-4202-8F4E-5E3031CB9935}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -24,7 +24,7 @@
|
||||
<ProjectGuid>{c734fda7-262e-4202-8f4e-5e3031cb9935}</ProjectGuid>
|
||||
<RootNamespace>EasyAudioPlayer</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>PAiPlayer</ProjectName>
|
||||
<ProjectName>ClickPlay</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -152,14 +152,14 @@
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PAiPlayer.rc" />
|
||||
<ResourceCompile Include="ClickPlay.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="PAiPlayer.ico" />
|
||||
<Image Include="ClickPlay.ico" />
|
||||
<Image Include="small.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="PAiPlayer.exe.manifest" />
|
||||
<Manifest Include="ClickPlay.exe.manifest" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
@@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
+7
-6
@@ -1,23 +1,24 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by PAiPlayer.rc
|
||||
// Used by ClickPlay.rc
|
||||
//
|
||||
#define IDD_PAIPLAYER_DIALOG 102
|
||||
#define IDD_CLICKPLAY_DIALOG 102
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_PAIPLAYER 107
|
||||
#define IDI_CLICKPLAY 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_PAIPLAYER 109
|
||||
#define IDC_CLICKPLAY 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDC_MENU 200
|
||||
#define ID_PLIK_OD32774 32774
|
||||
#define ID_REFRESH 32775
|
||||
#define ID_OPCJE_ODTWARZAJPOKLIKNI32776 32776
|
||||
#define ID_OPCJE_POWTARZAJ 32777
|
||||
#define ID_OPCJE_ONCLICK 32778
|
||||
#define ID_OPCJE_LOOP 32779
|
||||
#define ID_POMOC_SKR32782 32782
|
||||
#define ID_POMOC_KBSHR 32783
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
@@ -26,7 +27,7 @@
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||
#define _APS_NEXT_COMMAND_VALUE 32780
|
||||
#define _APS_NEXT_COMMAND_VALUE 32785
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
|
||||
@@ -2,22 +2,25 @@
|
||||
#include "framework.h"
|
||||
#include "resource.h"
|
||||
#include <ShlObj.h>
|
||||
#include <debugapi.h>
|
||||
#include <strsafe.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
//USING IMPORTS
|
||||
using std::wstringstream;
|
||||
//IMPORTS
|
||||
using std::wstring;
|
||||
|
||||
//CONTROL IDS
|
||||
#define IDC_DIRLABEL 201
|
||||
#define IDC_BROWSEBTN 202
|
||||
#define IDC_LIST 203
|
||||
#define IDC_NPLABEL 204
|
||||
#define IDC_PLAYBTN 205
|
||||
#define IDC_STOPBTN 206
|
||||
|
||||
//STATIC DEFINES
|
||||
#define IDC_LIST 1
|
||||
#define EXT_LENGTH 2
|
||||
#define STATE_CHANGE 333
|
||||
|
||||
//STRING TABLE
|
||||
#define PROGRAM_NAME L"PAiPlayer"
|
||||
#define PROGRAM_NAME L"ClickPlay"
|
||||
#define NOT_PLAYING_LABEL L"Nic nie jest odtwarzane"
|
||||
#define PLAY_LABEL L"Odtwarzaj"
|
||||
#define PAUSE_LABEL L"Pauza"
|
||||
@@ -29,8 +32,8 @@ MSG msg;
|
||||
wstring ext[EXT_LENGTH] = { L"mp3", L"wav" };
|
||||
|
||||
//PATH VARS
|
||||
TCHAR path[MAX_PATH] = { NULL };
|
||||
TCHAR* selected = NULL;
|
||||
wstring path;
|
||||
wstring selected;
|
||||
|
||||
//STATE VARS
|
||||
/*
|
||||
@@ -48,7 +51,6 @@ HWND mainWindow;
|
||||
HWND dirLabel;
|
||||
HWND browseButton;
|
||||
HWND filesListCtrl;
|
||||
HWND filesListScroll;
|
||||
HWND playButton;
|
||||
HWND stopButton;
|
||||
HWND npLabel;
|
||||
@@ -58,9 +60,11 @@ HMENU menuBar;
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
//EXECUTION PART
|
||||
//ENTRY POINT
|
||||
int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLine, int nCmdShow) {
|
||||
globalInstance = currentInst;
|
||||
|
||||
//CREATE & REGISTER WINDOW CLASS
|
||||
WNDCLASSEX windowClass = { 0 };
|
||||
windowClass.cbSize = sizeof(WNDCLASSEX);
|
||||
windowClass.lpfnWndProc = WndProc;
|
||||
@@ -68,19 +72,26 @@ int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLin
|
||||
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
||||
windowClass.lpszClassName = PROGRAM_NAME;
|
||||
windowClass.hIcon = (HICON)LoadImage(currentInst, L"PAiPlayer.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_SHARED);
|
||||
windowClass.hIcon = (HICON)LoadImage(currentInst, L"ClickPlay.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_SHARED);
|
||||
windowClass.hIconSm = (HICON)LoadImage(currentInst, L"small.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_SHARED);
|
||||
if (!RegisterClassEx(&windowClass)) {
|
||||
return 1;
|
||||
}
|
||||
HACCEL shortcuts = LoadAccelerators(currentInst, MAKEINTRESOURCE(IDC_PAIPLAYER));
|
||||
|
||||
//LOAD KEYBOARD SHORTCUT TABLE
|
||||
HACCEL shortcuts = LoadAccelerators(currentInst, MAKEINTRESOURCE(IDC_CLICKPLAY));
|
||||
|
||||
//LOAD MENU BAR
|
||||
menuBar = LoadMenu(currentInst, (LPCWSTR)IDC_MENU);
|
||||
|
||||
//CREATE MAIN WINDOW
|
||||
mainWindow = CreateWindowEx(WS_EX_CLIENTEDGE, windowClass.lpszClassName, PROGRAM_NAME, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 400, 620, NULL, menuBar, currentInst, NULL);
|
||||
SendMessage(mainWindow, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
SendMessage(mainWindow, STATE_CHANGE, -1, NULL);
|
||||
ShowWindow(mainWindow, nCmdShow);
|
||||
UpdateWindow(mainWindow);
|
||||
|
||||
//INITIALIZE MESSAGE LOOP
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, shortcuts, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
@@ -90,28 +101,27 @@ int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLin
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//CREATE CONTROLS
|
||||
void CreateControls(HWND window) {
|
||||
dirLabel = CreateWindowEx(0, L"STATIC", L"Nie wybrano folderu", WS_CHILD | WS_VISIBLE, 10, 10, 250, 40, window, NULL, globalInstance, NULL);
|
||||
dirLabel = CreateWindowEx(0, L"STATIC", L"Nie wybrano folderu", WS_CHILD | WS_VISIBLE, 10, 10, 250, 40, window, (HMENU)IDC_DIRLABEL, globalInstance, NULL);
|
||||
SendMessage(dirLabel, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
browseButton = CreateWindowEx(0, L"BUTTON", L"Przegl¹daj", WS_CHILD | WS_VISIBLE, 275, 10, 100, 30, window, NULL, globalInstance, NULL);
|
||||
browseButton = CreateWindowEx(0, L"BUTTON", L"Przegl¹daj", WS_CHILD | WS_VISIBLE, 275, 10, 100, 30, window, (HMENU)IDC_BROWSEBTN, globalInstance, NULL);
|
||||
SendMessage(browseButton, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
filesListCtrl = CreateWindowEx(0, L"LISTBOX", NULL, LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_VSCROLL, 0, 50, 400, 425, window, (HMENU)IDC_LIST, globalInstance, NULL);
|
||||
SendMessage(filesListCtrl, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
npLabel = CreateWindowEx(0, L"STATIC", NOT_PLAYING_LABEL, SS_CENTER | WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, -5, 460, 400, 40, window, NULL, globalInstance, NULL);
|
||||
npLabel = CreateWindowEx(0, L"STATIC", NOT_PLAYING_LABEL, SS_CENTER | WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, -5, 460, 400, 40, window, (HMENU)IDC_NPLABEL, globalInstance, NULL);
|
||||
SendMessage(npLabel, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
playButton = CreateWindowEx(0, L"BUTTON", PLAY_LABEL, WS_CHILD | WS_VISIBLE, 75, 515, 100, 30, window, NULL, globalInstance, NULL);
|
||||
playButton = CreateWindowEx(0, L"BUTTON", PLAY_LABEL, WS_CHILD | WS_VISIBLE, 75, 515, 100, 30, window, (HMENU)IDC_PLAYBTN, globalInstance, NULL);
|
||||
SendMessage(playButton, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
stopButton = CreateWindowEx(0, L"BUTTON", L"Zatrzymaj", WS_CHILD | WS_VISIBLE, 195, 515, 100, 30, window, NULL, globalInstance, NULL);
|
||||
stopButton = CreateWindowEx(0, L"BUTTON", L"Zatrzymaj", WS_CHILD | WS_VISIBLE, 195, 515, 100, 30, window, (HMENU)IDC_STOPBTN, globalInstance, NULL);
|
||||
SendMessage(stopButton, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
/*filesListScroll = CreateWindowEx(0, L"SCROLLBAR", NULL, WS_CHILD | WS_VISIBLE | SBS_VERT, 300, 50, 50, 425, NULL, NULL, NULL, NULL);*/
|
||||
}
|
||||
void GetFiles(TCHAR* path, wstring ext) {
|
||||
|
||||
//GET FILES FROM DIRECTORY
|
||||
void GetFiles(wstring path, wstring ext) {
|
||||
if (path[0] != NULL) {
|
||||
wstringstream findPathStream;
|
||||
findPathStream << wstring(path);
|
||||
findPathStream << L"\\*.";
|
||||
findPathStream << ext;
|
||||
wstring findPathS = findPathStream.str();
|
||||
wstring findPathS = path + L"\\*." + ext;
|
||||
LPCWSTR findPath = findPathS.c_str();
|
||||
WIN32_FIND_DATA data;
|
||||
HANDLE hFind = FindFirstFile(findPath, &data);
|
||||
@@ -124,29 +134,35 @@ void GetFiles(TCHAR* path, wstring ext) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//INITALIZE FOLDER PICKER
|
||||
BOOL FolderBrowseDialog(HWND window) {
|
||||
BROWSEINFO dialog = { 0 };
|
||||
dialog.hwndOwner = window;
|
||||
dialog.ulFlags = BIF_NEWDIALOGSTYLE;
|
||||
dialog.lpszTitle = L"Wybierz folder, który ma zostaæ otwarty przez program";
|
||||
LPITEMIDLIST pid = SHBrowseForFolder(&dialog);
|
||||
TCHAR currentPath[MAX_PATH];
|
||||
if (pid != 0) {
|
||||
SHGetPathFromIDList(pid, path);
|
||||
SetCurrentDirectory(path);
|
||||
SetWindowText(dirLabel, path);
|
||||
SHGetPathFromIDList(pid, currentPath);
|
||||
path = wstring(currentPath);
|
||||
SetCurrentDirectory(path.c_str());
|
||||
SetWindowText(dirLabel, path.c_str());
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
void Play(TCHAR* path, TCHAR* fileName) {
|
||||
if (path[0] != NULL && selected != NULL) {
|
||||
|
||||
//MCI PROCESSOR
|
||||
void Play(wstring path, wstring fileName) {
|
||||
if (path[0] != NULL && selected.empty() == false) {
|
||||
//STOP PREVIOUS PLAYBACKS
|
||||
mciSendString(L"close mp3", NULL, 0, NULL);
|
||||
|
||||
//GET PATH
|
||||
wstring fullPath = wstring(path) + L"\\" + wstring(selected);
|
||||
wstring fullPath = path + L"\\" + selected;
|
||||
WIN32_FIND_DATA fileData;
|
||||
HANDLE fileExist = FindFirstFile(fullPath.c_str(), &fileData);
|
||||
if (fileExist == INVALID_HANDLE_VALUE) {
|
||||
@@ -156,11 +172,7 @@ void Play(TCHAR* path, TCHAR* fileName) {
|
||||
}
|
||||
|
||||
//PROCESS COMMAND
|
||||
wstringstream fullCommandStream;
|
||||
fullCommandStream << "open \"";
|
||||
fullCommandStream << fullPath;
|
||||
fullCommandStream << "\" type mpegvideo alias mp3";
|
||||
wstring fullCommandS = fullCommandStream.str();
|
||||
wstring fullCommandS = L"open \"" + fullPath + L"\" type mpegvideo alias mp3";
|
||||
LPCWSTR fullCommand = fullCommandS.c_str();
|
||||
|
||||
//PLAY THE SOUND
|
||||
@@ -178,6 +190,8 @@ void Play(TCHAR* path, TCHAR* fileName) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//MESSAGE LOOP
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
int windowId, windowEvent;
|
||||
switch (msg) {
|
||||
@@ -193,62 +207,63 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
case WM_COMMAND:
|
||||
windowId = LOWORD(wParam);
|
||||
windowEvent = HIWORD(wParam);
|
||||
if (windowId == IDC_LIST) {
|
||||
if (windowEvent == LBN_SELCHANGE) {
|
||||
LRESULT listItemsCount = SendMessage(filesListCtrl, LB_GETCOUNT, NULL, NULL);
|
||||
int selectedItemIndex = -1;
|
||||
for (int i = 0; i < listItemsCount; i++) {
|
||||
if (SendMessage(filesListCtrl, LB_GETSEL, (WPARAM)i, NULL) > 0) {
|
||||
selectedItemIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedItemIndex != -1) {
|
||||
LRESULT selectedLength = SendMessage(filesListCtrl, LB_GETTEXTLEN, (WPARAM)selectedItemIndex, NULL);
|
||||
selected = new TCHAR[selectedLength];
|
||||
SendMessage(filesListCtrl, LB_GETTEXT, (WPARAM)selectedItemIndex, (LPARAM)selected);
|
||||
}
|
||||
if (isAutoPlayEnabled == TRUE) {
|
||||
Play(path, selected);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
|
||||
}
|
||||
}
|
||||
if (windowEvent == LBN_SELCANCEL) {
|
||||
selected = NULL;
|
||||
}
|
||||
}
|
||||
if ((HWND)lParam == browseButton) {
|
||||
if (FolderBrowseDialog(mainWindow) == TRUE) {
|
||||
mciSendString(L"close mp3", NULL, 0, NULL);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 0, NULL);
|
||||
SendMessage(filesListCtrl, LB_RESETCONTENT, NULL, NULL);
|
||||
for (int i = 0; i < EXT_LENGTH; i++) {
|
||||
GetFiles(path, ext[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((HWND)lParam == stopButton) {
|
||||
mciSendString(L"close mp3", NULL, 0, NULL);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 0, NULL);
|
||||
}
|
||||
else if ((HWND)lParam == playButton) {
|
||||
switch (currentState) {
|
||||
case 0:
|
||||
Play(path, selected);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
|
||||
break;
|
||||
case 1:
|
||||
mciSendString(L"pause mp3", NULL, 0, NULL);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 2, NULL);
|
||||
break;
|
||||
case 2:
|
||||
mciSendString(L"resume mp3", NULL, 0, NULL);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (windowId) {
|
||||
case IDC_BROWSEBTN:
|
||||
if (FolderBrowseDialog(mainWindow) == TRUE) {
|
||||
mciSendString(L"close mp3", NULL, 0, NULL);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 0, NULL);
|
||||
SendMessage(filesListCtrl, LB_RESETCONTENT, NULL, NULL);
|
||||
for (int i = 0; i < EXT_LENGTH; i++) {
|
||||
GetFiles(path, ext[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IDC_LIST:
|
||||
if (windowEvent == LBN_SELCHANGE) {
|
||||
LRESULT listItemsCount = SendMessage(filesListCtrl, LB_GETCOUNT, NULL, NULL);
|
||||
int selectedItemIndex = -1;
|
||||
for (int i = 0; i < listItemsCount; i++) {
|
||||
if (SendMessage(filesListCtrl, LB_GETSEL, (WPARAM)i, NULL) > 0) {
|
||||
selectedItemIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedItemIndex != -1) {
|
||||
LRESULT selectedLength = SendMessage(filesListCtrl, LB_GETTEXTLEN, (WPARAM)selectedItemIndex, NULL);
|
||||
TCHAR* selectionBuffer = new TCHAR[selectedLength];
|
||||
SendMessage(filesListCtrl, LB_GETTEXT, (WPARAM)selectedItemIndex, (LPARAM)selectionBuffer);
|
||||
selected = wstring(selectionBuffer);
|
||||
}
|
||||
if (isAutoPlayEnabled == TRUE) {
|
||||
Play(path, selected);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
|
||||
}
|
||||
}
|
||||
if (windowEvent == LBN_SELCANCEL) {
|
||||
selected.clear();
|
||||
}
|
||||
break;
|
||||
case IDC_PLAYBTN:
|
||||
switch (currentState) {
|
||||
case 0:
|
||||
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
|
||||
Play(path, selected);
|
||||
break;
|
||||
case 1:
|
||||
SendMessage(mainWindow, STATE_CHANGE, 2, NULL);
|
||||
mciSendString(L"pause mp3", NULL, 0, NULL);
|
||||
break;
|
||||
case 2:
|
||||
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
|
||||
mciSendString(L"resume mp3", NULL, 0, NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IDC_STOPBTN:
|
||||
mciSendString(L"close mp3", NULL, 0, NULL);
|
||||
SendMessage(mainWindow, STATE_CHANGE, 0, NULL);
|
||||
break;
|
||||
case IDM_EXIT:
|
||||
SendMessage(mainWindow, WM_CLOSE, NULL, NULL);
|
||||
break;
|
||||
@@ -286,6 +301,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
isLoopEnabled = TRUE;
|
||||
}
|
||||
break;
|
||||
case ID_POMOC_KBSHR:
|
||||
MessageBox(mainWindow, L"F1 = ekran skrótów klawiszowych\nF2 = ekran Informacje\nF5 = odœwie¿ listê plików", L"Skróty klawiszowe", MB_ICONASTERISK);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MM_MCINOTIFY:
|
||||
@@ -296,41 +314,39 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
currentState = (int)wParam;
|
||||
switch (currentState) {
|
||||
case -1:
|
||||
EnableWindow(filesListCtrl, FALSE);
|
||||
EnableWindow(playButton, FALSE);
|
||||
EnableWindow(stopButton, FALSE);
|
||||
SetWindowText(npLabel, L"-");
|
||||
EnableWindow(filesListCtrl, FALSE);
|
||||
SetWindowText(playButton, PLAY_LABEL);
|
||||
EnableMenuItem(menuBar, ID_REFRESH, MF_DISABLED);
|
||||
SetWindowText(npLabel, L"-");
|
||||
SetWindowText(playButton, PLAY_LABEL);
|
||||
break;
|
||||
case 0:
|
||||
EnableWindow(filesListCtrl, TRUE);
|
||||
EnableWindow(playButton, TRUE);
|
||||
EnableWindow(stopButton, TRUE);
|
||||
SetWindowText(npLabel, NOT_PLAYING_LABEL);
|
||||
EnableWindow(filesListCtrl, TRUE);
|
||||
SetWindowText(playButton, PLAY_LABEL);
|
||||
EnableMenuItem(menuBar, ID_REFRESH, MF_ENABLED);
|
||||
SetWindowText(npLabel, NOT_PLAYING_LABEL);
|
||||
SetWindowText(playButton, PLAY_LABEL);
|
||||
break;
|
||||
case 1:
|
||||
EnableWindow(filesListCtrl, FALSE);
|
||||
EnableWindow(playButton, TRUE);
|
||||
EnableWindow(stopButton, TRUE);
|
||||
SetWindowText(npLabel, selected);
|
||||
EnableWindow(filesListCtrl, FALSE);
|
||||
SetWindowText(playButton, PAUSE_LABEL);
|
||||
EnableMenuItem(menuBar, ID_REFRESH, MF_DISABLED);
|
||||
SetWindowText(npLabel, selected.c_str());
|
||||
SetWindowText(playButton, PAUSE_LABEL);
|
||||
break;
|
||||
case 2:
|
||||
wstring pauseStringWS = selected + L" [PAUZA]";
|
||||
LPCWSTR pauseString = pauseStringWS.c_str();
|
||||
|
||||
EnableWindow(filesListCtrl, FALSE);
|
||||
EnableWindow(playButton, TRUE);
|
||||
EnableWindow(stopButton, TRUE);
|
||||
wstringstream pauseStringS;
|
||||
pauseStringS << wstring(selected);
|
||||
pauseStringS << " [PAUZA]";
|
||||
wstring pauseStringWS = pauseStringS.str();
|
||||
LPCWSTR pauseString = pauseStringWS.c_str();
|
||||
EnableMenuItem(menuBar, ID_REFRESH, MF_DISABLED);
|
||||
SetWindowText(npLabel, pauseString);
|
||||
SetWindowText(playButton, L"Wznów");
|
||||
EnableMenuItem(menuBar, ID_REFRESH, MF_DISABLED);
|
||||
EnableWindow(filesListCtrl, FALSE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -339,6 +355,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//ABOUT DIALOG LOOP
|
||||
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
switch (message) {
|
||||
|
||||
+7
-6
@@ -1,23 +1,24 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by PAiPlayer.rc
|
||||
// Used by ClickPlay.rc
|
||||
//
|
||||
#define IDD_PAIPLAYER_DIALOG 102
|
||||
#define IDD_CLICKPLAY_DIALOG 102
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_PAIPLAYER 107
|
||||
#define IDI_CLICKPLAY 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_PAIPLAYER 109
|
||||
#define IDC_CLICKPLAY 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDC_MENU 200
|
||||
#define ID_PLIK_OD32774 32774
|
||||
#define ID_REFRESH 32775
|
||||
#define ID_OPCJE_ODTWARZAJPOKLIKNI32776 32776
|
||||
#define ID_OPCJE_POWTARZAJ 32777
|
||||
#define ID_OPCJE_ONCLICK 32778
|
||||
#define ID_OPCJE_LOOP 32779
|
||||
#define ID_POMOC_SKR32782 32782
|
||||
#define ID_POMOC_KBSHR 32783
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
@@ -26,7 +27,7 @@
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||
#define _APS_NEXT_COMMAND_VALUE 32780
|
||||
#define _APS_NEXT_COMMAND_VALUE 32785
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user