summaryrefslogtreecommitdiff
path: root/gui/win32/src
diff options
context:
space:
mode:
Diffstat (limited to 'gui/win32/src')
-rw-r--r--gui/win32/src/butck_gui.rc14
-rw-r--r--gui/win32/src/main.c101
-rw-r--r--gui/win32/src/resource.h11
3 files changed, 126 insertions, 0 deletions
diff --git a/gui/win32/src/butck_gui.rc b/gui/win32/src/butck_gui.rc
new file mode 100644
index 0000000..a609d9d
--- /dev/null
+++ b/gui/win32/src/butck_gui.rc
@@ -0,0 +1,14 @@
+#include "windows.h"
+#include "resource.h"
+
+IDR_MAINMENU MENU
+BEGIN
+ POPUP "Files(&F)"
+ BEGIN
+ MENUITEM "Exit(&X)", IDM_EXIT
+ END
+ POPUP "Help(&H)"
+ BEGIN
+ MENUITEM "About(&A)...", IDM_ABOUT
+ END
+END
diff --git a/gui/win32/src/main.c b/gui/win32/src/main.c
new file mode 100644
index 0000000..b7f7603
--- /dev/null
+++ b/gui/win32/src/main.c
@@ -0,0 +1,101 @@
+#include "resource.h"
+#include <windows.h>
+
+// Global variables
+static HINSTANCE hInst;
+const wchar_t CLASS_NAME[] = L"ButchunkerWindow";
+
+// Function declarations
+LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ PWSTR pCmdLine, int nCmdShow)
+{
+ (void)hPrevInstance; // Unused parameter
+ (void)pCmdLine; // Unused parameter
+
+ hInst = hInstance;
+
+ // Register window class
+ WNDCLASSW windowClass = {0};
+ windowClass.lpfnWndProc = WindowProc;
+ windowClass.hInstance = hInstance;
+ windowClass.lpszClassName = CLASS_NAME;
+ windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ windowClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU);
+
+ if (!RegisterClassW(&windowClass)) {
+ MessageBoxW(NULL, L"Window class registration failed!", L"Error", MB_ICONERROR);
+ return 0;
+ }
+
+ const int WINDOW_WIDTH = 800;
+ const int WINDOW_HEIGHT = 600;
+
+ // Create window
+ HWND hwnd = CreateWindowExW(
+ 0, // Extended window style
+ CLASS_NAME, // Window class name
+ L"Butchunker - File Chunking Tool", // Window title
+ WS_OVERLAPPEDWINDOW, // Window style
+ CW_USEDEFAULT, CW_USEDEFAULT, // Position
+ WINDOW_WIDTH, WINDOW_HEIGHT, // Size
+ NULL, // Parent window
+ NULL, // Menu
+ hInstance, // Instance handle
+ NULL // Additional data
+ );
+
+ if (hwnd == NULL) {
+ MessageBoxW(NULL, L"Window creation failed!", L"Error", MB_ICONERROR);
+ return 0;
+ }
+
+ // Show window
+ ShowWindow(hwnd, nCmdShow);
+ UpdateWindow(hwnd);
+
+ // Message loop
+ MSG msg = {0};
+ while (GetMessage(&msg, NULL, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return 0;
+}
+
+// Window procedure function
+LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg) {
+ case WM_COMMAND: {
+ int wmId = LOWORD(wParam);
+
+ switch (wmId) {
+ case IDM_EXIT:
+ DestroyWindow(hwnd);
+ break;
+
+ case IDM_ABOUT:
+ MessageBoxW(hwnd, L"Butchunker - File Chunking Tool\nVersion 1.0.0", L"About", MB_OK);
+ break;
+
+ default:
+ return DefWindowProcW(hwnd, uMsg, wParam, lParam);
+ }
+ break;
+ }
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return 0;
+
+ default:
+ return DefWindowProcW(hwnd, uMsg, wParam, lParam);
+ }
+
+ return 0;
+}
diff --git a/gui/win32/src/resource.h b/gui/win32/src/resource.h
new file mode 100644
index 0000000..d28d2b2
--- /dev/null
+++ b/gui/win32/src/resource.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#define IDR_MAINMENU 101
+
+#define IDM_EXIT 1001
+#define IDM_ABOUT 1002
+
+#define IDC_MYBUTTON 2001
+
+#define IDC_SELECT_FILE 1003
+#define IDC_STATUS_LABEL 1004