1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-28 01:10:55 +01:00

GUI shows application title when run outside of Explorer

This commit is contained in:
Valentin Radu 2021-10-02 19:46:01 +03:00
parent 2a8f226f72
commit a01f110341
3 changed files with 32 additions and 1 deletions

View File

@ -182,6 +182,31 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
); );
if (!strncmp(line, ";M ", 3)) if (!strncmp(line, ";M ", 3))
{ {
TCHAR exeName[MAX_PATH + 1];
GetProcessImageFileNameW(
OpenProcess(
PROCESS_QUERY_INFORMATION,
FALSE,
GetCurrentProcessId()
),
exeName,
MAX_PATH
);
PathStripPath(exeName);
if (wcscmp(exeName, L"explorer.exe"))
{
LoadStringW(hModule, IDS_PRODUCTNAME, text, MAX_LINE_LENGTH);
}
else
{
LoadStringW(GetModuleHandleW(L"ExplorerFrame.dll"), 50222, text, 260);
wchar_t* p = wcschr(text, L'(');
if (p)
{
p--;
*p = 0;
}
}
rcText.bottom += GUI_CAPTION_LINE_HEIGHT - dwLineHeight; rcText.bottom += GUI_CAPTION_LINE_HEIGHT - dwLineHeight;
dwLineHeight = GUI_CAPTION_LINE_HEIGHT; dwLineHeight = GUI_CAPTION_LINE_HEIGHT;
_this->extent.cyTopHeight = rcText.bottom; _this->extent.cyTopHeight = rcText.bottom;
@ -900,6 +925,10 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
TCHAR title[260]; TCHAR title[260];
LoadStringW(GetModuleHandleW(L"ExplorerFrame.dll"), 726, title, 260); LoadStringW(GetModuleHandleW(L"ExplorerFrame.dll"), 726, title, 260);
if (title[0] == 0)
{
LoadStringW(hModule, IDS_PRODUCTNAME, title, 260);
}
HWND hwnd = CreateWindowEx( HWND hwnd = CreateWindowEx(
NULL, NULL,

View File

@ -5,6 +5,8 @@ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#include <Windows.h> #include <Windows.h>
#pragma comment(lib, "Version.lib") #pragma comment(lib, "Version.lib")
#include <Shlwapi.h>
#pragma comment(lib, "Shlwapi.lib")
#include <windowsx.h> #include <windowsx.h>
#include <tlhelp32.h> #include <tlhelp32.h>
#include <shellscalingapi.h> #include <shellscalingapi.h>

View File

@ -1,6 +1,6 @@
Windows Registry Editor Version 5.00 Windows Registry Editor Version 5.00
;M Properties ;M Settings
;T Shell ;T Shell
;l Enable missing system tray icons ;l Enable missing system tray icons