#include "resource.h" #include #include #include // Global variables static HINSTANCE hInst; const wchar_t CLASS_NAME[] = L"ButchunkerWindow"; // Control IDs #define IDC_CHECKBOX1 1009 #define IDC_CHECKBOX2 1008 #define IDC_CHECKBOX3 1007 #define IDC_BUTTON_CHECK 1006 // Function declarations LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { INITCOMMONCONTROLSEX icex; icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwICC = ICC_STANDARD_CLASSES | ICC_WIN95_CLASSES; InitCommonControlsEx(&icex); #ifdef _WIN32_WINNT_WINXP #pragma comment(linker, \ "/manifestdependency:\"type='win32' \ name='Microsoft.Windows.Common-Controls' \ version='6.0.0.0' \ processorArchitecture='*' \ publicKeyToken='6595b64144ccf1df' \ language='*'\"" \ ) #endif (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; }