Microsoft “Improved” Notepad. I Un-Improved It.

Dave's Garage · Intermediate ·💻 AI-Assisted Coding ·7mo ago

Key Takeaways

The video demonstrates the use of GPT Codex Max 5.1 to generate a perfect clone of Notepad, and the process of building, debugging, and deploying the Retropad application using various tools such as VS Studio, make file, and C++.

Full Transcript

Hey, I'm Dave. Welcome to my shop. Are you getting a little tired of Notepad lately and all the new features and functionality and bonus stuff and AI that's been added to it? Well, I know I do because first of all, I want it to come up as a blank slate each time. I don't want my last sessions notes coming up as the default when I open up Notepad. Second of all, I don't need tabs in Notepad. I'm not a complicated man. I just want one file at a time. Basically, I want Windows XP Notepad. So, here I am. Powerful computer, but no good Notepad. What to do? Well, if it's AI that's making the problems, it better be AI that's solving those problems. So, let's give it a shot. We're going to take the very latest GPT code X51 Max from OpenAI and we're going to pair it against a simple problem. Build me without me doing anything else, a complete Windows XP Notepad. Let's see if it can. All right, I've got me a basically blank folder. And when I'm looking down here, it's cuz I'm looking at the code. I'm not ignoring you, but I can't look at you and code at the same time. So, happy Easter to that today. And if I look like I'm half asleep, it's because I'm looking down here and that's just the way I look. So deal with that. Anyway, what do we got? We've got room here. And we'll bring up codeex. I'll move myself so I'm not in the way. And here's what we're going to ask it. We're going to say let's create let's create a notepad in the style of a C++ application. I am mostly plain C. The menu verb should all work as should the loading and saving and all the other essential functionality of Notepad. The main window should have the same elements, the same menu, be similarly resizable, and operate in every way as the original does. You can emit printing functionality. Split your source files into logical or functional units to keep the individual file size under 1,000 lines where practical. Use C++ commenting and include useful info for other programmers. Create the make file necessary to compile, link, and produce RetroPad as a standalone Win332 application, just like the original Notepad.exe. Name your application Retropad. Make the main source file retropad C or C++ and the binary retropad.exe. Create a nice icon for the application and make sure it's linked in as the main icon resource. All right, that should be the instructions we need to give it. Now, I'm going to go through and I'm going to double check what I've got. I've got codeex max and we're going to set it to extra high because we're not in a rush. I'm going to speed this up so that you don't have to sit here and watch it for 20 minutes or whatever it takes to cogitate. In any event, actually, I got a stopwatch. Let's set a stopwatch. Are you ready? It's going. Go. Codeex go. Planning multi-step file creation with escalation. Escalation probably means asking me each time it wants to create a file. We'll see. Make sure that it's an empty repository and it's updating its plan. Time for some tunes, I think. [music] >> [music] >> All right. Now, we have to allow this session. I wish there was allow multiple times or allow anything like this, but there doesn't seem to be that option. So, it looks like every time it wants to create a file, I'm going to have to participate and say that it's okay. Let's see what files it's created. So far, it's created a resource file. That looks like pretty standard stuff. Well, it's defining file encodings because I guess I didn't even think of that, but Notepad has to be able to handle loading and saving different file encodings. It seems to be a lot of the work here that it's already done. Let's go back to it and see how it's doing. Make sure it's not waiting on me. It's thinking hard. It's all I know for sure. It's thinking. [music] So in the process of creating a Windows application, what it's going to do is it's going to do three main tasks. First, it's going to define what the feature or the actual window should look like. Should it have menu items? Should it have close items? Should it have minimize, maximize? All those window class attributes. And it's going to find a window class. It's going to create a window of that class. And then it's going to define a message loop for that window. And the bulk of the code will be in the creation of the window initially and then in the processing of window messages that come in. What kind of window messages? Well, when the user clicks file save, that comes through as a WM command with IDM file save as the attribute or as the probably the W pram or the L pram to that message. And so it's going to be a whole bunch of handling of messages that come in. It won't be tracking mouse position, stuff like that. So there'll be tons of messages that it just ignores that fall through the bottom and go to deaf window proc. And that's basically how a Windows application works. Allow this session. RetroPadc. That sounds like our main file. And it is nice solid pled style 1995 code. That's what I like to see. You don't even need to comment it. I did tell it to comment it too, didn't I? Didn't I say? Yeah. Create use C++ commenting or something like that. Maybe I skipped that part. Now we can have it go and add comments later, but most of it doesn't seem to really need it. I mean, do file new, prompt, save changes, set window text to the current file name, which is now empty. Interesting. So, it keeps track of a global modified flag, which is now false. So, if you type some stuff into a file and then hit file new, presumably, let's see. Well, I'm not going to rat hole on that, but it shouldn't be treating your data as disposable just because you did new file. But that does erase the old file, so maybe. Oh, allow this session. Here I was ignoring it. Allow this session. And allow this session. What's it doing? Why is it ask why is it asking me each time it edits the file? That's weird. I wonder if it's compiling the code and running into errors. Making fixes junk. Allow. And of course, allow. Oh, yeah. Word rap has to manage word rap. Status bar. The find dialogue. I forgot about find. I guess there's more to notepad than I thought there was. because I've always been saying ah it's just an edit control with a menu which it mostly is but it does have other functionality like find and save and print although we told it it doesn't need to do printing because it's just shell dialogues you wind up calling and you got to deal with high metrics and stuff that I don't want to care about today about dialogue main oh got another allow this session here we go main window proc so this is where every message for the main window comes in whether the app cares about it or not. And then you'll see there's a big case statement here and it's going to say, well, this is a message I care about. So when I get wmre, I'm going to initialize the common controls, create the edit control, turn on the status bar, set the title, and accept file drops. And it's going to do that every time a create comes through, which is once per window. But some messages like set focus can come through very often. And so it's going to call its own internal set focus code. When it gets a WM size, that means that it's been told that the window has been sized and it needs to update its layout and update the status bar. Drop files is when you drop a file into Notepad by using drag and drop. And it's actually pretty simple. You just call drag query file and you get the actual path from it and then you load the path. It's that simple. Well, we are prompting to save changes to be nice in case you already had a file edited in Notepad and then you dropped the file and you want to confirm that hey, you really want to replace those changes in progress. Command is for things like menus and other clicks and things you click on within the app, which there's not a lot of allow this session. Pop-up menu. What pop-up menu? Where is a pop-up menu? Can you right click on notepad? I never tried that. We'll find out. Oh, yeah. I probably edit, copy, paste, all the basics, but I thought that would be under the control of the edit menu itself. Well, maybe it is. So, here's when main. This is where your code actually comes in. This is like main and C, but it does some processing, figures out the previous instance, the current instance, what the command line is, just process passes basically what you get in main.c C in every app that you've ever written, but it does it in its own Windows way. So module entry calls this. So your main would call this if you were actually looking at it at the compiler level. So it registers a window message to be used for finding. And then here's where it registers its window class. Then it creates the window, shows the window, updates the window and before it goes into the message loop, it loads an accelerator table which is shortcut keys. Then it goes and says give me a message. Now translate any shortcut keys. Now translate the message and dispatch the message and it will be processed through its own message loop if it is a message it cares about. Approve directory. Oh, for the icon. It's going to create a resources folder, I'm guessing. Or a folder to hold all the images and icons. All one of them. But it's a nice way to do it. It's working on the make file, so it must be getting close. It's thinking again. Thinking hard. Allow. Hello allow. H. It needs comment controls ex in it. Interesting. So, it's actually working a bit iteratively unless it's compiling, hitting compiler errors, and then fixing them. But I don't see it launching a compiler. So it seems to be going back and editing and improving its initial code because it started with just the net common controls and then it must have realized at some point that it needed the EX version of that and so it added the functionality to call the EX version as well but did that later for some reason allow. And this time I shall allow. Why is Dave saying allowed allowed each time? Because it allows me to uh put an audio marker every time I need to fast forward. Allow implemented a pet old style notepad clone with full menu verbs word ramp verb status bar toggling find replace goto font picker time date insertion and bombaware file load add a win32 resources for menu accelerator dialog version issue and link the custom app icon it made an app icon can we see it no veter let's go see the actual source files oh it's a little it's a little rainbow all right file io this This is all of I'm going to guess our reading and writing of files and all the handling of encoding. File IIO is the headers for that. We got a resource definition. We got retroped.c which is the bulk of it. And how big is it? It's under a thousand lines. It's kind of all I asked for. And here's our menu structure. Now, do we have a binary? I'm going to have to run my VSARS command, aren't I? Fatal error. Too many names left of equals. Well, let's ask it. How do I build your nonsense? Or build it for me. Better yet, build it for me. Compile the binary for me. All these years, I've been building my code on my own like a sucker when I could have been just telling the computer to compile it itself. You don't even have to show up. It's struggling to find the compiler. Looks like it's found VS Studio. So, aha. Now, I was changing the source code. So, it's found issues during compile that it needs to actually resolve. But I'll let it do it all on its own. I'll just be the dummy that says approve, approve, approve. We'll see how far it gets. All right. What do we got in the folder now? We got a retropad.exe. That's 160K. That's not bad. Assuming it's got symbols. Retropadun. Holy cow. Hello. This is my old retro pad. It works just like the old XP notepad used to. Now, can we change the font? Do I have any cool fonts? We'll go to Melan Gothic. It works. Not that I ever change fonts in Notepad. Didn't even really knew that know that it did, but uh I guess it does. Let's try find. How do you do find? Whoops. I just did control F. Retro. Find next. Retro. Retro. It works. Printing is not implemented in retropad because I told it not to. No help. And an about box. A pencil style Notepad clone. Win32C implementation. And a weird symbol. Copyright 2025. Do I want to save changes? Sure. Let's try that. We'll save it as test. We'll replace that and then we'll run it again. Whoop. And we'll say file, open test. There's my file. No font information because Notepad doesn't do that unless you set the font again. All right. So, in summary, we've got a resource file. We got the C file. We've got our binary and our object file and our resource file. Wonder if we can debug this thing. Could it be that simple? Run and debug. Windows CL. Eh, let's try it. Apply developer environment. It's doing some stuff. Install Python. Sure. No. Too many dialogues. I'm not doing this. I'm sure if you went through all of this, you could in fact debug, but we'll try debug anyway. Well, ly freaking duh. Should have set a breakpoint. Let's try it again. Put a break point right there. We'll say run in debug debug anyway. Retropad does not exist. What happened to it? Where did it go? Where did the binary go? That's weird as heck. Build it again, please. I could just set up my VS various variables. Why did I do that? So, we want VC var. All right. Looks like everything's set. Let's go back to user source retro pad and make R. Make make R. All right. Computer make does not work for me. Well, what did you do before? Okay. Dell splat.exe and make. Yay, it works. Not retropad.c retropad.exe. There it is. So, check this in and I will put it on GitHub and you'll be able to enlist in it and probably just grab the binary if you're allowed to check binaries in and you trust the fact that I haven't put a Trojan in it. But of course, the better option is to compile it yourself from the sources that I will also check in. So, all you should have to do is to go into that folder after setting your VS.bat file or running that batch file. It sets your environment. And once your environment is set, just go into the retropad folder, type nmake and it should cough out your retropad.exe binary. Thanks for joining me out here in the shop today. In the meantime, in between time, hope to see you next time right here in Dave's garage. And by the way, if you found this kind of take on things interesting, let me know. Leave a comment, leave a like, uh, subscribe to the channel. Whatever response I see will tell me that, hey, you guys can actually tolerate me in this format. So, I'd appreciate that. Thanks.

