Mercurial > msvpvf
diff src/gui.c @ 88:af4ed765c1ac
*: add IUP GUI
a lot simpler than win32, but I assume there's more going on in
the background that I don't know about :)
author | Paper <paper@tflc.us> |
---|---|
date | Mon, 14 Jul 2025 02:39:24 -0400 |
parents | c06dcab17923 |
children | 42a1f64eb4b5 |
line wrap: on
line diff
--- a/src/gui.c Mon Jul 15 01:35:03 2024 -0400 +++ b/src/gui.c Mon Jul 14 02:39:24 2025 -0400 @@ -13,8 +13,6 @@ #include <stdint.h> #include <stdio.h> -#include <tchar.h> /* tchar versions of string.h functions */ - #include "common.h" /* make sure this is defined... */ @@ -34,13 +32,6 @@ VERSION }; -#if UNICODE -/* use COM when `UNICODE=1` to avoid file paths being cut off */ -#include <shobjidl.h> - -static const DWORD COM_INITFLAGS = (COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); -#endif - /* user-adjustable. set these values to whatever you want, the GUI will scale */ #define WINDOW_WIDTH 225U #define WINDOW_HEIGHT 200U @@ -120,7 +111,7 @@ IShellItem* result = NULL; if (SUCCEEDED(CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, &IID_IFileOpenDialog, (LPVOID*)&pfd))) { - pfd->lpVtbl->SetFileTypes(pfd, ARRAYSIZE(filters), filters); + pfd->lpVtbl->SetFileTypes(pfd, ARRAY_SIZE(filters), filters); pfd->lpVtbl->SetFileTypeIndex(pfd, 1); pfd->lpVtbl->Show(pfd, hWnd); @@ -196,8 +187,8 @@ IFileDialog* pfd = NULL; IShellItem* result = NULL; if (com_initialized && SUCCEEDED(CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER, &IID_IFileSaveDialog, (LPVOID*)&pfd))) { - pfd->lpVtbl->SetFileTypes(pfd, ARRAYSIZE(filters), filters); - pfd->lpVtbl->SetFileTypeIndex(pfd, (type == TYPES_UNKNOWN) ? ARRAYSIZE(filters) : type - TYPES_UNKNOWN); + pfd->lpVtbl->SetFileTypes(pfd, ARRAY_SIZE(filters), filters); + pfd->lpVtbl->SetFileTypeIndex(pfd, (type == TYPES_UNKNOWN) ? ARRAY_SIZE(filters) : type - TYPES_UNKNOWN); pfd->lpVtbl->SetFileName(pfd, output_template); pfd->lpVtbl->Show(pfd, hWnd); @@ -291,7 +282,7 @@ /* Type */ HWND listbox = CreateWindow(TEXT("Listbox"), NULL, WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_NOTIFY, WINDOW_WIDTH * 5 / 18, WINDOW_HEIGHT * 11 / 40, WINDOW_WIDTH * 4 / 9, WINDOW_HEIGHT / 5, hWnd, (HMENU)LISTBOX, NULL, NULL); - for (size_t i = 0; i < ARRAYSIZE(types); i++) { + for (size_t i = 0; i < ARRAY_SIZE(types); i++) { LRESULT pos = SendMessage(listbox, LB_ADDSTRING, i, (LPARAM)type_to_string(types[i])); SendMessage(listbox, LB_SETITEMDATA, pos, types[i]); if (types[i] == type) @@ -375,6 +366,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR args, int ncmdshow) { WNDCLASS wc = {0}; + MSG msg = {0}; wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.hCursor = LoadCursor(NULL, IDC_ARROW); @@ -386,8 +378,6 @@ CreateWindowEx(WS_EX_ACCEPTFILES, TEXT("msvpvf"), TEXT("Movie Studio / Vegas Pro version spoofer"), WS_OVERLAPPED | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInstance, NULL); - MSG msg = {0}; - while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg);