changeset 52:cf9a14755472

Use Win32 libraries to copy files
author Paper <37962225+mrpapersonic@users.noreply.github.com>
date Sun, 22 May 2022 04:20:11 -0400
parents 0f6c604b6863
children bc85395ff699
files src/gui.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui.c	Sun May 22 04:11:30 2022 -0400
+++ b/src/gui.c	Sun May 22 04:20:11 2022 -0400
@@ -86,10 +86,10 @@
 
 void save_file(HWND hWnd, char* input_file) {
 	if (strcmp(input_file, " ") == 0) {
-		MessageBox(hWnd, 
-					"Please open a file first!", 
-					"Invalid input file!", 
-					MB_ICONEXCLAMATION); 
+		MessageBox(hWnd,
+					TEXT("Please open a file first!"),
+					TEXT("Invalid input file!"),
+					MB_ICONEXCLAMATION);
 		return;
 	}
 	OPENFILENAME ofn;
@@ -108,10 +108,12 @@
 		return;
 	}
 
-	copy_file(input_file, output_file);
+	if (CopyFile((TCHAR*)input_file, (TCHAR*)output_file, 0) == 0) {
+		MessageBox(hWnd, TEXT("Failed to copy original project file! Does the destination file already exist?"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION);
+	}
 	FILE* output = fopen(output_file, "r+b");
 	if (output == NULL) {
-		MessageBox(hWnd, "Failed to save project file!", "Saving project failed!", MB_ICONEXCLAMATION); 
+		MessageBox(hWnd, TEXT("Failed to save project file!"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION); 
 		return;
 	}
 
@@ -166,7 +168,7 @@
 	/* Save File */
 	HWND save_button = CreateWindowA("Button", "Save", WS_VISIBLE | WS_CHILD, (int)((225 - 50)/2), 90, 50, 20, hWnd, (HMENU)SAVE_FILE_BUTTON, NULL, NULL);
 	if (open_button == NULL || save_button == NULL || hWndListBox == NULL || hWndComboBox == NULL)
-		MessageBoxA(hWnd, "how did you even trigger this", "GUI could not be initialized!", MB_ICONEXCLAMATION); 
+		MessageBox(hWnd, TEXT("how did you even trigger this"), TEXT("GUI could not be initialized!"), MB_ICONEXCLAMATION); 
 }
 
 bool CALLBACK SetFont(HWND child, LPARAM font) {
@@ -221,7 +223,7 @@
 
 	if (!RegisterClass(&wc)) return -1;
 
-	CreateWindow("msvpvf", "Movie Studio / Vegas Pro version spoofer", WS_OVERLAPPED | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU, 100, 100, 225, 200, NULL, NULL, hInstance, NULL);
+	CreateWindow(TEXT("msvpvf"), TEXT("Movie Studio / Vegas Pro version spoofer"), WS_OVERLAPPED | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU, 100, 100, 225, 200, NULL, NULL, hInstance, NULL);
 
 	MSG msg = {0};