Original Description

Dave uses GPT Codex Max 5.1 in Extra High mode to generate a perfect clone of Notepad that brings back everything you missed about it. Free Sample of my Book on the Spectrum: https://amzn.to/3zBinWM Code: https://github.com/PlummersSoftwareLLC/retropad Black Friday Affiliate Links!! Save on the Slate 7: https://amzn.to/4pJfZ4Q For the Slate AX 1800: https://amzn.to/49hKPt2 Check out ShopTalk, our weekly podcast, every Friday! https://www.youtube.com/@davepl
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

The video teaches how to use GPT Codex Max 5.1 to generate a perfect clone of Notepad, and how to build, debug, and deploy the Retropad application using various tools such as VS Studio, make file, and C++.

Key Takeaways
  1. Build a C++ application with menu items, loading and saving functionality, and resizable main window
  2. Split source files into logical units to keep individual file size under 1,000 lines
  3. Create a make file to compile and link the application as a standalone Win32 executable
  4. Name the application Retropad and create a nice icon for it
  5. Define the window's appearance
  6. Find a window class
  7. Create a message loop
  8. Handle window messages
  9. Use common controls
  10. Call drag query file to get the actual path from a dropped file
💡 The video demonstrates the potential of using AI-powered coding tools such as GPT Codex Max 5.1 to generate high-quality code for complex applications, and highlights the importance of collaboration between humans and AI in software development.

Related Reads

📰
AI Coding Tools Can Write SQL, But You Still Need to Understand Your Database
Learn how AI coding tools can assist with SQL writing, but understand the importance of database knowledge to use them effectively
Dev.to · shoutaro
📰
How to Build an AI‑Powered Daily News Digest on Telegram Using RSS
Learn to build an AI-powered daily news digest on Telegram using RSS in 5 steps
Dev.to · Mohammad Sorouri
📰
LongCat-2.0: How Meituan Trained a 1.6T-Parameter Coding Model Without a Single Nvidia GPU
Learn how Meituan trained a massive 1.6T-parameter coding model without relying on Nvidia GPUs, and why this approach matters for AI development
Dev.to · Prabhakar Chaudhary
📰
From Prompting to Production: A Practical Framework for AI-Assisted Software Development
Learn a practical framework for AI-assisted software development using structured workflows, context engineering, and human oversight
Dev.to · Aswani Nayak
Up next
How to Create WordPress Maintenance Mode Plugin Using Claude AI (No Coding Skills Needed)
Quick Tips - Web Desiign & Ai Tools
Watch →