mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- [WebParser] Fixed minor memory leak.
- [WebParser] Modified the routine which finds the Rainmeter window.
This commit is contained in:
parent
877d4a3f4d
commit
5b7a985a7e
@ -159,41 +159,42 @@ std::string ConvertAsciiToUTF8(LPCSTR str, int codepage)
|
|||||||
return szUTF8;
|
return szUTF8;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND FindMeterWindow()
|
bool BelongToSameProcess(HWND wnd)
|
||||||
{
|
{
|
||||||
HWND wnd = FindWindow(L"RainmeterMeterWindow", NULL);
|
DWORD procId = 0;
|
||||||
if (wnd == NULL)
|
GetWindowThreadProcessId(wnd, &procId);
|
||||||
{
|
|
||||||
// Check if all windows are "On Desktop"
|
|
||||||
HWND ProgmanHwnd = FindWindow(L"Progman", L"Program Manager");
|
|
||||||
if (ProgmanHwnd)
|
|
||||||
{
|
|
||||||
wnd = FindWindowEx(ProgmanHwnd, NULL, L"RainmeterMeterWindow", NULL);
|
|
||||||
if (wnd == NULL)
|
|
||||||
{
|
|
||||||
ProgmanHwnd = FindWindowEx(FindWindowEx(ProgmanHwnd, NULL, L"SHELLDLL_DefView", L""), NULL, L"SysListView32", L"FolderView");
|
|
||||||
if (ProgmanHwnd)
|
|
||||||
{
|
|
||||||
wnd = FindWindowEx(ProgmanHwnd, NULL, L"RainmeterMeterWindow", NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wnd == NULL)
|
return (procId == GetCurrentProcessId());
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND FindMeterWindow(HWND parent = NULL)
|
||||||
|
{
|
||||||
|
HWND wnd = NULL;
|
||||||
|
|
||||||
|
while (wnd = FindWindowEx(parent, wnd, L"RainmeterMeterWindow", NULL))
|
||||||
|
{
|
||||||
|
if (BelongToSameProcess(wnd))
|
||||||
{
|
{
|
||||||
HWND WorkerWHwnd = NULL;
|
return wnd;
|
||||||
while ((WorkerWHwnd = FindWindowEx(NULL, WorkerWHwnd, L"WorkerW", L"")) != NULL)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// for backward compatibility (0.14 - 1.1)
|
||||||
|
if (!parent)
|
||||||
|
{
|
||||||
|
while (parent = FindWindowEx(NULL, parent, L"Progman", NULL))
|
||||||
|
{
|
||||||
|
if (wnd = FindMeterWindow(parent))
|
||||||
{
|
{
|
||||||
ProgmanHwnd = FindWindowEx(FindWindowEx(WorkerWHwnd, NULL, L"SHELLDLL_DefView", L""), NULL, L"SysListView32", L"FolderView");
|
if (BelongToSameProcess(wnd))
|
||||||
if (ProgmanHwnd)
|
|
||||||
{
|
{
|
||||||
wnd = FindWindowEx(ProgmanHwnd, NULL, L"RainmeterMeterWindow", NULL);
|
return wnd;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wnd;
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -617,6 +618,9 @@ void ParseData(UrlData* urlData, LPCSTR parseData)
|
|||||||
}
|
}
|
||||||
LeaveCriticalSection(&g_CriticalSection);
|
LeaveCriticalSection(&g_CriticalSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release memory used for the compiled pattern
|
||||||
|
pcre_free(re);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user