From b66f645a2595946b11768134a47ee15fede882a5 Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Sun, 30 May 2021 00:00:51 +0200 Subject: [PATCH] EzWinBuilders is no more --- Easy Audio Player.vcxproj | 2 -- Easy Audio Player.vcxproj.filters | 6 ----- EzWinAPIBuilders.cpp | 40 ------------------------------- EzWinAPIBuilders.h | 10 -------- main.cpp | 26 ++++++++++++-------- 5 files changed, 16 insertions(+), 68 deletions(-) delete mode 100644 EzWinAPIBuilders.cpp delete mode 100644 EzWinAPIBuilders.h diff --git a/Easy Audio Player.vcxproj b/Easy Audio Player.vcxproj index 87a1e37..1236da2 100644 --- a/Easy Audio Player.vcxproj +++ b/Easy Audio Player.vcxproj @@ -144,13 +144,11 @@ - - diff --git a/Easy Audio Player.vcxproj.filters b/Easy Audio Player.vcxproj.filters index 20e3195..6d97899 100644 --- a/Easy Audio Player.vcxproj.filters +++ b/Easy Audio Player.vcxproj.filters @@ -24,17 +24,11 @@ Pliki nagłówkowe - - Pliki nagłówkowe - Pliki źródłowe - - Pliki źródłowe - diff --git a/EzWinAPIBuilders.cpp b/EzWinAPIBuilders.cpp deleted file mode 100644 index a232220..0000000 --- a/EzWinAPIBuilders.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "EzWinAPIBuilders.h" - -WNDCLASSEX EzCreateClass(LPCWSTR name, WNDPROC messageLoop, HINSTANCE instance, LPCWSTR classIcon, LPCWSTR cursor) { - WNDCLASSEX wc; - wc.style = 0; - wc.cbSize = sizeof(WNDCLASSEX); - wc.lpfnWndProc = messageLoop; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = instance; - wc.hIcon = LoadIcon(NULL, classIcon); - wc.hCursor = LoadCursor(NULL, cursor); - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); - wc.lpszMenuName = NULL; - wc.lpszClassName = name; - wc.cbWndExtra = 0; - wc.hIconSm = LoadIcon(NULL, IDI_ERROR); - return wc; -} -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) { - styles = WS_CHILD | WS_VISIBLE; - } - return CreateWindowEx(0, L"BUTTON", label, WS_CHILD | WS_VISIBLE, posX, posY, sizeW, sizeH, mainWindow, NULL, NULL, NULL); -} -HWND EzCreateLabel(LPCWSTR startingContent, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles) { - if (styles == NULL) { - styles = WS_CHILD | WS_VISIBLE; - } - return CreateWindowEx(0, L"STATIC", startingContent, styles, posX, posY, sizeW, sizeH, mainWindow, NULL, NULL, NULL); -} -HWND EzCreateControl(LPCWSTR type, LPCWSTR startingContent, int posX, int posY, int sizeW, int sizeH, HWND mainWindow, DWORD styles) { - if (styles == NULL) { - styles = WS_CHILD | WS_VISIBLE; - } - return CreateWindowEx(0, type, startingContent, WS_CHILD | WS_VISIBLE, posX, posY, sizeW, sizeH, mainWindow, NULL, NULL, NULL); -} \ No newline at end of file diff --git a/EzWinAPIBuilders.h b/EzWinAPIBuilders.h deleted file mode 100644 index 535139e..0000000 --- a/EzWinAPIBuilders.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once -#include -#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, 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); -#endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index f7e2f54..8699eb7 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,5 @@ //INCLUDES -#include "EzWinAPIBuilders.h" +#include #include "resource.h" #include #include @@ -59,7 +59,13 @@ 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"PAiPlayer", WndProc, currentInst, NULL, IDC_ARROW); + WNDCLASSEX windowClass = { 0 }; + windowClass.cbSize = sizeof(WNDCLASSEX); + windowClass.lpfnWndProc = WndProc; + windowClass.hInstance = currentInst; + 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.hIconSm = (HICON)LoadImage(currentInst, L"small.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_SHARED); if (!RegisterClassEx(&windowClass)) { @@ -67,7 +73,7 @@ int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLin } HACCEL shortcuts = LoadAccelerators(currentInst, MAKEINTRESOURCE(IDC_PAIPLAYER)); menuBar = LoadMenu(currentInst, (LPCWSTR)IDC_MENU); - mainWindow = EzCreateWindow(windowClass,currentInst,PROGRAM_NAME, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 400, 620, NULL, menuBar); + 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); @@ -83,19 +89,19 @@ int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLin return 0; } void CreateControls(HWND window) { - dirLabel = EzCreateLabel(L"Nie wybrano folderu", 10, 10, 250, 40, window, FALSE); + dirLabel = CreateWindowEx(0, L"STATIC", L"Nie wybrano folderu", WS_CHILD | WS_VISIBLE, 10, 10, 250, 40, window, NULL, globalInstance, NULL); SendMessage(dirLabel, WM_SETFONT, (WPARAM)hFont, TRUE); - browseButton = EzCreateButton(L"Przegl¹daj", 275, 10, 100, 30, window, NULL); + browseButton = CreateWindowEx(0, L"BUTTON", L"Przegl¹daj", WS_CHILD | WS_VISIBLE, 275, 10, 100, 30, window, NULL, 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, NULL, NULL); + 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 = EzCreateLabel(NOT_PLAYING_LABEL, -5, 460, 400, 30, window, SS_CENTER | WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE); + npLabel = CreateWindowEx(0, L"STATIC", NOT_PLAYING_LABEL, SS_CENTER | WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, -5, 460, 400, 40, window, NULL, globalInstance, NULL); SendMessage(npLabel, WM_SETFONT, (WPARAM)hFont, TRUE); - playButton = EzCreateButton(PLAY_LABEL, 75, 515, 100, 30, window, NULL); + playButton = CreateWindowEx(0, L"BUTTON", PLAY_LABEL, WS_CHILD | WS_VISIBLE, 75, 515, 100, 30, window, NULL, globalInstance, NULL); SendMessage(playButton, WM_SETFONT, (WPARAM)hFont, TRUE); - stopButton = EzCreateButton(L"Zatrzymaj", 195, 515, 100, 30, window, NULL); + stopButton = CreateWindowEx(0, L"BUTTON", L"Zatrzymaj", WS_CHILD | WS_VISIBLE, 195, 515, 100, 30, window, NULL, 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); + /*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) { if (path[0] != NULL) {