comparison src/gui.c @ 38:161ec4e87d0a

Crash fix for Windows 2000 and XP Windows 2000 and XP would crash if you pressed "Cancel" on the Open or Save file dialogs.
author Paper <37962225+mrpapersonic@users.noreply.github.com>
date Fri, 22 Apr 2022 01:55:47 -0400
parents 800b9eabc548
children b32218b54640
comparison
equal deleted inserted replaced
37:b283e2d60deb 38:161ec4e87d0a
101 ofn.lpstrFile[0] = '\0'; 101 ofn.lpstrFile[0] = '\0';
102 ofn.nMaxFile = 256; 102 ofn.nMaxFile = 256;
103 ofn.lpstrFilter = "Project files\0*.veg;*.vf\0All files\0*.*\0"; 103 ofn.lpstrFilter = "Project files\0*.veg;*.vf\0All files\0*.*\0";
104 ofn.nFilterIndex = 1; 104 ofn.nFilterIndex = 1;
105 105
106 GetOpenFileName(&ofn); 106 if (GetOpenFileNameA(&ofn) == 0) {
107 return " ";
108 }
107 109
108 display_file(filename); 110 display_file(filename);
109 111
110 return _strdup(filename); 112 return _strdup(filename);
111 } 113 }
128 ofn.lpstrFile[0] = '\0'; 130 ofn.lpstrFile[0] = '\0';
129 ofn.nMaxFile = 256; 131 ofn.nMaxFile = 256;
130 ofn.lpstrFilter = "Movie Studio project files\0*.vf\0VEGAS Pro project files\0*.veg\0All files\0*.*\0"; 132 ofn.lpstrFilter = "Movie Studio project files\0*.vf\0VEGAS Pro project files\0*.veg\0All files\0*.*\0";
131 ofn.nFilterIndex = (int)type+1; 133 ofn.nFilterIndex = (int)type+1;
132 134
133 GetSaveFileName(&ofn); 135 if (GetSaveFileNameA(&ofn) == 0) {
136 return;
137 }
134 138
135 copy_file(input_file, output_file); 139 copy_file(input_file, output_file);
136 FILE* output = fopen(output_file, "r+b"); 140 FILE* output = fopen(output_file, "r+b");
137 if (output == NULL) { 141 if (output == NULL) {
138 MessageBoxW(hWnd, L"Failed to save project file!", L"Saving project failed!", MB_ICONEXCLAMATION); 142 MessageBoxW(hWnd, L"Failed to save project file!", L"Saving project failed!", MB_ICONEXCLAMATION);