Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
dialog.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(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//
20// Create the dialog used during the patching process.
21//
22#include"winblows.h"
23#include"resource.h"
24#include"loadbmp.h"
25#include<commctrl.h>
26
28BOOL CALLBACK Patch_Window_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
29
31{
32 PatchDialog=CreateDialog(Global_instance, MAKEINTRESOURCE(IDD_PATCHPROGRESS),
33 NULL, (DLGPROC)Patch_Window_Proc);
34
35 ShowWindow(PatchDialog, SW_NORMAL);
36 SetForegroundWindow(PatchDialog);
37 return(PatchDialog);
38}
39
40BOOL CALLBACK Patch_Window_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
41{
42
43 static LoadBmp bmpLoader;
44
45 switch(iMsg) {
46 case WM_INITDIALOG:
47 // progress bar
48 SendMessage(GetDlgItem(hwnd,IDC_PROGRESS2),PBM_SETRANGE,
49 0,MAKELPARAM(0,100));
50 SendMessage(GetDlgItem(hwnd,IDC_PROGRESS2),PBM_SETPOS,0,0);
51 SendMessage(GetDlgItem(hwnd,IDC_PROGRESS2),PBM_SETSTEP,10,0);
52
53 bmpLoader.init("launcher.bmp",GetDlgItem(hwnd,IDC_SPLASH));
54 return(TRUE); // True means windows handles focus issues
55 break;
56 case WM_PAINT:
57 bmpLoader.drawBmp();
58 break;
59 case WM_COMMAND:
60 /* May want to add cancel later
61 switch(wParam) {
62 case IDCANCEL:
63 {
64 // do some stuff
65 return(TRUE);
66 }
67 default:
68 break;
69 }
70 default:
71 *************/
72 break;
73 case WM_CLOSE:
74 DestroyWindow(hwnd);
75 PostQuitMessage(0);
76 exit(0);
77 break;
78 }
79 return(FALSE);
80}
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
HINSTANCE Global_instance
Definition winblows.cpp:29
unsigned int UINT
Definition bittype.h:63
#define IDC_PROGRESS2
Definition resource.h:38
#define IDC_SPLASH
Definition resource.h:39
#define IDD_PATCHPROGRESS
Definition resource.h:35
#define BOOL
Definition Wnd_File.h:57
bit8 init(char *filename, HWND hwnd)
Definition loadbmp.cpp:38
bit8 drawBmp(void)
Definition loadbmp.cpp:168
BOOL CALLBACK Patch_Window_Proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition dialog.cpp:40
HWND PatchDialog
Definition dialog.cpp:27
HWND Create_Patch_Dialog(void)
Definition dialog.cpp:30