ʇǝǝๅ ftw could you update the github repo? i'm curious about the systray implementation
It's actually quite weird:
First I get a handle to the systray (just some repetitive getting of child windows)
The object the handle refers to is a Win32 toolbar, so I can use the TB_BUTTONCOUNT message to get the number of buttons
When I know the button count I can loop through button indexes and send the TB_GETBUTTON message to get information about the button. (Way harder then it sounds: TB_GETBUTTON only works if you specify a memory address in the processes memory space, so I first need to allocate memory inside of explorer.exe and then use some more API calls to copy the object into my own processes memory)
When I have the TBBUTTON object, I can use the memory object at the adress specified by dwData to get even more info about the button.
When I have all info required I send it back to CLI which in turns converts them to C# managed objects.
And all of this is implemented in C++ because doing it in C# makes the already complicated code even more complicated. The code will be uploaded later today.
Cool, thanks. I'm working on a Progman.exe replacement (hopefully I'll be able to replicate the entire Win3.1 shell experience). and I'll probably put the systray icons in the status bar to make it a bit more usable as a shell.
veselcraft there's an absolute path in one of the project references, if you change it to a path relative to the solution directory it will compile without errors.
I'm working on a Progman.exe replacement (hopefully I'll be able to replicate the entire Win3.1 shell experience). and I'll probably put the systray icons in the status bar to make it a bit more usable as a shell.
Hmm, the systray doesn't work for me. GetTrayButtonCount always returns 4, no matter how many tray icons I have, and seems like everything in TBUTTONINFO is null after calling GetTrayButton.
The caveats of TB_GETBUTTON:
If the OS (and specifically explorer.exe) is x64, you NEED to compile for x64, same thing for x86.
Tray icons that are inside of the "arrow" menu, are technically hidden, so they won't show up. You have to enable the option "Settings" -> "Personalization" -> "Taskbar" tab -> "Notification area" setting area -> "Select which icons appear on the taskbar" -> "Always show all icons in the notification area"
All icons that are made from within explorer.exe require Shell_TrayWnd to be the foreground window because they're technically part of the taskbar (wifi, sound, eject menu etc. (battery works though?))
Post by Spitfire_x86 on Feb 14, 2020 2:19:58 GMT -8
I decided to try implementing systray from scratch - no Explorer hooks. I created a window with Shell_TrayWnd class and sent a TaskbarCreated message with C++, then redirected all WM_COPYDATA messages to my form in C#. So far I got the icons to display, they don't do anything yet though (and some of them repeat, because I forgot to filter out messages other than NIM_ADD ). There's still a long way to go though, I'll have to handle all the Shell_NotifyIcon messages and input events first before it becomes even remotely usable...
Post by Clasurol/Jackal on Feb 14, 2020 7:30:22 GMT -8
I installed a fresh W8.1 VM and tried it in that too, and I'm getting the same error I'm afraid. Got more information this time:
Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: SimpleClassicThemeTaskbar.exe Problem Signature 02: 188.8.131.52 Problem Signature 03: 5e454e3b Problem Signature 04: SimpleClassicThemeTaskbar Problem Signature 05: 184.108.40.206 Problem Signature 06: 5e454e3b Problem Signature 07: 57 Problem Signature 08: 13 Problem Signature 09: System.TypeInitialization OS Version: 6.3.9600.2.0.0.256.89 Locale ID: 1033 Additional Information 1: 57da Additional Information 2: 57dab08f08c7ee896adcb8f73cb2c69d Additional Information 3: 853c Additional Information 4: 853c4c562aeb60061bd6dbab7dadea7c
As for what icons I use (W10, I never used these on the W8 vm): Volume2, unclicky, Simpletwall, Lightshot, Malwarebytes, 3RVX, WinEject, Classic Task Manager.