Live data from Hacker News

Building a new Windows 3.1 app in 2019: A Slack Client

yeokhengmeng.com

101–110 of 248 posts

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#101
post #96
post #2

I built a Win 3.1 app during a company hackathon just for fun. Here, I detail learnings and process for how a new old app can be created with the aid of modern tools and hindsight of old technologies. And perhaps what lessons can it offer us today. Without the benefit of modern libraries and languages, I had to read up and take care of many low level details, socket programming, HTTP, JSON parsing, UI design in code…

Did you get to work with a co-operative task scheduling? This version of Windows still used one I think. What's your experience if so?

Windows (not only the 16-bit 3.x, but going as far as the newest 64-bit ones) uses an event loop for the GUI: your program runs a loop calling the GetMessage function, which blocks until the next window message is available. As long as you don't take too much time processing each window message, you don't have to even think about cooperative task scheduling, since Windows will do it for you while waiting on GetMessage.

(In fact, AFAIK even in modern Windows you should avoid taking too much time to process each window message, since blocking the event loop thread makes the UI for your program unresponsive.)

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#102
post #93

> Windows 10 [...] cannot directly talk to the ancient SMB protocol used by WFW 3.11. Not true, you can downgrade the SMB version requirement in the Windows 10 registry.

But then you'll have to spend the rest of your life dodging Ned Pyle of Microsoft.

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#103
post #80
post #72

Earlier quoted context omitted.

Why would notscript not work on a browser that has no concept of JS?

Because the element isn't valid for the stricter form of HTML that they use. Invalid elements didn't used to show up.

From what I recall of that era, it's the exact opposite: invalid elements (like ) are simply ignored, and their contents shown. That's how works: newer browsers which understand JavaScript know the element and ignore its contents; older browsers which do not understand JavaScript don't know the element so its contents are shown. The same trick is used for : browsers like Netscape which understand frames don't show the contents of that element, while other browsers which don't understand and will show the content of the element, so it can be used as a fallback.

Strict validation of HTML came later with XHTML, but AFAIK all browsers which understand XHTML also understand JavaScript.

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#104
post #96
post #2

I built a Win 3.1 app during a company hackathon just for fun. Here, I detail learnings and process for how a new old app can be created with the aid of modern tools and hindsight of old technologies. And perhaps what lessons can it offer us today. Without the benefit of modern libraries and languages, I had to read up and take care of many low level details, socket programming, HTTP, JSON parsing, UI design in code…

Did you get to work with a co-operative task scheduling? This version of Windows still used one I think. What's your experience if so?

Windows NT and Windies 95 were the first versions to have preemptive scheduling. Windows 3.11 and older would only switch tasks when he program requested new messages from the queue. Thus was totally annoying because most applications were written badly and had moments where they would go off and do things and not return to their message loop for several seconds or worse, hanging the entire system during that time. Windows felt very sluggish because of that.

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#105

This presents c89 as the most antiquated thing in the world, but VS didn't support mixed declarations and code in a .c file until 2015. There is still a lot of code out there that avoids this to be able to work with MS's compilers.

It's now 2019, and as far as I know, MSVC still doesn't have full support for the 20-year-old C99 standard.

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#107
post #45

Notice the binary size of the app is only 64KiB. In the demoscene this would be a disqualification as it's 676 bytes over the limit, but in this case I'll overlook it because of the sheer awesomeness of what you've done (and I'm sure trimming off 676 bytes wouldn't be too difficult ;-) More seriously, this is an excellent proof-of-concept that a Slack client does not need to use hundreds of MB of RAM and consume most…

> More seriously, this is an excellent proof-of-concept that a Slack client does not need to use hundreds of MB of RAM and consume most of a modern CPU core to provide its basic functionality. If you’re so sure that this is possible, then where is the Electron competitor which allows us to build cross platform applications like this, with the same levels of productivity and a consistent and decent user interface? No…

There is Delphi and Lazarus as open-source clone of it

Lazarus can use the Windows API on Windows, gtk/qt on Linux, and carbon/cocoa on Mac.

There is also a custom drawn mode that draws the GUI directly rather than using platform apis. That also runs on Android, but it not maintained anymore, so only up to Android 5 or something

Delphi is supposed to run on Android and iOS.

And Delphi 1 ran on Windows 3.1, so you could have used the same GUI since then

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#108

This is a lot of work to avoid using that WYSIWYG editor.

There's an option to disable the WYSIWYG editor now :)

Unfortunately, it still doesn't work as good as before: text like `Object`s (no space between the ending ` and next text) doesn't work anymore, and according to Slack's support this is 'working as intended'.

Re: Building a new Windows 3.1 app in 2019: A Slack Client

#109
If the target was just "Windows 3.1", he should have built a 32-bit app using the Win32s API [https://en.wikipedia.org/wiki/Win32s]

It's also probably possible to use a current compiler, maybe clang or gcc, to compile such code (officially only up to VC++ 4.2 is supported), although it might require some hacks.

Post reply on HN