Mercurial > msvpvf
comparison src/gui.c @ 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 | 0d62f49c1948 |
comparison
equal
deleted
inserted
replaced
51:0f6c604b6863 | 52:cf9a14755472 |
---|---|
84 return strdup(filename); | 84 return strdup(filename); |
85 } | 85 } |
86 | 86 |
87 void save_file(HWND hWnd, char* input_file) { | 87 void save_file(HWND hWnd, char* input_file) { |
88 if (strcmp(input_file, " ") == 0) { | 88 if (strcmp(input_file, " ") == 0) { |
89 MessageBox(hWnd, | 89 MessageBox(hWnd, |
90 "Please open a file first!", | 90 TEXT("Please open a file first!"), |
91 "Invalid input file!", | 91 TEXT("Invalid input file!"), |
92 MB_ICONEXCLAMATION); | 92 MB_ICONEXCLAMATION); |
93 return; | 93 return; |
94 } | 94 } |
95 OPENFILENAME ofn; | 95 OPENFILENAME ofn; |
96 char output_file[256]; | 96 char output_file[256]; |
97 | 97 |
106 | 106 |
107 if (GetSaveFileName(&ofn) == 0) { | 107 if (GetSaveFileName(&ofn) == 0) { |
108 return; | 108 return; |
109 } | 109 } |
110 | 110 |
111 copy_file(input_file, output_file); | 111 if (CopyFile((TCHAR*)input_file, (TCHAR*)output_file, 0) == 0) { |
112 MessageBox(hWnd, TEXT("Failed to copy original project file! Does the destination file already exist?"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION); | |
113 } | |
112 FILE* output = fopen(output_file, "r+b"); | 114 FILE* output = fopen(output_file, "r+b"); |
113 if (output == NULL) { | 115 if (output == NULL) { |
114 MessageBox(hWnd, "Failed to save project file!", "Saving project failed!", MB_ICONEXCLAMATION); | 116 MessageBox(hWnd, TEXT("Failed to save project file!"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION); |
115 return; | 117 return; |
116 } | 118 } |
117 | 119 |
118 switch ((int)type) { | 120 switch ((int)type) { |
119 case vf: { | 121 case vf: { |
164 } | 166 } |
165 SendMessage(hWndListBox, LB_SETCURSEL, (WPARAM)0, (LPARAM)0); | 167 SendMessage(hWndListBox, LB_SETCURSEL, (WPARAM)0, (LPARAM)0); |
166 /* Save File */ | 168 /* Save File */ |
167 HWND save_button = CreateWindowA("Button", "Save", WS_VISIBLE | WS_CHILD, (int)((225 - 50)/2), 90, 50, 20, hWnd, (HMENU)SAVE_FILE_BUTTON, NULL, NULL); | 169 HWND save_button = CreateWindowA("Button", "Save", WS_VISIBLE | WS_CHILD, (int)((225 - 50)/2), 90, 50, 20, hWnd, (HMENU)SAVE_FILE_BUTTON, NULL, NULL); |
168 if (open_button == NULL || save_button == NULL || hWndListBox == NULL || hWndComboBox == NULL) | 170 if (open_button == NULL || save_button == NULL || hWndListBox == NULL || hWndComboBox == NULL) |
169 MessageBoxA(hWnd, "how did you even trigger this", "GUI could not be initialized!", MB_ICONEXCLAMATION); | 171 MessageBox(hWnd, TEXT("how did you even trigger this"), TEXT("GUI could not be initialized!"), MB_ICONEXCLAMATION); |
170 } | 172 } |
171 | 173 |
172 bool CALLBACK SetFont(HWND child, LPARAM font) { | 174 bool CALLBACK SetFont(HWND child, LPARAM font) { |
173 SendMessage(child, WM_SETFONT, font, true); | 175 SendMessage(child, WM_SETFONT, font, true); |
174 return true; | 176 return true; |
219 wc.lpszClassName = "msvpvf"; | 221 wc.lpszClassName = "msvpvf"; |
220 wc.lpfnWndProc = WindowProcedure; | 222 wc.lpfnWndProc = WindowProcedure; |
221 | 223 |
222 if (!RegisterClass(&wc)) return -1; | 224 if (!RegisterClass(&wc)) return -1; |
223 | 225 |
224 CreateWindow("msvpvf", "Movie Studio / Vegas Pro version spoofer", WS_OVERLAPPED | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU, 100, 100, 225, 200, NULL, NULL, hInstance, NULL); | 226 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); |
225 | 227 |
226 MSG msg = {0}; | 228 MSG msg = {0}; |
227 | 229 |
228 while (GetMessage(&msg, NULL, 0, 0)) { | 230 while (GetMessage(&msg, NULL, 0, 0)) { |
229 TranslateMessage(&msg); | 231 TranslateMessage(&msg); |