Skip to content

Commit

Permalink
Added SKIF_Util_GetProcessIdFromHwnd
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemony committed Jun 6, 2024
1 parent 31c1a55 commit d525bd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/utility/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ bool SKIF_Util_IsTouchCapable (void);
bool SKIF_Util_IsProcessAdmin (DWORD PID);
bool SKIF_Util_IsProcessX86 (HANDLE process);
PROCESSENTRY32W SKIF_Util_FindProcessByName (const wchar_t* wszName);
DWORD SKIF_Util_GetProcessIdFromHwnd (HWND hwnd);
HANDLE SKIF_Util_GetProcessHandleFromHwnd (HWND hwnd, DWORD dwDesiredAccess);
bool SKIF_Util_SaveImageAsICO (const wchar_t* imgFilePath, const wchar_t* icoFilePath, int iColorBits);
bool SKIF_Util_SaveExtractExeIcon (std::wstring exePath, std::wstring targetPath);
Expand Down
10 changes: 10 additions & 0 deletions src/utility/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,16 @@ SKIF_Util_FindProcessByName (const wchar_t* wszName)
return none;
}

DWORD
SKIF_Util_GetProcessIdFromHwnd (HWND hwnd)
{
DWORD pid = 0;
if (GetWindowThreadProcessId (hwnd, &pid))
return pid;

return NULL;
}

HANDLE
SKIF_Util_GetProcessHandleFromHwnd (HWND hwnd, DWORD dwDesiredAccess)
{
Expand Down

0 comments on commit d525bd6

Please sign in to comment.