This commit is contained in:
mmacierzanka committed 2021-05-20 00:06:44 +02:00
1 parent b987172f4f
commit f06c69ad47
5 files changed
+59 -28

No files matched your search

Binary file not shown.
+2 -2
View File
@@ -17,8 +17,8 @@ WNDCLASSEX EzCreateClass(LPCWSTR name, WNDPROC messageLoop, HINSTANCE instance,
wc.hIconSm = LoadIcon(NULL, IDI_ERROR);
return wc;
}
HWND EzCreateWindow(WNDCLASSEX windowClass, HINSTANCE instance, LPCWSTR windowTitle, DWORD windowStyles, int windowWidth, int windowHeight, HWND parent) {
return CreateWindowEx(WS_EX_CLIENTEDGE, windowClass.lpszClassName, windowTitle, windowStyles, CW_USEDEFAULT, CW_USEDEFAULT, windowWidth, windowHeight, parent, NULL, instance, NULL);
HWND EzCreateWindow(WNDCLASSEX windowClass, HINSTANCE instance, LPCWSTR windowTitle, DWORD windowStyles, int windowWidth, int windowHeight, HWND parent, HMENU menu) {
return CreateWindowEx(WS_EX_CLIENTEDGE, windowClass.lpszClassName, windowTitle, windowStyles, CW_USEDEFAULT, CW_USEDEFAULT, windowWidth, windowHeight, parent, menu, instance, NULL);
}
HWND EzCreateButton(LPCWSTR label, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles) {
if (styles == NULL) {
+1 -1
View File
@@ -3,7 +3,7 @@
#ifndef FUNCTIONS_H_INCLUDED
#define FUNCTIONS_H_INCLUDED
WNDCLASSEX EzCreateClass(LPCWSTR name, WNDPROC messageLoop, HINSTANCE instance, LPCWSTR classIcon, LPCWSTR cursor);
HWND EzCreateWindow(WNDCLASSEX windowClass, HINSTANCE instance, LPCWSTR windowTitle, DWORD windowStyles, int windowWidth, int windowHeight, HWND parent);
HWND EzCreateWindow(WNDCLASSEX windowClass, HINSTANCE instance, LPCWSTR windowTitle, DWORD windowStyles, int windowWidth, int windowHeight, HWND parent, HMENU menu);
HWND EzCreateButton(LPCWSTR label, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles);
HWND EzCreateLabel(LPCWSTR startingContent, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles);
HWND EzCreateControl(LPCWSTR type, LPCWSTR startingContent, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles);
+21 -24
View File
@@ -1,30 +1,27 @@
//{{NO_DEPENDENCIES}}
// Plik dołączany wygenerowany przez program Microsoft Visual C++.
// Używane przez: Easy Audio Player.rc
#define IDS_APP_TITLE 103
#define IDR_MAINFRAME 128
#define IDD_EASYAUDIOPLAYER_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_EASYAUDIOPLAYER 107
#define IDI_SMALL 108
#define IDC_EASYAUDIOPLAYER 109
#define IDC_MYICON 2
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
// Następne wartości domyślne dla nowych obiektów
// Microsoft Visual C++ generated include file.
// Used by Easy Audio Player.rc
//
#define IDC_MYICON 2
#define IDD_EASYAUDIOPLAYER_DIALOG 102
#define IDS_APP_TITLE 103
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_EASYAUDIOPLAYER 107
#define IDI_SMALL 108
#define IDC_EASYAUDIOPLAYER 109
#define IDR_MAINFRAME 128
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 130
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
+35 -1
View File
@@ -1,17 +1,21 @@
//INCLUDES
#include "EzWinAPIBuilders.h"
#include "resource.h"
#include <ShlObj.h>
#include <debugapi.h>
#include <strsafe.h>
#define IDC_LIST 1
//GLOBAL VARS
HINSTANCE globalInstance;
MSG msg;
TCHAR path[MAX_PATH];
HFONT hFont = CreateFont(18, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Segoe UI"));
bool isAutoPlayEnabled = true;
//CONTROLS
HWND mainWindow;
HWND dirLabel;
HWND browseButton;
HWND filesListCtrl;
@@ -20,19 +24,23 @@ HWND playButton;
HWND pauseButton;
HWND npLabel;
HWND autoPlayCheck;
HMENU menuBar;
//HOOKS
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
int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLine, int nCmdShow) {
globalInstance = currentInst;
WNDCLASSEX windowClass = EzCreateClass(L"Easy Audio Player", WndProc, currentInst, NULL, IDC_ARROW);
windowClass.hIcon = (HICON)LoadImage(currentInst, L"Easy Audio Player.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_SHARED);
windowClass.hIconSm = (HICON)LoadImage(currentInst, L"Easy Audio Player.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_SHARED);
if (!RegisterClassEx(&windowClass)) {
return 1;
}
HWND mainWindow = EzCreateWindow(windowClass,currentInst,L"Easy Audio Player", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 400, 600, NULL);
menuBar = LoadMenu(currentInst, MAKEINTRESOURCE(200));
mainWindow = EzCreateWindow(windowClass,currentInst,L"Easy Audio Player", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 400, 620, NULL, menuBar);
SendMessage(mainWindow, WM_SETFONT, (WPARAM)hFont, TRUE);
ShowWindow(mainWindow, nCmdShow);
UpdateWindow(mainWindow);
@@ -157,8 +165,34 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
isAutoPlayEnabled = true;
}
}
switch (wParam) {
case IDM_EXIT:
ExitProcess(0);
break;
case IDM_ABOUT:
DialogBox(globalInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), mainWindow, About);
break;
}
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}