Author: pschweitzer
Date: Tue Jul 8 15:07:27 2008
New Revision: 34374
URL:
http://svn.reactos.org/svn/reactos?rev=34374&view=rev
Log:
Synced wordpad.exe with Wine HEAD
Modified:
trunk/reactos/base/applications/wordpad/registry.c
trunk/reactos/base/applications/wordpad/wordpad.c
trunk/reactos/base/applications/wordpad/wordpad.h
trunk/reactos/base/applications/wordpad/wordpad.rbuild
Modified: trunk/reactos/base/applications/wordpad/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/…
==============================================================================
--- trunk/reactos/base/applications/wordpad/registry.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/wordpad/registry.c [iso-8859-1] Tue Jul 8 15:07:27
2008
@@ -33,6 +33,7 @@
static const WCHAR var_file[] =
{'F','i','l','e','%','d',0};
static const WCHAR var_framerect[] =
{'F','r','a','m','e','R','e','c','t',0};
static const WCHAR var_barstate0[] =
{'B','a','r','S','t','a','t','e','0',0};
+static const WCHAR var_maximized[] =
{'M','a','x','i','m','i','z','e','d',0};
static LRESULT registry_get_handle(HKEY *hKey, LPDWORD action, LPCWSTR subKey)
{
@@ -82,11 +83,15 @@
if(registry_get_handle(&hKey, &action, (LPWSTR)key_options) ==
ERROR_SUCCESS)
{
- RECT rc;
-
- GetWindowRect(hMainWnd, &rc);
-
- RegSetValueExW(hKey, var_framerect, 0, REG_BINARY, (LPBYTE)&rc,
sizeof(RECT));
+ WINDOWPLACEMENT wp;
+ DWORD isMaximized;
+
+ wp.length = sizeof(WINDOWPLACEMENT);
+ GetWindowPlacement(hMainWnd, &wp);
+ isMaximized = (wp.showCmd == SW_SHOWMAXIMIZED);
+
+ RegSetValueExW(hKey, var_framerect, 0, REG_BINARY,
(LPBYTE)&wp.rcNormalPosition, sizeof(RECT));
+ RegSetValueExW(hKey, var_maximized, 0, REG_DWORD, (LPBYTE)&isMaximized,
sizeof(DWORD));
registry_set_pagemargins(hKey);
}
@@ -107,6 +112,21 @@
rc->left = 0;
rc->bottom = 300;
rc->right = 600;
+ }
+
+ RegCloseKey(hKey);
+}
+
+void registry_read_maximized(DWORD *bMaximized)
+{
+ HKEY hKey;
+ DWORD size = sizeof(DWORD);
+
+ if(registry_get_handle(&hKey, 0, (LPWSTR)key_options) != ERROR_SUCCESS ||
+ RegQueryValueExW(hKey, var_maximized, 0, NULL, (LPBYTE)bMaximized, &size) !=
+ ERROR_SUCCESS || size != sizeof(DWORD))
+ {
+ *bMaximized = FALSE;
}
RegCloseKey(hKey);
Modified: trunk/reactos/base/applications/wordpad/wordpad.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/…
==============================================================================
--- trunk/reactos/base/applications/wordpad/wordpad.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/wordpad/wordpad.c [iso-8859-1] Tue Jul 8 15:07:27
2008
@@ -595,9 +595,9 @@
{
RECT rect;
- GetWindowRect(hMainWnd, &rect);
-
- (void) OnSize(hMainWnd, SIZE_RESTORED, MAKELONG(rect.right, rect.bottom));
+ GetClientRect(hMainWnd, &rect);
+
+ OnSize(hMainWnd, SIZE_RESTORED, MAKELPARAM(rect.right, rect.bottom));
}
static BOOL is_bar_visible(int bandId)
@@ -2490,7 +2490,7 @@
return 0;
}
-int CALLBACK wWinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPWSTR szCmdParagraph,
int res)
+int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPSTR szCmdParagraph,
int nCmdShow)
{
INITCOMMONCONTROLSEX classes = {8,
ICC_BAR_CLASSES|ICC_COOL_CLASSES|ICC_USEREX_CLASSES};
HACCEL hAccel;
@@ -2500,6 +2500,7 @@
UINT_PTR hPrevRulerProc;
HWND hRulerWnd;
POINTL EditPoint;
+ DWORD bMaximized;
static const WCHAR wszAccelTable[] =
{'M','A','I','N','A','C','C','E','L',
'T','A','B','L','E','\0'};
@@ -2522,7 +2523,11 @@
registry_read_winrect(&rc);
hMainWnd = CreateWindowExW(0, wszMainWndClass, wszAppTitle,
WS_CLIPCHILDREN|WS_OVERLAPPEDWINDOW,
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInstance, NULL);
- ShowWindow(hMainWnd, SW_SHOWDEFAULT);
+ registry_read_maximized(&bMaximized);
+ if ((nCmdShow == SW_SHOWNORMAL || nCmdShow == SW_SHOWDEFAULT)
+ && bMaximized)
+ nCmdShow = SW_SHOWMAXIMIZED;
+ ShowWindow(hMainWnd, nCmdShow);
set_caption(NULL);
set_bar_states();
Modified: trunk/reactos/base/applications/wordpad/wordpad.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/…
==============================================================================
--- trunk/reactos/base/applications/wordpad/wordpad.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/wordpad/wordpad.h [iso-8859-1] Tue Jul 8 15:07:27
2008
@@ -216,6 +216,7 @@
void registry_read_options(void);
void registry_read_formatopts_all(DWORD[], DWORD[]);
void registry_read_winrect(RECT*);
+void registry_read_maximized(DWORD*);
void registry_set_filelist(LPCWSTR, HWND);
void registry_set_formatopts_all(DWORD[]);
void registry_set_options(HWND);
Modified: trunk/reactos/base/applications/wordpad/wordpad.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/…
==============================================================================
--- trunk/reactos/base/applications/wordpad/wordpad.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/applications/wordpad/wordpad.rbuild [iso-8859-1] Tue Jul 8
15:07:27 2008
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="wordpad" type="win32gui"
installbase="system32" installname="wordpad.exe"
unicode="yes" allowwarnings="true">
+<module name="wordpad" type="win32gui"
installbase="system32" installname="wordpad.exe"
allowwarnings="true">
<include base="wordpad">.</include>
+ <define name="UNICODE" />
+ <define name="_UNICODE" />
<define name="_WIN32_IE">0x0600</define>
<define name="_WIN32_WINNT">0x0501</define>
<library>comdlg32</library>