├── .gitattributes ├── .gitignore ├── Exploder.sln ├── Exploder ├── Appbar.cpp ├── Appbar.h ├── Exploder.cpp ├── Exploder.h ├── Exploder.rc ├── Exploder.vcxproj ├── Variables.h ├── Win32Clock.cpp ├── Win32Clock.h ├── augmentedshellfolder.h ├── desktray.cpp ├── desktray.h ├── framework.h ├── resource.h ├── small.ico ├── startclassic.bmp └── targetver.h └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /Exploder.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.33529.398 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Exploder", "Exploder\Exploder.vcxproj", "{17935F4C-14D8-43C0-A838-F2BA3169200C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | Unicode Debug|x64 = Unicode Debug|x64 15 | Unicode Debug|x86 = Unicode Debug|x86 16 | Unicode Release|x64 = Unicode Release|x64 17 | Unicode Release|x86 = Unicode Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Debug|x64.ActiveCfg = Debug|x64 21 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Debug|x64.Build.0 = Debug|x64 22 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Debug|x86.ActiveCfg = Debug|Win32 23 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Debug|x86.Build.0 = Debug|Win32 24 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Release|x64.ActiveCfg = Release|x64 25 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Release|x64.Build.0 = Release|x64 26 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Release|x86.ActiveCfg = Release|Win32 27 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Release|x86.Build.0 = Release|Win32 28 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Debug|x64.ActiveCfg = Debug|x64 29 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Debug|x64.Build.0 = Debug|x64 30 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Debug|x86.ActiveCfg = Debug|Win32 31 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Debug|x86.Build.0 = Debug|Win32 32 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Release|x64.ActiveCfg = Release|x64 33 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Release|x64.Build.0 = Release|x64 34 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Release|x86.ActiveCfg = Release|Win32 35 | {17935F4C-14D8-43C0-A838-F2BA3169200C}.Unicode Release|x86.Build.0 = Release|Win32 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {9C5E0CE8-8EE6-4A71-BF65-ABF3956370F6} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /Exploder/Appbar.cpp: -------------------------------------------------------------------------------- 1 | #include "Appbar.h" 2 | #define APPBAR_CALLBACK (WM_USER + 1010) 3 | BOOL fOnTop = TRUE; 4 | BOOL uSide = ABE_BOTTOM; 5 | int cxWidth, cyHeight = 24; 6 | 7 | BOOL AppBar_Register(HWND hwnd) 8 | { 9 | APPBARDATA abd; 10 | abd.cbSize = sizeof(APPBARDATA); 11 | abd.hWnd = hwnd; 12 | abd.uCallbackMessage = APPBAR_CALLBACK; 13 | 14 | BOOL g_fAppRegistered = (BOOL)SHAppBarMessage(ABM_NEW, &abd); 15 | return g_fAppRegistered; 16 | } 17 | 18 | void AppBar_QueryPos(HWND hwnd, LPRECT lprc) 19 | { 20 | // Fill out the APPBARDATA struct and save the edge we're moving to 21 | // in the appbar OPTIONS struct. 22 | APPBARDATA abd; 23 | abd.hWnd = hwnd; 24 | abd.cbSize = sizeof(APPBARDATA); 25 | abd.rc = *lprc; 26 | abd.uEdge = uSide; 27 | 28 | int iWidth = 0; 29 | int iHeight = 0; 30 | if ((ABE_LEFT == abd.uEdge) || (ABE_RIGHT == abd.uEdge)) 31 | { 32 | iWidth = abd.rc.right - abd.rc.left; 33 | abd.rc.top = 0; 34 | abd.rc.bottom = GetSystemMetrics(SM_CYSCREEN); 35 | } 36 | else 37 | { 38 | iHeight = abd.rc.bottom - abd.rc.top; 39 | abd.rc.left = 0; 40 | abd.rc.right = GetSystemMetrics(SM_CXSCREEN); 41 | } 42 | 43 | // Ask the system for the screen space 44 | SHAppBarMessage(ABM_QUERYPOS, &abd); 45 | 46 | switch (abd.uEdge) 47 | { 48 | case ABE_LEFT: 49 | abd.rc.right = abd.rc.left + iWidth; 50 | break; 51 | 52 | case ABE_RIGHT: 53 | abd.rc.left = abd.rc.right - iWidth; 54 | break; 55 | 56 | case ABE_TOP: 57 | abd.rc.bottom = abd.rc.top + iHeight; 58 | break; 59 | 60 | case ABE_BOTTOM: 61 | abd.rc.bottom = GetSystemMetrics(SM_CYSCREEN); 62 | abd.rc.top = abd.rc.bottom - iHeight; 63 | break; 64 | } 65 | *lprc = abd.rc; 66 | } 67 | 68 | void AppBar_QuerySetPos(UINT uEdge, LPRECT lprc, PAPPBARDATA pabd, BOOL fMove) 69 | { 70 | // Fill out the APPBARDATA struct and save the edge we're moving to 71 | // in the appbar OPTIONS struct. 72 | pabd->rc = *lprc; 73 | pabd->uEdge = uEdge; 74 | uSide = uEdge; 75 | 76 | AppBar_QueryPos(pabd->hWnd, &(pabd->rc)); 77 | 78 | // Tell the system we're moving to this new approved position. 79 | SHAppBarMessage(ABM_SETPOS, pabd); 80 | 81 | if (fMove) 82 | { 83 | // Move the appbar window to the new position 84 | MoveWindow(pabd->hWnd, pabd->rc.left, pabd->rc.top, 85 | pabd->rc.right - pabd->rc.left, 86 | pabd->rc.bottom - pabd->rc.top, TRUE); 87 | } 88 | } 89 | 90 | BOOL AppBar_SetSide(HWND hwnd, UINT uSide) 91 | { 92 | // Calculate the size of the screen so we can occupy the full width or 93 | // height of the screen on the edge we request. 94 | RECT rc; 95 | rc.top = 0; 96 | rc.left = 0; 97 | rc.right = GetSystemMetrics(SM_CXSCREEN); 98 | rc.bottom = GetSystemMetrics(SM_CYSCREEN); 99 | 100 | // Fill out the APPBARDATA struct with the basic information 101 | APPBARDATA abd; 102 | abd.cbSize = sizeof(APPBARDATA); 103 | abd.hWnd = hwnd; 104 | 105 | // If the appbar is autohidden, turn that off so we can move the bar 106 | BOOL fAutoHide = FALSE; 107 | // Adjust the rectangle to set our height or width depending on the 108 | // side we want. 109 | switch (uSide) 110 | { 111 | case ABE_TOP: 112 | rc.bottom = rc.top + cyHeight; 113 | break; 114 | case ABE_BOTTOM: 115 | rc.top = rc.bottom - cyHeight; 116 | break; 117 | case ABE_LEFT: 118 | rc.right = rc.left + cxWidth; 119 | break; 120 | case ABE_RIGHT: 121 | rc.left = rc.right - cxWidth; 122 | break; 123 | } 124 | 125 | // Move the appbar to the new screen space. 126 | AppBar_QuerySetPos(uSide, &rc, &abd, TRUE); 127 | 128 | return TRUE; 129 | } 130 | -------------------------------------------------------------------------------- /Exploder/Appbar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "framework.h" 3 | static HWND hTray; 4 | 5 | BOOL AppBar_Register(HWND hwnd); 6 | void AppBar_QueryPos(HWND hwnd, LPRECT lprc); 7 | void AppBar_QuerySetPos(UINT uEdge, LPRECT lprc, PAPPBARDATA pabd, BOOL fMove); 8 | BOOL AppBar_SetSide(HWND hwnd, UINT uSide); -------------------------------------------------------------------------------- /Exploder/Exploder.cpp: -------------------------------------------------------------------------------- 1 | // Exploder.cpp : Defines the entry point for the application. 2 | // 3 | 4 | #include "framework.h" 5 | #include "Exploder.h" 6 | 7 | #pragma comment(linker,"\"/manifestdependency:type='win32' \ 8 | name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ 9 | processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 10 | 11 | 12 | // Forward declarations of functions included in this code module: 13 | ATOM MyRegisterClass(HINSTANCE hInstance); 14 | BOOL InitInstance(HINSTANCE, int); 15 | LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 16 | INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); 17 | BOOL CALLBACK EnumWindowsCallback(HWND, LPARAM); 18 | 19 | BOOL AppBar_UnRegister(HWND hwnd) 20 | { 21 | APPBARDATA abd; 22 | abd.cbSize = sizeof(APPBARDATA); 23 | abd.hWnd = hwnd; 24 | 25 | BOOL g_fAppRegistered = !SHAppBarMessage(ABM_REMOVE, &abd); 26 | 27 | return !g_fAppRegistered; 28 | } 29 | 30 | DWORD WINAPI DesktopThreadProc(LPVOID lpParam) 31 | { 32 | SHDesktopMessageLoop(thingtrturn); 33 | return S_OK; 34 | } 35 | 36 | int APIENTRY wWinMain(_In_ HINSTANCE hInstance, 37 | _In_opt_ HINSTANCE hPrevInstance, 38 | _In_ LPWSTR lpCmdLine, 39 | _In_ int nCmdShow) 40 | { 41 | UNREFERENCED_PARAMETER(hPrevInstance); 42 | UNREFERENCED_PARAMETER(lpCmdLine); 43 | hMutex = CreateMutex(NULL, false, L"Exploder"); 44 | if (GetLastError() == ERROR_ALREADY_EXISTS) 45 | { 46 | CloseHandle(hMutex); 47 | return 0; 48 | } 49 | CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); 50 | EnumWindows(EnumWindowsCallback, reinterpret_cast(&hwnd)); 51 | 52 | // Initialize global strings 53 | LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 54 | LoadString(hInstance, IDC_EXPLODER, szWindowClass, MAX_LOADSTRING); 55 | MyRegisterClass(hInstance); 56 | 57 | // Perform application initialization: 58 | if (!InitInstance(hInstance, nCmdShow)) 59 | { 60 | return FALSE; 61 | } 62 | 63 | if (!underExplorer) 64 | { 65 | hShDocVwModule = GetModuleHandle(L"Shdocvw.dll"); 66 | if (!hShDocVwModule) hShDocVwModule = LoadLibrary(L"SHDOCVW.DLL"); 67 | if (hShDocVwModule) ShellDDEInit = (ShellDDEInit_t)GetProcAddress(hShDocVwModule, (LPSTR)118); 68 | if (ShellDDEInit) ShellDDEInit(TRUE); 69 | 70 | CDeskTray tray = CDeskTray(); 71 | thingtrturn= SHCreateDesktopOrig(&tray); 72 | hwnd_desktop = FindWindow(L"Progman", L"Program Manager"); 73 | SetProp(hTray, L"TaskbarMonitor", (HANDLE)MonitorFromWindow(hTray, MONITOR_DEFAULTTOPRIMARY)); 74 | 75 | //init desktop 76 | PostMessage(hwnd_desktop, 0x45C, 1, 1); //wallpaper 77 | PostMessage(hwnd_desktop, 0x45E, 0, 2); //wallpaper host 78 | PostMessage(hwnd_desktop, 0x45C, 2, 3); //wallpaper & icons 79 | PostMessage(hwnd_desktop, 0x45B, 0, 0); //final init 80 | PostMessage(hwnd_desktop, 0x40B, 0, 0); //pins 81 | 82 | HANDLE hThread = CreateThread(NULL, 0, DesktopThreadProc, NULL, 0, NULL); 83 | } 84 | 85 | // HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_EXPLODER)); 86 | 87 | MSG msg; 88 | 89 | // Main message loop: 90 | while (GetMessage(&msg, nullptr, 0, 0)) 91 | { 92 | //if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 93 | //{ 94 | TranslateMessage(&msg); 95 | DispatchMessage(&msg); 96 | //} 97 | } 98 | 99 | if (ShellDDEInit) ShellDDEInit(false); 100 | if (hShDocVwModule) FreeLibrary(hShDocVwModule); 101 | 102 | if (underExplorer) { 103 | ShowWindow(m_hTaskBar, SW_SHOW); 104 | APPBARDATA msgData; 105 | msgData.cbSize = sizeof(msgData); 106 | msgData.hWnd = m_hTaskBar; 107 | msgData.lParam = 0; 108 | SHAppBarMessage(ABM_SETSTATE, &msgData); 109 | } 110 | if (RegisterShellHook) RegisterShellHook(m_hTaskBar, 0); 111 | CoUninitialize(); 112 | if (hMutex) CloseHandle(hMutex); 113 | return (int)msg.wParam; 114 | } 115 | 116 | HMENU CreateMenuFromShellFolder(IShellFolder* pShellFolder, HWND hwndOwner, HIMAGELIST hImageList) 117 | { 118 | // Create a new menu 119 | HMENU hMenu = CreatePopupMenu(); 120 | if (!hMenu) 121 | return NULL; 122 | 123 | // Get an enumerator for the items in the folder 124 | IEnumIDList* pEnum = NULL; 125 | int i = 1000; 126 | HRESULT hr = pShellFolder->EnumObjects(hwndOwner, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnum); 127 | if (SUCCEEDED(hr)) 128 | { 129 | LPITEMIDLIST pidl; 130 | while (pEnum->Next(1, &pidl, NULL) == S_OK) 131 | { 132 | STRRET str; 133 | hr = pShellFolder->GetDisplayNameOf(pidl, SHGDN_NORMAL, &str); 134 | if (SUCCEEDED(hr)) 135 | { 136 | // Convert STRRET to a string 137 | char displayName[MAX_PATH]; 138 | if (str.uType == STRRET_WSTR) 139 | { 140 | WideCharToMultiByte(CP_UTF8, 0, str.pOleStr, -1, displayName, sizeof(displayName), NULL, NULL); 141 | } 142 | else if (str.uType == STRRET_CSTR) 143 | { 144 | strcpy(displayName, str.cStr); 145 | } 146 | 147 | SHFILEINFOA sfi = { 0 }; 148 | SHGetFileInfoA((LPCSTR)pidl, 0, &sfi, sizeof(SHFILEINFO), SHGFI_PIDL | SHGFI_SYSICONINDEX); 149 | int imageIndex = ImageList_AddIcon(hImageList, sfi.hIcon); 150 | DestroyIcon(sfi.hIcon); 151 | 152 | 153 | // Create the menu item 154 | MENUITEMINFOA mii = { sizeof(MENUITEMINFO) }; 155 | mii.fMask = MIIM_STRING | MIIM_ID | MIIM_SUBMENU | MIIM_BITMAP | MIIM_DATA; 156 | mii.wID = i; // Use a unique ID for the item 157 | mii.dwTypeData = displayName; 158 | mii.hbmpItem = HBMMENU_CALLBACK; 159 | mii.dwItemData = (ULONG_PTR)imageIndex; 160 | 161 | // Check if it's a folder 162 | IShellFolder* pSubFolder = NULL; 163 | hr = pShellFolder->BindToObject(pidl, NULL, IID_IShellFolder, (LPVOID*)&pSubFolder); 164 | if (SUCCEEDED(hr)) 165 | { 166 | HMENU hSubMenu = CreateMenuFromShellFolder(pSubFolder, hwndOwner, hImageList); 167 | if (hSubMenu) 168 | { 169 | mii.hSubMenu = hSubMenu; 170 | mii.fMask |= MIIM_SUBMENU; 171 | } 172 | pSubFolder->Release(); 173 | } 174 | 175 | InsertMenuItemA(hMenu, -1, TRUE, &mii); 176 | i++; 177 | } 178 | CoTaskMemFree(pidl); 179 | } 180 | pEnum->Release(); 181 | } 182 | 183 | return hMenu; 184 | } 185 | 186 | // 187 | // FUNCTION: MyRegisterClass() 188 | // 189 | // PURPOSE: Registers the window class. 190 | // 191 | ATOM MyRegisterClass(HINSTANCE hInstance) 192 | { 193 | WNDCLASSEXW wcex; 194 | 195 | wcex.cbSize = sizeof(WNDCLASSEX); 196 | 197 | wcex.style = CS_HREDRAW | CS_VREDRAW; 198 | wcex.lpfnWndProc = WndProc; 199 | wcex.cbClsExtra = 0; 200 | wcex.cbWndExtra = 0; 201 | wcex.hInstance = hInstance; 202 | wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EXPLODER)); 203 | wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); 204 | wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW); 205 | wcex.lpszMenuName = 0; 206 | wcex.lpszClassName = szWindowClass; 207 | wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); 208 | 209 | return RegisterClassExW(&wcex); 210 | } 211 | 212 | // 213 | // FUNCTION: InitInstance(HINSTANCE, int) 214 | // 215 | // PURPOSE: Saves instance handle and creates main window 216 | // 217 | // COMMENTS: 218 | // 219 | // In this function, we save the instance handle in a global variable and 220 | // create and display the main program window. 221 | // 222 | BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) 223 | { 224 | hInst = hInstance; // Store instance handle in our global variable 225 | 226 | HWND hWnd = CreateWindowExW( 227 | WS_EX_TOOLWINDOW | WS_EX_TOPMOST, 228 | szWindowClass, 229 | NULL, 230 | WS_POPUP, 231 | 0, screenHeight - taskbarHeight, screenWidth, taskbarHeight, 232 | NULL, 233 | NULL, 234 | hInstance, 235 | NULL); 236 | if (!hWnd) 237 | { 238 | return FALSE; 239 | } 240 | 241 | m_hTaskBar = FindWindow(L"Shell_TrayWnd", NULL); 242 | if (FindWindow(L"Shell_TrayWnd", NULL)) underExplorer = true; 243 | else underExplorer = false; 244 | 245 | if (underExplorer) 246 | { 247 | APPBARDATA msgData; 248 | msgData.cbSize = sizeof(msgData); 249 | msgData.hWnd = m_hTaskBar; 250 | msgData.lParam = ABS_AUTOHIDE; 251 | SHAppBarMessage(ABM_SETSTATE, &msgData); 252 | SetWindowPos(m_hTaskBar, HWND_BOTTOM, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); 253 | } 254 | AppBar_Register(hWnd); 255 | AppBar_SetSide(hWnd, ABE_BOTTOM); 256 | ShowWindow(hWnd, nCmdShow); 257 | 258 | HMODULE hShell32Module = GetModuleHandle(L"SHELL32.DLL"); 259 | if (!hShell32Module) hShell32Module = LoadLibrary(L"SHELL32.DLL"); 260 | if (hShell32Module) 261 | { 262 | RunDlg = (RUNDLGPROC)GetProcAddress(hShell32Module, (LPCSTR)MAKELPARAM(61, 0)); 263 | ShutdownDlg = (SHUTDOWNDLGPROC)GetProcAddress(hShell32Module, (LPCSTR)MAKELPARAM(60, 0)); 264 | SHCreateDesktopOrig = (SHCreateDesktopAPI)GetProcAddress(hShell32Module, (LPSTR)200); 265 | SHDesktopMessageLoop = (SHCreateDesktopAPI)GetProcAddress(hShell32Module, (LPSTR)201); 266 | } 267 | HMODULE user32 = LoadLibrary(L"user32.dll"); 268 | if (user32) 269 | { 270 | IsShellFrameWindow = (IsShellWindow_t)GetProcAddress(user32, (LPCSTR)2573); 271 | } 272 | 273 | RegisterShellHook = (FARPROC(__stdcall*) (HWND, DWORD))GetProcAddress(hShell32Module, (LPCSTR)((long)0xb5)); 274 | WM_ShellHook = RegisterWindowMessage(L"SHELLHOOK"); 275 | RegisterShellHook(NULL, true); 276 | RegisterShellHook(hWnd, 3); 277 | 278 | int exStyle = (int)GetWindowLongPtr(hWnd, -20); 279 | exStyle |= 128; 280 | SetWindowLongPtr(hWnd, -20, exStyle); 281 | UpdateWindow(hWnd); 282 | hTray = hWnd; 283 | return TRUE; 284 | } 285 | HRESULT BindToDesktop(LPCITEMIDLIST pidl, IShellFolder** ppsfResult) 286 | { 287 | HRESULT hr; 288 | IShellFolder* psfDesktop; 289 | *ppsfResult = NULL; 290 | hr = SHGetDesktopFolder(&psfDesktop); 291 | if (FAILED(hr)) 292 | return hr; 293 | hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARGS(ppsfResult)); 294 | return hr; 295 | } 296 | static HRESULT GetMergedFolder(int folder1, int folder2, IShellFolder** ppsfStartMenu) 297 | { 298 | HRESULT hr; 299 | LPITEMIDLIST pidlUserStartMenu; 300 | LPITEMIDLIST pidlCommonStartMenu; 301 | IShellFolder* psfUserStartMenu = nullptr; 302 | IShellFolder* psfCommonStartMenu = nullptr; 303 | IAugmentedShellFolder* pasf = nullptr; 304 | *ppsfStartMenu = NULL; 305 | hr = CoCreateInstance(CLSID_MergedFolder, 0LL, 1u, GUID_2f711b17_773c_41d4_93fa_7f23edcecb66, (LPVOID*)&pasf); 306 | hr = SHGetSpecialFolderLocation(NULL, folder1, &pidlUserStartMenu); 307 | if (FAILED(hr)) 308 | { 309 | hr = SHGetSpecialFolderLocation(NULL, folder2, &pidlCommonStartMenu); 310 | if (FAILED(hr)) 311 | return hr; 312 | hr = BindToDesktop(pidlCommonStartMenu, ppsfStartMenu); 313 | ILFree(pidlCommonStartMenu); 314 | return hr; 315 | } 316 | hr = SHGetSpecialFolderLocation(NULL, folder2, &pidlCommonStartMenu); 317 | if (FAILED(hr)) 318 | { 319 | hr = BindToDesktop(pidlUserStartMenu, ppsfStartMenu); 320 | ILFree(pidlUserStartMenu); 321 | return hr; 322 | } 323 | hr = BindToDesktop(pidlUserStartMenu, &psfUserStartMenu); 324 | if (FAILED(hr)) 325 | return hr; 326 | hr = BindToDesktop(pidlCommonStartMenu, &psfCommonStartMenu); 327 | if (FAILED(hr)) 328 | return hr; 329 | GUID GUID_NULL = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } }; 330 | hr = pasf->AddNameSpace(&GUID_NULL, psfUserStartMenu, pidlUserStartMenu, 0x0FF0A, 2); 331 | if (FAILED(hr)) 332 | return hr; 333 | hr = pasf->AddNameSpace(&GUID_NULL, psfCommonStartMenu, pidlCommonStartMenu, 0x0E, 2); 334 | if (FAILED(hr)) 335 | return hr; 336 | *ppsfStartMenu = pasf; 337 | ILFree(pidlCommonStartMenu); 338 | ILFree(pidlUserStartMenu); 339 | return hr; 340 | } 341 | 342 | void ShowContextMenu(HWND hwnd, POINT pt, HINSTANCE hInst, WORD i, HMENU sec, LPARAM lp) 343 | { 344 | HMENU hMenu; 345 | if (sec == NULL) hMenu = LoadMenu(hInst, MAKEINTRESOURCE(i)); 346 | else hMenu = sec; 347 | if (hMenu) 348 | { 349 | HMENU hSubMenu; 350 | if (sec == NULL) hSubMenu = GetSubMenu(hMenu, 0); 351 | else hSubMenu = sec; 352 | 353 | UINT uFlags = TPM_RIGHTBUTTON; 354 | if (GetSystemMetrics(SM_MENUDROPALIGNMENT) != 0) uFlags |= TPM_RIGHTALIGN; 355 | else uFlags |= TPM_LEFTALIGN; 356 | 357 | uFlags |= TPM_RETURNCMD; 358 | 359 | if (i == IDR_START && sec == NULL) 360 | Button_SetState(start, TRUE); 361 | 362 | if (i == IDR_START) 363 | { 364 | //new 365 | IShellFolder* shell; 366 | hml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), 367 | GetSystemMetrics(SM_CYSMICON), 368 | ILC_COLOR32, 1, 1); 369 | HRESULT result = GetMergedFolder(CSIDL_PROGRAMS, CSIDL_COMMON_PROGRAMS, &shell); 370 | HMENU hMenutoAdd = CreateMenuFromShellFolder(shell, NULL, hml); 371 | 372 | MENUITEMINFO mii = { 0 }; 373 | mii.cbSize = sizeof(MENUITEMINFO); 374 | mii.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_ID; 375 | mii.fType = MFT_STRING; 376 | mii.dwTypeData = (LPWSTR)L"Programs"; 377 | mii.hSubMenu = hMenutoAdd; 378 | mii.wID = 50998; 379 | 380 | InsertMenuItem(hSubMenu, 0, TRUE, &mii); 381 | shell->Release(); 382 | } 383 | 384 | if (hSubMenu != 0) 385 | menuItemId = TrackPopupMenuEx(hSubMenu, uFlags, pt.x, pt.y, hwnd, NULL); 386 | 387 | if (i == IDR_START && sec == NULL) 388 | Button_SetState(start, FALSE); 389 | 390 | if (menuItemId != 0) 391 | { 392 | if (sec != NULL) 393 | SendMessage((HWND)lp, WM_SYSCOMMAND, menuItemId, NULL); 394 | else 395 | SendMessage(hwnd, menuItemId, NULL, NULL); 396 | } 397 | } 398 | } 399 | 400 | bool isWindow(HWND wnd) 401 | { 402 | if (!IsWindow(wnd)) 403 | return FALSE; 404 | 405 | if (IsShellFrameWindow) 406 | { 407 | if (IsShellFrameWindow(wnd)) 408 | return TRUE; 409 | } 410 | 411 | if (GetWindowTextLength(wnd) == 0) 412 | return FALSE; 413 | 414 | if (!IsWindowVisible(wnd)) 415 | return FALSE; 416 | 417 | BOOL bCloaked; 418 | DwmGetWindowAttribute(wnd, DWMWA_CLOAKED, &bCloaked, sizeof(BOOL)); 419 | if (bCloaked) 420 | return FALSE; 421 | 422 | return TRUE; 423 | 424 | } 425 | 426 | void AddHWND(HWND wnd) 427 | { 428 | LVITEM item; 429 | item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; 430 | item.iSubItem = 0; 431 | unsigned row = ListView_GetItemCount(hWndListView); 432 | 433 | WCHAR windowTitle[MAX_PATH]; 434 | if (isWindow(wnd)) 435 | { 436 | GetWindowText(wnd, windowTitle, MAX_PATH); 437 | if (wcscmp(windowTitle,L"Program Manager")) 438 | { 439 | 440 | item.iItem = row; 441 | item.pszText = windowTitle; 442 | item.iImage = row; 443 | item.lParam = (LPARAM)wnd; 444 | ListView_InsertItem(hWndListView, &item); 445 | 446 | // icon 447 | HICON icon = (HICON)SendMessage(wnd, WM_GETICON, ICON_SMALL2, 0); 448 | if (icon == 0) 449 | icon = (HICON)SendMessage(wnd, WM_GETICON, ICON_SMALL, 0); 450 | if (icon == 0) 451 | icon = (HICON)SendMessage(wnd, WM_GETICON, ICON_BIG, 0); 452 | if (icon == 0) 453 | icon = (HICON)GetClassLongPtr(wnd, -14); 454 | if (icon == 0) 455 | icon = (HICON)GetClassLongPtr(wnd, -34); 456 | 457 | HICON hIcon = ImageList_GetIcon(hSmall, row, ILD_NORMAL); 458 | if (hIcon != NULL) 459 | { 460 | // hack 461 | ImageList_ReplaceIcon(hSmall, row, icon); 462 | DestroyIcon(hIcon); 463 | } 464 | else 465 | { 466 | ImageList_AddIcon(hSmall, icon); 467 | } 468 | } 469 | } 470 | } 471 | 472 | void RemoveHWND(HWND wnd) 473 | { 474 | int count = ListView_GetItemCount(hWndListView); 475 | for (int i = 0; i < count; i++) 476 | { 477 | LVITEM lv; 478 | lv.iItem = i; 479 | lv.mask = LVIF_PARAM | LVIF_IMAGE; 480 | ListView_GetItem(hWndListView, &lv); 481 | if ((HWND)lv.lParam == wnd) 482 | { 483 | ListView_DeleteItem(hWndListView, i); 484 | //ImageList_Remove(hSmall, i); 485 | ListView_Arrange(hWndListView, LVA_ALIGNLEFT); 486 | count--; 487 | i--; 488 | } 489 | } 490 | } 491 | 492 | // 493 | // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) 494 | // 495 | // PURPOSE: Processes messages for the main window. 496 | // 497 | // WM_COMMAND - process the application menu 498 | // WM_PAINT - Paint the main window 499 | // WM_DESTROY - post a quit message and return 500 | // 501 | // 502 | LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 503 | { 504 | switch (message) 505 | { 506 | case WM_CREATE: 507 | { 508 | start = CreateWindow(L"button", L"", BS_NOTIFY | BS_TEXT | WS_CHILD | WS_VISIBLE, -1,-1, 65, 509 | taskbarHeight+2, hWnd, (HMENU)199, hInst, NULL); 510 | 511 | HBITMAP hbit = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_START)); 512 | SendMessage(start, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hbit); 513 | WCHAR szStart[MAX_LOADSTRING]; 514 | LoadString(hInst, IDS_START, szStart, MAX_LOADSTRING); 515 | SetWindowText(start, szStart); 516 | 517 | timeWnd = CreateWindow(L"static", L"time", 518 | SS_NOTIFY | SS_SUNKEN | SS_CENTER | WS_CHILD | SS_CENTERIMAGE | WS_VISIBLE, 519 | screenWidth - 68, 3, 64, taskbarHeight - 6, hWnd, (HMENU)200, hInst, NULL); 520 | 521 | INITCOMMONCONTROLSEX icex; 522 | icex.dwICC = ICC_LISTVIEW_CLASSES; 523 | InitCommonControlsEx(&icex); 524 | 525 | hWndListView = CreateWindow(WC_LISTVIEW, L"", 526 | WS_CHILD | LVS_REPORT | WS_VISIBLE | LVS_NOSCROLL | LVS_SINGLESEL | LVS_SHOWSELALWAYS, 527 | 68, 1, screenWidth - (75 * 2), taskbarHeight - 2, 528 | hWnd, (HMENU)201, hInst, NULL); 529 | SetWindowTheme(hWndListView, L"Explorer", NULL); 530 | ListView_SetView(hWndListView, LV_VIEW_TILE); 531 | ListView_SetExtendedListViewStyle(hWndListView, LVS_EX_TRANSPARENTBKGND); 532 | LVTILEVIEWINFO tvi; 533 | tvi.dwFlags = LVTVIF_FIXEDSIZE; 534 | tvi.cbSize = sizeof(tvi); 535 | tvi.dwMask = LVTVIM_TILESIZE; 536 | tvi.sizeTile.cx = 150; 537 | tvi.sizeTile.cy = taskbarHeight -2; 538 | ListView_SetTileViewInfo(hWndListView, &tvi); 539 | ListView_SetExtendedListViewStyleEx(hWndListView, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); 540 | 541 | hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON), 542 | GetSystemMetrics(SM_CYSMICON), 543 | ILC_COLOR32, 1, 1); 544 | ListView_SetImageList(hWndListView, hSmall, LVSIL_NORMAL); 545 | for (const auto& wnd : hwnd) 546 | { 547 | AddHWND(wnd); 548 | } 549 | GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, times, MAX_PATH); 550 | SetWindowText(timeWnd, times); 551 | SetTimer(hWnd, IDT_TIMER1, 1000, (TIMERPROC)NULL); 552 | 553 | // Hide minimized windows... 554 | MINIMIZEDMETRICS mm; 555 | ZeroMemory(&mm, sizeof(MINIMIZEDMETRICS)); 556 | mm.cbSize = sizeof(MINIMIZEDMETRICS); 557 | SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &mm, false); 558 | mm.iArrange = ARW_BOTTOMLEFT | ARW_HIDE; // ARW_HIDE == 8 559 | SystemParametersInfo(SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &mm, SPIF_SENDCHANGE); 560 | 561 | 562 | // tell shell that it is ready 563 | HANDLE hShellReadyEvent = OpenEvent(EVENT_MODIFY_STATE, false, L"msgina: ShellReadyEvent"); 564 | if (hShellReadyEvent != NULL) 565 | { 566 | SetEvent(hShellReadyEvent); 567 | CloseHandle(hShellReadyEvent); 568 | } 569 | break; 570 | } 571 | case WM_COMMAND: 572 | { 573 | switch (HIWORD(wParam)) 574 | { 575 | case STN_CLICKED: 576 | { 577 | if (LOWORD(wParam) == 200) 578 | { 579 | ShowLegacyClockExperience(hWnd); 580 | return 0; 581 | } 582 | else if (LOWORD(wParam) == 199) 583 | { 584 | ok.x = 2; 585 | ok.y = screenHeight - ((taskbarHeight)+2); 586 | ShowContextMenu(hWnd, ok, hInst, IDR_START, NULL, NULL); 587 | return 0; 588 | } 589 | } 590 | case STN_DBLCLK: 591 | { 592 | /* 593 | ShellExecuteA(0,"open","rundll32.exe","shell32.dll,Control_RunDLL timedate.cpl",NULL,0); 594 | */ 595 | return 0; 596 | } 597 | } 598 | break; 599 | } 600 | case WM_RBUTTONUP: 601 | { 602 | if ((LOWORD(wParam) != 199) || (LOWORD(wParam) == 201)) 603 | { 604 | GetCursorPos(&ok); 605 | ShowContextMenu(hWnd, ok, hInst, IDR_PROP, NULL, NULL); 606 | return 0; 607 | } 608 | } 609 | //return DefWindowProc(hWnd, message, wParam, lParam); 610 | case WM_NOTIFY: 611 | { 612 | LPNMHDR lpnmh = (LPNMHDR)lParam; 613 | switch (lpnmh->code) 614 | { 615 | case NM_RCLICK: 616 | { 617 | GetCursorPos(&ok); 618 | ScreenToClient(lpnmh->hwndFrom, &ok); 619 | LVHITTESTINFO hitTestInfo; 620 | hitTestInfo.pt = ok; 621 | hitTestInfo.flags = LVHT_ONITEM; 622 | int itemIndex = ListView_HitTest(lpnmh->hwndFrom, &hitTestInfo); 623 | if (itemIndex != -1 && (hitTestInfo.flags & LVHT_ONITEM)) 624 | { 625 | LVITEM lv; 626 | lv.iItem = itemIndex; 627 | lv.mask = LVIF_PARAM; 628 | ListView_GetItem(hWndListView, &lv); 629 | HMENU hSysMenu = GetSystemMenu((HWND)lv.lParam, FALSE); 630 | if (hSysMenu) 631 | { 632 | GetCursorPos(&ok); 633 | ShowContextMenu(hWnd, ok, hInst, NULL, hSysMenu, lv.lParam); 634 | 635 | } 636 | } 637 | else 638 | { 639 | GetCursorPos(&ok); 640 | ShowContextMenu(hWnd, ok, hInst, IDR_PROP, NULL, NULL); 641 | } 642 | 643 | return 0; 644 | } 645 | // what 646 | case NM_DBLCLK: 647 | return 1; 648 | case LVN_ITEMCHANGED: 649 | { 650 | NMLISTVIEW* pNMListView = (NMLISTVIEW*)lParam; 651 | if (((pNMListView->uNewState & LVIS_FOCUSED))) 652 | { 653 | HWND wnd = (HWND)pNMListView->lParam; 654 | 655 | if (g_prevSelectedWindow == wnd) 656 | { 657 | ShowWindow(wnd, SW_MINIMIZE); 658 | g_prevSelectedWindow = NULL; 659 | } 660 | else 661 | { 662 | SwitchToThisWindow(wnd, TRUE); 663 | g_prevSelectedWindow = wnd; 664 | } 665 | } 666 | break; 667 | } 668 | } 669 | break; 670 | } 671 | case ID_MENU_EXIT: 672 | { 673 | AppBar_UnRegister(hWnd); 674 | KillTimer(hWnd, IDT_TIMER1); 675 | PostQuitMessage(0); 676 | break; 677 | } 678 | case ID_MENU_SHUTDOWN: 679 | { 680 | ShutdownDlg(0, 0); 681 | break; 682 | } 683 | case ID_MENU_RUN: 684 | { 685 | RunDlg(hWnd, NULL, NULL, NULL, NULL, 0); 686 | break; 687 | } 688 | case WM_TIMER: 689 | { 690 | switch (wParam) 691 | { 692 | case IDT_TIMER1: 693 | { 694 | GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, times, MAX_PATH); 695 | SetWindowText(timeWnd, times); 696 | return 0; 697 | } 698 | } 699 | break; 700 | } 701 | case WM_DESTROY: 702 | AppBar_UnRegister(hWnd); 703 | KillTimer(hWnd, IDT_TIMER1); 704 | PostQuitMessage(0); 705 | break; 706 | default: 707 | { 708 | if (message == WM_ShellHook) 709 | { 710 | if (wParam == HSHELL_WINDOWCREATED) 711 | AddHWND((HWND)lParam); 712 | else if (wParam == HSHELL_WINDOWDESTROYED) 713 | RemoveHWND((HWND)lParam); 714 | } 715 | return DefWindowProc(hWnd, message, wParam, lParam); 716 | } 717 | } 718 | return DefWindowProc(hWnd, message, wParam, lParam); 719 | } 720 | 721 | BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) { 722 | std::vector& titles = *reinterpret_cast*>(lParam); 723 | titles.push_back(hwnd); 724 | return TRUE; 725 | } 726 | 727 | // Message handler for about box. 728 | INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 729 | { 730 | UNREFERENCED_PARAMETER(lParam); 731 | switch (message) 732 | { 733 | case WM_INITDIALOG: 734 | return (INT_PTR)TRUE; 735 | 736 | case WM_COMMAND: 737 | if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) 738 | { 739 | EndDialog(hDlg, LOWORD(wParam)); 740 | return (INT_PTR)TRUE; 741 | } 742 | break; 743 | } 744 | return (INT_PTR)FALSE; 745 | } 746 | -------------------------------------------------------------------------------- /Exploder/Exploder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "resource.h" 4 | #include "Variables.h" 5 | #include "Win32Clock.h" 6 | #include "Appbar.h" 7 | #include "desktray.h" 8 | #include "augmentedshellfolder.h" 9 | -------------------------------------------------------------------------------- /Exploder/Exploder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rounk-ctrl/Exploder/ff8e07a9a40b38a3bfe67334bb34c16b8eaa5cec/Exploder/Exploder.rc -------------------------------------------------------------------------------- /Exploder/Exploder.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {17935f4c-14d8-43c0-a838-f2ba3169200c} 25 | Exploder 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | true 81 | 82 | 83 | false 84 | 85 | 86 | 87 | Level3 88 | true 89 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 90 | true 91 | 92 | 93 | Windows 94 | true 95 | 96 | 97 | 98 | 99 | Level3 100 | true 101 | true 102 | true 103 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 104 | true 105 | 106 | 107 | Windows 108 | true 109 | true 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | _DEBUG;_WINDOWS;%(PreprocessorDefinitions) 118 | true 119 | 120 | 121 | Windows 122 | true 123 | 124 | 125 | 126 | 127 | Level3 128 | true 129 | true 130 | true 131 | NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 132 | true 133 | 134 | 135 | Windows 136 | true 137 | true 138 | true 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /Exploder/Variables.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define INITGUID 3 | #include "framework.h" 4 | DEFINE_GUID(CLSID_MergedFolder, 0x26FDC864, 0x0BE88, 0x46E7, 0x92, 0x35, 0x3, 0x2D, 0x8E, 0x0A5, 0x16, 0x2E); 5 | DEFINE_GUID(GUID_2f711b17_773c_41d4_93fa_7f23edcecb66, 0x2f711b17, 0x773c, 0x41d4, 0x93, 0xfa, 0x7f, 0x23, 0xed, 0xce, 0xcb, 0x66); 6 | #define MAX_LOADSTRING 100 7 | 8 | int taskbarHeight = 24; 9 | int screenWidth = GetSystemMetrics(SM_CXSCREEN); 10 | int screenHeight = GetSystemMetrics(SM_CYSCREEN); 11 | LPWSTR times = new WCHAR[MAX_PATH]; 12 | HINSTANCE hInst; // current instance 13 | WCHAR szTitle[MAX_LOADSTRING]; // The title bar text 14 | WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name 15 | HWND start; 16 | HWND timeWnd; 17 | UINT menuItemId; 18 | POINT ok; 19 | HWND hWndListView; 20 | HIMAGELIST hml; 21 | BOOL underExplorer; 22 | HMODULE hShDocVwModule; 23 | std::vector hwnd; 24 | HWND hwnd_desktop; 25 | HANDLE hMutex; 26 | HIMAGELIST hSmall; 27 | HANDLE thingtrturn; 28 | static HWND m_hTaskBar; 29 | 30 | static HWND g_prevSelectedWindow = NULL; 31 | unsigned int WM_ShellHook = 0; 32 | 33 | typedef void(__stdcall* RUNDLGPROC)(HWND, HICON, LPCSTR, LPCSTR, LPCSTR, int); 34 | typedef void(__stdcall* SHUTDOWNDLGPROC)(HWND, int); 35 | typedef BOOL(WINAPI* IsShellWindow_t)(HWND); 36 | FARPROC(__stdcall* RegisterShellHook) (HWND, DWORD) = NULL; 37 | typedef void(__stdcall* ShellDDEInit_t)(bool bInit); 38 | typedef HWND(WINAPI* SHCreateDesktopAPI)(PVOID); 39 | typedef DWORD(WINAPI* SHPtrParamAPI)(PVOID); 40 | 41 | static SHCreateDesktopAPI SHCreateDesktopOrig; 42 | static SHCreateDesktopAPI SHDesktopMessageLoop; 43 | RUNDLGPROC RunDlg = NULL; 44 | SHUTDOWNDLGPROC ShutdownDlg = NULL; 45 | IsShellWindow_t IsShellFrameWindow = NULL; 46 | ShellDDEInit_t ShellDDEInit = NULL; 47 | -------------------------------------------------------------------------------- /Exploder/Win32Clock.cpp: -------------------------------------------------------------------------------- 1 | #include "Win32Clock.h" 2 | 3 | BOOL ShowLegacyClockExperience(HWND hWnd) 4 | { 5 | if (!hWnd) return FALSE; 6 | HRESULT hr = S_OK; 7 | Win32Clock* pWin32Clock = NULL; 8 | hr = CoCreateInstance( 9 | (REFCLSID)GUID_Win32Clock, 10 | NULL, 11 | CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, 12 | (REFIID)IID_Win32Clock, 13 | (void**)&pWin32Clock 14 | ); 15 | if (SUCCEEDED(hr)) 16 | { 17 | RECT rc; 18 | GetWindowRect(hWnd, &rc); 19 | pWin32Clock->lpVtbl->ShowWin32Clock(pWin32Clock, hWnd, &rc); 20 | pWin32Clock->lpVtbl->Release(pWin32Clock); 21 | } 22 | return TRUE; 23 | } -------------------------------------------------------------------------------- /Exploder/Win32Clock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "framework.h" 3 | 4 | // implementation of Win32Clock 5 | DEFINE_GUID(GUID_Win32Clock, 6 | 0x0A323554A, 7 | 0x0FE1, 0x4E49, 0xae, 0xe1, 8 | 0x67, 0x22, 0x46, 0x5d, 0x79, 0x9f 9 | ); 10 | DEFINE_GUID(IID_Win32Clock, 11 | 0x7A5FCA8A, 12 | 0x76B1, 0x44C8, 0xa9, 0x7c, 13 | 0xe7, 0x17, 0x3c, 0xca, 0x5f, 0x4f 14 | ); 15 | typedef interface Win32Clock Win32Clock; 16 | typedef struct Win32ClockVtbl 17 | { 18 | BEGIN_INTERFACE 19 | 20 | HRESULT(STDMETHODCALLTYPE* QueryInterface)( 21 | Win32Clock* This, 22 | /* [in] */ REFIID riid, 23 | /* [annotation][iid_is][out] */ 24 | _COM_Outptr_ void** ppvObject); 25 | 26 | ULONG(STDMETHODCALLTYPE* AddRef)( 27 | Win32Clock* This); 28 | 29 | ULONG(STDMETHODCALLTYPE* Release)( 30 | Win32Clock* This); 31 | 32 | HRESULT(STDMETHODCALLTYPE* ShowWin32Clock)( 33 | Win32Clock* This, 34 | /* [in] */ HWND hWnd, 35 | /* [in] */ LPRECT lpRect); 36 | 37 | END_INTERFACE 38 | } Win32ClockVtbl; 39 | 40 | interface Win32Clock 41 | { 42 | CONST_VTBL struct Win32ClockVtbl* lpVtbl; 43 | }; 44 | BOOL ShowLegacyClockExperience(HWND hWnd); 45 | -------------------------------------------------------------------------------- /Exploder/augmentedshellfolder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define INITGUID 3 | #include "framework.h" 4 | MIDL_INTERFACE("2f711b17-773c-41d4-93fa-7f23edcecb66") 5 | IAugmentedShellFolder : public IShellFolder 6 | { 7 | STDMETHOD(AddNameSpace)(LPGUID, IShellFolder*, LPCITEMIDLIST, ULONG, ULONG) PURE; 8 | STDMETHOD(GetNameSpaceID)(LPCITEMIDLIST, LPGUID) PURE; 9 | STDMETHOD(QueryNameSpace)(ULONG, LPGUID, IShellFolder**) PURE; 10 | STDMETHOD(EnumNameSpace)(ULONG, PULONG) PURE; 11 | }; 12 | -------------------------------------------------------------------------------- /Exploder/desktray.cpp: -------------------------------------------------------------------------------- 1 | #include "desktray.h" 2 | 3 | CDeskTray::CDeskTray() 4 | { 5 | desktop = NULL; 6 | } 7 | STDMETHODIMP_(HRESULT __stdcall) CDeskTray::QueryInterface(REFIID riid, void** ppvObject) 8 | { 9 | return this->QueryInterface(riid, ppvObject); 10 | } 11 | 12 | STDMETHODIMP_(ULONG __stdcall) CDeskTray::AddRef(void) 13 | { 14 | return 2; 15 | } 16 | 17 | STDMETHODIMP_(ULONG __stdcall) CDeskTray::Release(void) 18 | { 19 | return 1; 20 | } 21 | 22 | STDMETHODIMP_(UINT __stdcall) CDeskTray::AppBarGetState(void) 23 | { 24 | return ABS_ALWAYSONTOP; 25 | } 26 | 27 | STDMETHODIMP_(HRESULT __stdcall) CDeskTray::GetTrayWindow(HWND* wnd) 28 | { 29 | *wnd = hTray; 30 | return S_OK; 31 | } 32 | 33 | STDMETHODIMP_(HRESULT __stdcall) CDeskTray::SetDesktopWindow(HWND wnd) 34 | { 35 | desktop = wnd; 36 | return S_OK; 37 | } 38 | 39 | STDMETHODIMP_(HRESULT __stdcall) CDeskTray::SetVar(INT, ULONG) 40 | { 41 | return S_OK; 42 | } 43 | -------------------------------------------------------------------------------- /Exploder/desktray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "framework.h" 3 | #include "Appbar.h" 4 | 5 | // useless 6 | DECLARE_INTERFACE_(IDeskTray, IUnknown) 7 | { 8 | // IUnknown 9 | STDMETHOD(QueryInterface) (REFIID riid, LPVOID * ppvObj) PURE; 10 | STDMETHOD_(ULONG, AddRef) (THIS) PURE; 11 | STDMETHOD_(ULONG, Release) (THIS) PURE; 12 | 13 | // IDeskTray 14 | STDMETHOD_(UINT, AppBarGetState)(THIS) PURE; 15 | STDMETHOD(GetTrayWindow)(THIS_ HWND * phwndTray) PURE; 16 | STDMETHOD(SetDesktopWindow)(THIS_ HWND hwndDesktop) PURE; 17 | STDMETHOD(SetVar)(THIS_ int var, DWORD value) PURE; 18 | }; 19 | 20 | class CDeskTray : IDeskTray 21 | { 22 | public: 23 | CDeskTray(); 24 | 25 | STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject); 26 | STDMETHODIMP_(ULONG) AddRef(THIS); 27 | STDMETHODIMP_(ULONG) Release(THIS); 28 | 29 | STDMETHODIMP_(UINT) AppBarGetState(THIS); 30 | STDMETHODIMP GetTrayWindow(HWND*); 31 | STDMETHODIMP SetDesktopWindow(HWND); 32 | STDMETHODIMP SetVar(INT, ULONG); 33 | 34 | HWND desktop; 35 | }; 36 | -------------------------------------------------------------------------------- /Exploder/framework.h: -------------------------------------------------------------------------------- 1 | // header.h : include file for standard system include files, 2 | // or project specific include files 3 | // 4 | 5 | #pragma once 6 | 7 | #include "targetver.h" 8 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 9 | #ifndef _WIN32_IE 10 | #define _WIN32_IE 0x0500 // Enables all the needed define's in ShellAPI.h 11 | #endif 12 | // Windows Header Files 13 | #include 14 | // C RunTime Header Files 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #pragma comment(lib, "Comctl32.lib") 28 | #pragma comment(lib, "uxtheme.lib") 29 | #pragma comment(lib, "dwmapi.lib") 30 | #include 31 | #include 32 | -------------------------------------------------------------------------------- /Exploder/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Exploder.rc 4 | // 5 | #define IDC_MYICON 2 6 | #define IDD_EXPLODER_DIALOG 102 7 | #define IDS_APP_TITLE 103 8 | #define IDD_ABOUTBOX 103 9 | #define IDM_ABOUT 104 10 | #define IDS_START 104 11 | #define IDI_EXPLODER 107 12 | #define IDI_SMALL 108 13 | #define IDC_EXPLODER 109 14 | #define IDR_MAINFRAME 128 15 | #define IDB_BITMAP1 129 16 | #define IDB_START 129 17 | #define IDT_TIMER1 130 18 | #define IDR_PROP 131 19 | #define IDR_START 132 20 | #define IDT_TIMER2 135 21 | #define ID_MENU_PROPERTIES 32771 22 | #define ID_MENU_EXIT 32772 23 | #define ID_MENU_RUN 32773 24 | #define ID_MENU_SHUTDOWN 32774 25 | #define ID_MENU_PROGRAMS 32775 26 | #define ID_PROGRAMS_STUFF 32776 27 | #define ID_PROGRAMS_proglist 32777 28 | #define IDC_STATIC -1 29 | 30 | // Next default values for new objects 31 | // 32 | #ifdef APSTUDIO_INVOKED 33 | #ifndef APSTUDIO_READONLY_SYMBOLS 34 | #define _APS_NO_MFC 1 35 | #define _APS_NEXT_RESOURCE_VALUE 133 36 | #define _APS_NEXT_COMMAND_VALUE 32778 37 | #define _APS_NEXT_CONTROL_VALUE 1000 38 | #define _APS_NEXT_SYMED_VALUE 110 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /Exploder/small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rounk-ctrl/Exploder/ff8e07a9a40b38a3bfe67334bb34c16b8eaa5cec/Exploder/small.ico -------------------------------------------------------------------------------- /Exploder/startclassic.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rounk-ctrl/Exploder/ff8e07a9a40b38a3bfe67334bb34c16b8eaa5cec/Exploder/startclassic.bmp -------------------------------------------------------------------------------- /Exploder/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // // Including SDKDDKVer.h defines the highest available Windows platform. 4 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 5 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 6 | #include 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | fire shell 2 | 3 | ![image](https://github.com/user-attachments/assets/916b91ba-45a2-4bc3-bf4a-2ed7c276714f) 4 | --------------------------------------------------------------------------------