[1/5] notepad: Fix trying to open non-existent files with the command line.

Alexander Scott-Johns alexander.scott.johns at googlemail.com
Wed Jul 1 13:55:02 CDT 2009


While I was simplifying patch #1 from my previous attempt, I noticed
this bug. When given a non-existent file as a command line argument,
Notepad asks if you want to create a new file. Currently, if you click
Yes, Wine Notepad just displays an error ("'filename' could not be
found"); this patch fixes it.

---
 programs/notepad/dialog.c |    2 +-
 programs/notepad/dialog.h |    1 +
 programs/notepad/main.c   |    3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)
-------------- next part --------------
From 9f74f69603d18969e2aaa9abc1025f30273a8039 Mon Sep 17 00:00:00 2001
From: Alexander Scott-Johns <alexander.scott.johns at googlemail.com>
Date: Tue, 30 Jun 2009 21:25:02 +0100
Subject: notepad: Fix trying to open non-existent files with the command line.

---
 programs/notepad/dialog.c |    2 +-
 programs/notepad/dialog.h |    1 +
 programs/notepad/main.c   |    3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/programs/notepad/dialog.c b/programs/notepad/dialog.c
index d7354e7..026fe25 100644
--- a/programs/notepad/dialog.c
+++ b/programs/notepad/dialog.c
@@ -59,7 +59,7 @@ VOID ShowLastError(void)
  *    Untitled - Notepad        if no file is open
  *    filename - Notepad        if a file is given
  */
-static void UpdateWindowCaption(void)
+void UpdateWindowCaption(void)
 {
   WCHAR szCaption[MAX_STRING_LEN];
   WCHAR szNotepad[MAX_STRING_LEN];
diff --git a/programs/notepad/dialog.h b/programs/notepad/dialog.h
index d927143..38c20e4 100644
--- a/programs/notepad/dialog.h
+++ b/programs/notepad/dialog.h
@@ -52,6 +52,7 @@ int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCWSTR szString, DWORD dwFl
 
 /* utility functions */
 VOID ShowLastError(void);
+void UpdateWindowCaption(void);
 BOOL FileExists(LPCWSTR szFilename);
 BOOL DoCloseFile(void);
 void DoOpenFile(LPCWSTR szFileName);
diff --git a/programs/notepad/main.c b/programs/notepad/main.c
index c195668..7e33372 100644
--- a/programs/notepad/main.c
+++ b/programs/notepad/main.c
@@ -698,7 +698,8 @@ static void HandleCommandLine(LPWSTR cmdline)
         {
             switch (AlertFileDoesNotExist(file_name)) {
             case IDYES:
-                DoOpenFile(file_name);
+                SetFileName(file_name);
+                UpdateWindowCaption();
                 break;
 
             case IDNO:
-- 
1.5.6.3


More information about the wine-patches mailing list