EzWinBuilders is no more

This commit is contained in:
mmacierzanka committed 2021-05-30 00:00:51 +02:00
1 parent f0d2bae6c2
commit b66f645a25
5 files changed
+16 -68

No files matched your search

-2
View File
@@ -144,13 +144,11 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="EzWinAPIBuilders.h" />
<ClInclude Include="framework.h" /> <ClInclude Include="framework.h" />
<ClInclude Include="Resource.h" /> <ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="EzWinAPIBuilders.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
-6
View File
@@ -24,17 +24,11 @@
<ClInclude Include="Resource.h"> <ClInclude Include="Resource.h">
<Filter>Pliki nagłówkowe</Filter> <Filter>Pliki nagłówkowe</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="EzWinAPIBuilders.h">
<Filter>Pliki nagłówkowe</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Pliki źródłowe</Filter> <Filter>Pliki źródłowe</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="EzWinAPIBuilders.cpp">
<Filter>Pliki źródłowe</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="PAiPlayer.rc"> <ResourceCompile Include="PAiPlayer.rc">
-40
View File
@@ -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);
}
-10
View File
@@ -1,10 +0,0 @@
#pragma once
#include <Windows.h>
#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
+16 -10
View File
@@ -1,5 +1,5 @@
//INCLUDES //INCLUDES
#include "EzWinAPIBuilders.h" #include <windows.h>
#include "resource.h" #include "resource.h"
#include <ShlObj.h> #include <ShlObj.h>
#include <debugapi.h> #include <debugapi.h>
@@ -59,7 +59,13 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
//EXECUTION PART //EXECUTION PART
int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLine, int nCmdShow) { int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLine, int nCmdShow) {
globalInstance = currentInst; 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.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); windowClass.hIconSm = (HICON)LoadImage(currentInst, L"small.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_SHARED);
if (!RegisterClassEx(&windowClass)) { if (!RegisterClassEx(&windowClass)) {
@@ -67,7 +73,7 @@ int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLin
} }
HACCEL shortcuts = LoadAccelerators(currentInst, MAKEINTRESOURCE(IDC_PAIPLAYER)); HACCEL shortcuts = LoadAccelerators(currentInst, MAKEINTRESOURCE(IDC_PAIPLAYER));
menuBar = LoadMenu(currentInst, (LPCWSTR)IDC_MENU); 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, WM_SETFONT, (WPARAM)hFont, TRUE);
SendMessage(mainWindow, STATE_CHANGE, -1, NULL); SendMessage(mainWindow, STATE_CHANGE, -1, NULL);
ShowWindow(mainWindow, nCmdShow); ShowWindow(mainWindow, nCmdShow);
@@ -83,19 +89,19 @@ int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLin
return 0; return 0;
} }
void CreateControls(HWND window) { 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); 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); 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); 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); 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); 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); 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) { void GetFiles(TCHAR* path, wstring ext) {
if (path[0] != NULL) { if (path[0] != NULL) {