valinet / sws

sws (Simple Window Switcher) is an Alt-Tab replacement for Windows
GNU General Public License v2.0
67 stars 9 forks source link

standalone .exe? #11

Open ne0YT opened 8 months ago

ne0YT commented 8 months ago

hey there is it smh possible to have this as a standalone .exe to just run to have this functionality only? I don't use an explorer.exe at all (not using a shell-app).

ne0YT commented 8 months ago

I built the .dll but I don't see how I can use it standalone. Is there a way to use it directly smh?

valinet commented 8 months ago

ExplorerPatcher 'links' sws statically, i.e. the source code of sws is included in the ExplorerPatcher tree, and thus the functionality is directly called. See here: https://github.com/valinet/ExplorerPatcher/blob/master/ExplorerPatcher/dllmain.c#L6048

As far as I can see, the DLL exports a main function. So, LoadLibraryW the DLL in your code, then GetProcAddress for "main" and call that in a thread - the switcher will simply load. You can do something like CreateThread or, if running explorer.exe, place the DLL in C:\Windows named dxgi.dll and then from some other process CreateRemoteThread in explorer.exe calling main from dxgi.dll - multiple ways to do it, really, depends on your use case.