Hello, Windows! RetroCoding 'Hello World' for Windows with Dave

preview_player
Показать описание
See the Art of Code as Dave crafts a new Windows Hello program from scratch in the editor with no assists. Dave writes clean code in pure C for your enjoyment. A great source of coding style as a tutorial for Windows Programming. What Dave develops here is effectively a hybrid of the MSDN sample for "Hello, World" and Charles Petzold's version of rendering the client area.

Coming Soon: Hello, Assembly! where Dave codes Hello World in pure ASM for Windows.

Errata:

At about 9:10 I make reference to the WndProc, when I really mean WinMain.

- You may have noticed I typo’d the WinMain signature as HRESULT, rather than LRESULT. Good eye, and of course I fixed this before running it!
- TranslateMessage(%msg) was clearly supposed to be TranslateMessage(&msg), sorry!
- As trivia, under Win16, WPARAMs were WORDs and LPARAMs were LONGs. Today, they’re both 32 bits.

Here's the code that compiles in the episode without any warnings. Remember this is just the C, you'd still need resources, icons, etc. Best bet honestly is to generate an empty Win32 project with VC, which provides you with sample code quite close to this (but it doesn't paint).

Рекомендации по теме
Комментарии
Автор

One can tell a true programmer by his ability to stroke his chin without interrupting touch-typing with both his hands at a machine gun rate.

KernArc
Автор

I understood about 10% of this but couldn’t stop watching & found it really interesting

Gizmo
Автор

more tutorials along the lines of the old charles pezold books would be nice

matthiaswandel
Автор

Getting big Bob Ross vibes from this, and I am here for it.

scd
Автор

Recently I went retro and installed Visual Studio 5.0 (Visual Studio 97) into Windows NT 4.0. My hello world app is only 4kB in size when linking with dynamic CRT (basically libC in DLL instead of inlined inside the EXE). Then I went full masochist and switched to Visual C++ 1.10 and C (not C++ because the compiler's ability to handle templates drove me crazy). Now my app can run on both Windows 95, Windows NT 3.1 and newer, can detect missing unicode (wide) functionality and switch to current ANSI code page at run-time (no need to have separate ANSI and unicode builds). Currently I don't care about 16bit Windows and Win32s. I also customized the program's entry point in order to replace the CRT. Don't confuse real program's entry point, that the OS calls, (usually wWinMainCRTStartup inside CRT you link against) and the wWinMain entry point, that the CRT calls, you as app developer writes. I want to say how much I LOVE the offline MSDN documentation in HLP/CHM format.

MarekKnapek
Автор

This takes me back years and years. My first university C-programming class gave us a project to build a Yatzi (Nordic version of Yatzhee) in pure C. I was a bit ahead of the class and chose to do mine in Win16 which was still cool and new - I remember a lot of the basics from here still vividly. And the best part is the teaching assistant who looked at my code (a basic HP-UX nerd) could not figure any of it out - he actually claimed this code will neither compile nor run. He had an interesting expression after the compiler went through some 100, 000 lines of .h, maybe 1000 lines of my code and all of the sudden you had a Win 16 app that actually worked and had a bunch of nice Windows behavior like mouse roll-over gray scoring. Today everyone would consider that normal, but back then it was a "WOW!" moment. Love your content, takes me back as a former blue badge, too.

jukpaa
Автор

I love how it rendered the text in the old System font. I honestly didn't even realise it was still available in Win10.

davidgreen
Автор

The speed of coding is insane. Also, the flow of thought and organization of his initial code is insane.

brianlhangford
Автор

I think this guy is one of the legends of our times

kenkelvin
Автор

I haven't written windows code like this in 15 years. I was a kid learning to code with Borland C++ because VC++ used to not have a free version and Borland came with a C book my parents got me :-)

I kinda miss doing it this way...

blaudrachen
Автор

This sure brings me back. I was always frustrated with how MFC hid the foundational stuff, so I bought books on win32 and did a deep dive into win32. I still have those books, more than 20 years later :-)

oddbec
Автор

"I'll leave the typos, so as not to distract anyone"

And everyone with an OCD for typos is now totally distracted, staring at the broken lines. Wanting to reach into the screen and fix it themselves. "FIX IT! FIX IT!! FIX IT NOW!!!".

You and I, Dave, have a different definition of what's distracting.

klaxoncow
Автор

Didn't understood a thing. Loved every bit of it. Awesome videos Dave.

jason_liam
Автор

Dave: We won't use any fancy Visual Studio, frameworks, etc. to write this.
Also Dave: * literally runs whole another OS in the VM just to run the text editor *

BartoszZasieczny
Автор

C64 / 6502 Assembly course would be amazing. Thank you for your videos ! Learned a lot.

MonteMusicChannel
Автор

I recently had to create a DLL plugin for a popular app. I built it using VC++ 2019 and ensured I didn't use any APIs introduced after Windows XP, or the DLL version of the VC++ runtime. As a result the DLL can be copy deployed and will work on just about any configuration likely to be in production today.

This type of programming is one of the few ways you can write dependency-free code that just runs "out of the box"

richardclarke
Автор

I'd be particularly interested in the same thing, but opening the same sort of Window on an Amiga, so yes, more of this please!

heidirichter
Автор

Dave, .. I personally started programming when I was around 10 or so with QBasic.. Finding QBasic and opening nibbles was great.. changing the game and modifying the code and seeing what I did and it come to reality on the screen started it all! You coded what I was learning on.. lol

christrahan
Автор

In a world where people are only using java and using "else if" instead of a bloody switch statement!
One man, rises from the ashes to show us all how it's done.
*Phat synth bass track plays.*
DAVE PLUMMER!!!

LaskyLabs
Автор

As a fellow nerd who learned to code way back in the 80s and 90s, I cut my teeth on 6502 assembly, learned C, and progressed to x86 ASM, C, CPP, Pascal once my mom got me a PC and I have since that period on my 10th birthday built a life on knowing how machines work and how to solve problems and provide tools and experiences to others, I salute you! I really love your channel, and I love all the insider things from Microsoft and I especially love this video and your x86 ASM video that shows the Millenials how it's done...

espensl