From a902beb6baa6e1ee5882ea7a6285eb3437d2650c Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Wed, 17 Dec 2014 08:55:20 -0800 Subject: [PATCH] Specify a custom class name for main frame DeployMaster can detect whether or not CiderPress is currently running by checking for the presence of a window with a specific class name. The default class name is generated differently each time, so we need to set a custom class name. Also, bumped version to 4.0.0d2. --- DIST/with-mdc.deploy | 6 +++--- app/Main.cpp | 22 ++++++++++++++++++++-- app/MyApp.h | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/DIST/with-mdc.deploy b/DIST/with-mdc.deploy index 9f1d465..ff9aeff 100644 --- a/DIST/with-mdc.deploy +++ b/DIST/with-mdc.deploy @@ -4,7 +4,7 @@ faddenSoft http://www.faddensoft.com/ CiderPress http://a2ciderpress.com/ -4.0.0d1 +4.0.0d2 41989 C:\DATA\faddenSoft\fs.ico Copyright © 2014 CiderPress project authors. All rights reserved. @@ -343,7 +343,7 @@ C:\Src\ciderpress\Release\CiderPress.exe -uninstall TRUE - +faddenSoft.CiderPress.4 TRUE FALSE @@ -355,7 +355,7 @@ FALSE 4095 -Setup400d1.exe +Setup400d2.exe FALSE diff --git a/app/Main.cpp b/app/Main.cpp index e81d60a..0360222 100644 --- a/app/Main.cpp +++ b/app/Main.cpp @@ -27,6 +27,10 @@ static const WCHAR kWebSiteURL[] = L"http://www.faddensoft.com/"; +/* custom class name for main frame */ +static const WCHAR kMainWindowClassName[] = L"faddenSoft.CiderPress.4"; + + /* * Filters for the "open file" command. In some cases a file may be opened * in more than one format, so it's necessary to keep track of what the @@ -187,7 +191,6 @@ BEGIN_MESSAGE_MAP(MainWindow, CFrameWnd) ON_COMMAND(ID_DEFAULT_HELP, CFrameWnd::OnHelpFinder) END_MESSAGE_MAP() - /* * MainWindow constructor. Creates the main window and sets * its properties. @@ -269,6 +272,21 @@ BOOL MainWindow::PreCreateWindow(CREATESTRUCT& cs) cs.dwExStyle &= ~(WS_EX_CLIENTEDGE); + // This changes the window class name to a value that the installer can + // detect. This allows us to prevent installation while CiderPress is + // running. (If we don't do that, the installation will offer to reboot + // the computer to complete installation.) + WNDCLASS wndCls; + if (!GetClassInfo(AfxGetInstanceHandle(), cs.lpszClass, &wndCls)) { + LOGW("GetClassInfo failed"); + } else { + cs.lpszClass = kMainWindowClassName; + wndCls.lpszClassName = kMainWindowClassName; + if (!AfxRegisterClass(&wndCls)) { + LOGW("AfxRegisterClass failed"); + } + } + return res; } @@ -1068,7 +1086,7 @@ void MainWindow::OnHelpAbout(void) AboutDialog dlg(this); result = dlg.DoModal(); - LOGI("HelpAbout returned %d", result); + LOGV("HelpAbout returned %d", result); /* * User could've changed registration. If we're showing the registered diff --git a/app/MyApp.h b/app/MyApp.h index 6122094..40c6327 100644 --- a/app/MyApp.h +++ b/app/MyApp.h @@ -15,7 +15,7 @@ #define kAppMajorVersion 4 #define kAppMinorVersion 0 #define kAppBugVersion 0 -#define kAppDevString L"d1" +#define kAppDevString L"d2" /* * Windows application object.