mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
Add version number to telemetry event
use defines from version.h in .rc files and other places.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#pragma comment(lib, "dwmapi.lib")
|
||||
#include <strsafe.h>
|
||||
#include <sddl.h>
|
||||
#include "version.h"
|
||||
|
||||
std::optional<RECT> get_button_pos(HWND hwnd) {
|
||||
RECT button;
|
||||
@@ -290,3 +291,10 @@ std::wstring get_process_path(HWND window) noexcept {
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
std::wstring get_product_version() {
|
||||
static std::wstring version = std::to_wstring(VERSION_MAJOR) +
|
||||
L"." + std::to_wstring(VERSION_MINOR) +
|
||||
L"." + std::to_wstring(VERSION_REVISION);
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -48,3 +48,5 @@ bool drop_elevated_privileges();
|
||||
std::wstring get_process_path(DWORD pid) noexcept;
|
||||
// Get the executable path or module name for modern apps
|
||||
std::wstring get_process_path(HWND hwnd) noexcept;
|
||||
|
||||
std::wstring get_product_version();
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
<ClInclude Include="Telemetry\ProjectTelemetry.h" />
|
||||
<ClInclude Include="Telemetry\TraceLoggingDefines.h" />
|
||||
<ClInclude Include="two_way_pipe_message_ipc.h" />
|
||||
<ClInclude Include="version.h" />
|
||||
<ClInclude Include="windows_colors.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
<ClInclude Include="dpi_aware.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="d2d_svg.cpp">
|
||||
|
||||
19
src/common/version.h
Normal file
19
src/common/version.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#define STRINGIZE2(s) #s
|
||||
#define STRINGIZE(s) STRINGIZE2(s)
|
||||
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 11
|
||||
#define VERSION_REVISION 0
|
||||
#define VERSION_BUILD 0
|
||||
|
||||
#define FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
|
||||
#define FILE_VERSION_STRING STRINGIZE(VERSION_MAJOR) "." STRINGIZE(VERSION_MINOR) "." STRINGIZE(VERSION_REVISION) "." STRINGIZE(VERSION_BUILD)
|
||||
|
||||
#define PRODUCT_VERSION FILE_VERSION
|
||||
#define PRODUCT_VERSION_STRING FILE_VERSION_STRING
|
||||
|
||||
#define COMPANY_NAME "Microsoft Corporation"
|
||||
#define COPYRIGHT_NOTE "Copyright (C) 2019 Microsoft Corporation"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -68,7 +68,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
// Start initial powertoys
|
||||
start_initial_powertoys();
|
||||
|
||||
Trace::EventLaunch();
|
||||
Trace::EventLaunch(get_product_version());
|
||||
|
||||
result = run_message_loop();
|
||||
} catch (std::runtime_error& err) {
|
||||
|
||||
Binary file not shown.
@@ -16,10 +16,11 @@ void Trace::UnregisterProvider() {
|
||||
TraceLoggingUnregister(g_hProvider);
|
||||
}
|
||||
|
||||
void Trace::EventLaunch() {
|
||||
void Trace::EventLaunch(const std::wstring& versionNumber) {
|
||||
TraceLoggingWrite(
|
||||
g_hProvider,
|
||||
"Runner::Event::Launch",
|
||||
TraceLoggingWideString(versionNumber.c_str(), "version"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
|
||||
@@ -4,5 +4,5 @@ class Trace {
|
||||
public:
|
||||
static void RegisterProvider();
|
||||
static void UnregisterProvider();
|
||||
static void EventLaunch();
|
||||
static void EventLaunch(const std::wstring& versionNumber);
|
||||
};
|
||||
|
||||
@@ -70,7 +70,8 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam
|
||||
case ID_ABOUT_MENU_COMMAND:
|
||||
if (!about_box_shown) {
|
||||
about_box_shown = true;
|
||||
MessageBox(nullptr, L"PowerToys\nVersion 0.11.0\n\xa9 2019 Microsoft Corporation", L"About PowerToys", MB_OK);
|
||||
std::wstring about_msg = L"PowerToys\nVersion " + get_product_version() + L"\n\xa9 2019 Microsoft Corporation";
|
||||
MessageBox(nullptr, about_msg.c_str(), L"About PowerToys", MB_OK);
|
||||
about_box_shown = false;
|
||||
}
|
||||
break;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user