Categories
Microsoft Windows

Windows 11

I’m excited for Windows 11. It’s nice to see a visual refresh of the user interface and hopefully some of the new top level improvements lead to a better user experience. I’m just excited for the change and it really has me excited about my plans for a version of Stream that runs on Windows.

As an old Windows user and developer I am disappointed with some aspects of Windows 11. Granted, we haven’t seen a final build yet, but I have my doubts we’ll see everything cleaned up between now and release.

I am really disappointed Microsoft has failed to bring the entire user interface forward. Not everything has been refreshed. There’s a really great piece on NTDEV called “State of the Windows: How many layers of UI inconsistencies are in Windows 10?” go read it. It definitely saved me from having to go track down all the icky UI remnants from various different releases of Windows.

One would think it would be a simple matter of creating windows, buttons, and other elements to maintain consistency. Well, not so fast, hoss. Microsoft’s Windows API is extremely rich and allows you to tweak UI elements to your hearts content. Does that explain why certain apps and parts of the OS look so different? Maybe, I’m not at all certain, but it did make me think about how the Windows API works today and how one might make old apps just work in the new Windows 11 world.

Just update the API, dummy

I’m sure there would be a really great discussion on Raymond Chen’s The Old New Thing discussing what an HWND is but I can’t find one at the moment and I’m being lazy so here’s one from a Microsoft getting started guide called “What is a Window?”

The TL;DR for the impatient is this, it’s an identifier assigned by the Windows API when you create a window. It’s a number. That’s it. A button is a window, a list is a window, a radio button is a window. You get the picture. All visual elements are windows. You compose all these things together to create an app UI. Each on is assigned an HWND.

Remember the Windows SDK, or API, is a procedural C based API. You call functions that operate on things maintained by your app and the OS. When you want to take action on a window in your app you do it by using the HWND you’re given as a result of calling CreateWindow or CreateWindowEx.

So, when you’re ready to, say, close your window and be done with it, you’d call DestroyWindow like this:

BOOL destroyed = ::DestroyWindow(hWnd);

That’s it! Your window is now kaput!

So

With that in mind I asked myself “Self, why doesn’t Microsoft update window functions to use Win UI 3 under the hood?” It seems doable, right? Since an HWND is just an identifier why not replace the guts and everything that doesn’t do custom drawing should just work, right?

Well, maybe, I suppose? Throwing out apps that do their own custom drawing might just work but then again there are thousands and thousands of apps out there running on Windows computers. How could you possibly know if all those apps will draw their UI’s properly if Microsoft replaced the guts of all the windows functions? I suppose we can’t?

Having said that, I sure wish there was an easy way for Microsoft to change the base API’s used by so many Windows apps to just work. I have some ideas on the matter beyond just replacing the underlying API’s but no matter how it’s done it would be a ton of work and maybe, just maybe, Microsoft doesn’t want to do that work. Maybe they just want to move forward.

Maybe it’s time to stop worrying about backward compatibility and leave those old nasty Windows API based apps to evolve or rot until nobody uses them any longer?

Maybe.

Categories
Development Indie iOS Life Mac Weblogging Windows

Focus, Rob

It’s Christmas morning, early. The house is quiet but my brain is going crazy with thoughts of projects I should work on. The thing is, I don’t need any additional projects to work on.

AHHHHHH! When I decided to build Stream it was because I wanted to do something small. I had originally started building a blog editor that would post to WordPress and Tumblr. The core of the app was being written in C++ so I could share that core between iOS, macOS, and Windows apps. It was going to be a lot of work. More work than I had the time to invest.

So, I did my little app: Stream. That took over two years to complete. I spent a lot of time on the guts of the app. Mainly around discovery of feeds and parsing those feeds. As a result I have a decent set of code for dealing with RSS, Atom, JSON Feed, OPML, and HTML. It was a real joy to finally ship.

The bottom line is this, I’m slow. Couple that with limited time to work on stuff and it takes forever to complete a project.

This morning my brain is spinning on the idea of that blogging app. As much as I’d like to do it, I really do love blogging, it’s not the project I really need to pour my efforts into.

The project I need to work on is going to be a many year effort. It’s something I’ve wanted to do for at least 15-years. The target OS has changed and morphed over those years but the app idea hasn’t, and I’m getting help from a longtime friend who just happens to be a really great developer.

Focus, Rob. Focus.

Categories
Microsoft Windows

As a long time Windows user I’d love to see Microsoft spend some time on a visual refresh of the entire OS. There are some places that just look super dated.

Categories
Windows

Windows GPF

Any old Windows Devs out here? Remember the good old GPF? When an application would crash in the early Windows days this is the dialog you’d get.

Categories
Apple Core Labs Design Development Indie iOS Mac Windows

Passion Project: Mixing C++, Objective-C++, and Swift

I know a lot of folks have had to go through the process of bridging to C++ so you can use it from Objective-C or Swift. In my case I’m using it from Swift, so I thought I’d share what the middle Objective-C++ layer looks like. If you’ve done any Objective-C it will look like straight Objective-C, until you look a little closer. That’s when you’ll notice a C++ namespace, new, and delete statement. This code is a straight passthrough to the underlying C++ code — it’s here so Swift code can communicate with the C++ code.

Here’s the code that bridges to our Creatinine Clearance calculation.

You’ll notice a class called PKMConvert that has a class method called genderFromPKMGender. I created a set of mirror enums. One on the iOS side the enums use NS_ENUM syntax, on the C++ side they’re straight C style enums, so this code converts between the two. It’s just a simple mapping.

Another thing you’ll notice is I’m still using “old” C++ syntax to create and destroy objects. I’ve been thinking about updating the syntax to C++11 so I’d use unique_ptr instead. We’ll see if that happens. It’s not a big deal.

Something I’ve been mulling over is releasing the entire PKMath C++ Library as an open source project once I have it working for iOS/Mac, Android, and Windows. I don’t know that it would be overly useful for anyone, but there you go.

Since I haven’t actually written any Swift code in the new RxCalc to use the Objective-C++ code I thought I’d share one of my unit tests for the Creatinine Clearance example above.

Here’s how the different layers look from 30,000 feet. I like pictures, don’t you?rxcalc2layers

Categories
Microsoft Windows

OneDrive flaw in Windows 10

Jerry Fahrni: “However, I can see all OneDrive content on each machine regardless of setting; file and folder names appear in online-only status. This all disappeared with the Windows 10 update. Now you have to pick which folders you wish to sync, and if you don’t sync them they don’t show up in your folder structure. That really ticks me off. That was the best feature of OneDrive. Without it there’s no reason to continue using it. Why would Microsoft remove such a useful feature? It defies logic.”

Jerry is not the only person disappointed with this change Paul Thurrott mention this flaw a few weeks back on Windows Weekly. hopefully Microsoft will follow up with a nice patch to repair this regression.

As a software developer we have to deal with tough choices like this to make sure we ship a stable product on time. As bad as this omission feels it was probably done for the sake of shipping. With Windows 10 the idea is to patch the OS often, as a service. We will see how well this plays out, but this feels like a good candidate for patching sooner rather than later.