Browse Source

use string table

COM-121
Volker Birk 9 months ago
parent
commit
723243cb14
5 changed files with 14 additions and 3 deletions
  1. +10
    -2
      CMainWindow.cpp
  2. +2
    -0
      CMainWindow.h
  3. +2
    -1
      GateKeeper.cpp
  4. BIN
      pEpCOMServerAdapter.rc
  5. BIN
      resource.h

+ 10
- 2
CMainWindow.cpp View File

@ -16,7 +16,7 @@ LRESULT CMainWindow::OnCreate(UINT, WPARAM, LPARAM, BOOL&)
nid.uFlags = NIF_ICON | NIF_TIP | NIF_GUID | NIF_MESSAGE;
nid.hWnd = m_hWnd;
nid.guidItem = nidGUID;
StringCchCopy(nid.szTip, ARRAYSIZE(nid.szTip), _T("p≡p Updates"));
StringCchCopy(nid.szTip, ARRAYSIZE(nid.szTip), r(IDS_PROJNAME).c_str());
nid.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_LOGO));
nid.uCallbackMessage = WM_PEP_NOTIFICATION;
Shell_NotifyIcon(NIM_ADD, &nid);
@ -96,7 +96,7 @@ LRESULT CMainWindow::OnMenuCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
switch (index) {
case UPDATE_NOW:
ShowNotificationInfo(_T("Searching for updates"), _T("p≡p is searching for updates. When an update is available p≡p will start an installer."));
ShowNotificationInfo(r(IDS_UPDATESTITLE), r(IDS_UPDATESTEXT));
pEp::GateKeeper::gatekeeper()->update_now();
bHandled = true;
break;
@ -117,6 +117,14 @@ LRESULT CMainWindow::OnMenuCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
return S_OK;
}
CMainWindow::tstring CMainWindow::r(UINT resid)
{
LPCTSTR rstr;
size_t rsize = LoadString(GetModuleHandle(NULL), resid, (LPWSTR) &rstr, 0);
tstring str = tstring(rstr, rsize);
return str;
}
void CMainWindow::ShowNotificationInfo(tstring title, tstring text)
{
NOTIFYICONDATA nid = {};


+ 2
- 0
CMainWindow.h View File

@ -1,5 +1,6 @@
#pragma once
#include "stdafx.h"
#include "resource.h"
using namespace ATL;
@ -28,5 +29,6 @@ public:
LRESULT OnMenuCommand(UINT /*nMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
typedef std::basic_string<TCHAR> tstring;
static tstring r(UINT resid);
void ShowNotificationInfo(tstring title, tstring text);
};

+ 2
- 1
GateKeeper.cpp View File

@ -7,6 +7,7 @@
using namespace std;
extern CMainWindow mainWindow;
auto r = CMainWindow::r;
// from https://msdn.microsoft.com/en-us/library/windows/desktop/dd388945(v=vs.85).aspx
@ -523,7 +524,7 @@ namespace pEp {
InternetReadFile(hUrl, iv, sizeof(iv), &reading);
if (reading)
mainWindow.ShowNotificationInfo(_T("Downloading update"), _T("An update for p≡p arrived and is being downloaded."));
mainWindow.ShowNotificationInfo(r(IDS_DOWNLOADTITLE), r(IDS_DOWNLOADTEXT));
if (reading) do {
static char buffer[1024 * 1024];


BIN
pEpCOMServerAdapter.rc View File


BIN
resource.h View File


Loading…
Cancel
Save