DIALOG.CPP 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. //
  19. // Create the dialog used during the patching process.
  20. //
  21. #include"winblows.h"
  22. #include"resource.h"
  23. #include"loadbmp.h"
  24. #include<commctrl.h>
  25. HWND PatchDialog;
  26. BOOL CALLBACK Patch_Window_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
  27. HWND Create_Patch_Dialog(void)
  28. {
  29. PatchDialog=CreateDialog(Global_instance, MAKEINTRESOURCE(IDD_DIALOG1),
  30. NULL, (DLGPROC)Patch_Window_Proc);
  31. ShowWindow(PatchDialog, SW_NORMAL);
  32. SetForegroundWindow(PatchDialog);
  33. return(PatchDialog);
  34. }
  35. BOOL CALLBACK Patch_Window_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
  36. {
  37. static LoadBmp bmpLoader;
  38. switch(iMsg) {
  39. case WM_INITDIALOG:
  40. // progress bar
  41. SendMessage(GetDlgItem(hwnd,IDC_PROGRESS2),PBM_SETRANGE,
  42. 0,MAKELPARAM(0,100));
  43. SendMessage(GetDlgItem(hwnd,IDC_PROGRESS2),PBM_SETPOS,0,0);
  44. SendMessage(GetDlgItem(hwnd,IDC_PROGRESS2),PBM_SETSTEP,10,0);
  45. bmpLoader.init("launcher.bmp",GetDlgItem(hwnd,IDC_SPLASH));
  46. return(TRUE); // True means windows handles focus issues
  47. break;
  48. case WM_PAINT:
  49. bmpLoader.drawBmp();
  50. break;
  51. case WM_COMMAND:
  52. /* May want to add cancel later
  53. switch(wParam) {
  54. case IDCANCEL:
  55. {
  56. // do some stuff
  57. return(TRUE);
  58. }
  59. default:
  60. break;
  61. }
  62. default:
  63. *************/
  64. break;
  65. case WM_CLOSE:
  66. DestroyWindow(hwnd);
  67. PostQuitMessage(0);
  68. exit(0);
  69. break;
  70. }
  71. return(FALSE);
  72. }