Skip to content

Commit

Permalink
mute only league, hide client, add beeps, nircmd
Browse files Browse the repository at this point in the history
  • Loading branch information
dxxxxy committed Oct 10, 2021
1 parent 616201b commit 6ea28e4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 53 deletions.
63 changes: 17 additions & 46 deletions LeagueHider/Source.cpp
Original file line number Diff line number Diff line change
@@ -1,65 +1,36 @@
#include <iostream>
#include <Windows.h>
#include <endpointvolume.h>
#include <mmdeviceapi.h>

//get all window titles
/*BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
if (!IsWindowVisible(hwnd)) return TRUE;
char class_name[250];
char title[250];
GetClassNameA(hwnd, class_name, sizeof(class_name));
GetWindowTextA(hwnd, title, sizeof(title));
std::cout << "Window title: " << title << std::endl;
std::cout << "Class name: " << class_name << std::endl << std::endl;
return TRUE;
}*/
//test
IAudioEndpointVolume* GetEndpointVolume() {
HRESULT hr;
IMMDeviceEnumerator* deviceEnumerator = NULL;
hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), (LPVOID*)&deviceEnumerator);
IMMDevice* defaultDevice = NULL;

hr = deviceEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &defaultDevice);
deviceEnumerator->Release();
deviceEnumerator = NULL;

IAudioEndpointVolume* endpointVolume = NULL;
hr = defaultDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL, (LPVOID*)&endpointVolume);
defaultDevice->Release();
defaultDevice = NULL;
return endpointVolume;
}

bool SetMute(bool mute) {
HRESULT hr;
CoInitialize(NULL);
IAudioEndpointVolume* endpointVolume = GetEndpointVolume();
hr = endpointVolume->SetMute((bool)(mute), NULL);
endpointVolume->Release();
CoUninitialize();
return 0;
}

bool close = false;

int main() {
//EnumWindows(EnumWindowsProc, NULL);
Beep(900, 500);
ShowWindow(GetConsoleWindow(), SW_HIDE);
while (true) {
if (GetAsyncKeyState(VK_INSERT)) {
close = !close;

HWND hWnd = FindWindowA(NULL, "League of Legends (TM) Client"); //find the league client handle
HWND hWnd = FindWindowA(NULL, "League of Legends (TM) Client"); //find the league gamet handle
HWND hWnd2 = FindWindowA(NULL, "League of Legends"); //find the league client handle

ShowWindow(hWnd, close ? SW_HIDE : SW_SHOW);
SetMute(close); //system mute
ShowWindow(hWnd2, close ? SW_HIDE : SW_SHOW);

std::system("nircmd.exe muteappvolume LeagueClientUxRender.exe 2");
std::system("nircmd.exe muteappvolume LeagueClientUx.exe 2");

DWORD pid;
GetWindowThreadProcessId(hWnd, &pid);
CHAR buf[100];

sprintf_s(buf, sizeof(buf), "nircmd.exe muteappvolume /%d 2", pid);

std::system(buf);
}
else if (GetAsyncKeyState(VK_END)) {
Beep(500, 500);
return 0;
}
Sleep(100);
}
}
}
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# LeagueHider
Hide the league client from desktop, taskbar and mute audio. Coded in C++. <kbd>dxxxxy#5818</kbd>.
ULTRA lightweight program for completely hiding League of Legends. Coded in C++. <kbd>dxxxxy#5818</kbd>.

> Inspired by: strict parents, angry bosses and teachers.
## Requires
- [NirCmd](http://www.nirsoft.net/utils/nircmd.html)
> Drag it's files into <kbd>C:\Windows</kbd>
## Usage
Launch the `.exe` (download from [here](https://github.com/DxxxxY/LeagueHider/releases))
> The app will sit in the background and wait for user inputs.
>> ~10kb file size, ~2mb memory usage, ~0% cpu usage.
Launch the `.exe` (download from [here](https://github.com/DxxxxY/LeagueHider/releases) or clone and compile by yourself)
> The app will hide itself just like it does for League and wait for [user inputs](#user-inputs).
>> ~10kb file size, ~0.6mb memory usage, ~0% cpu usage.
### Sounds

### User Inputs
<kbd>INSERT</kbd> - Toggle for hiding/showing the game's window and muting audio.
Launching will produce a high pitched sound.

<kbd>END</kbd> - Quits the background process and plays a beep sound.
Quitting will produce a low pitched sound.
## User Inputs
+ <kbd>INSERT</kbd> - Master switch.
> Will hide League from desktop, alt-tab, taskbar, and mute it's audio. Only place where you can see League is in TaskManager.
+ <kbd>END</kbd> - Quits the process.

0 comments on commit 6ea28e4

Please sign in to comment.