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.
This commit is contained in:
Andy McFadden 2014-12-17 08:55:20 -08:00
parent 48ab56f808
commit a902beb6ba
3 changed files with 24 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -15,7 +15,7 @@
#define kAppMajorVersion 4
#define kAppMinorVersion 0
#define kAppBugVersion 0
#define kAppDevString L"d1"
#define kAppDevString L"d2"
/*
* Windows application object.