简体   繁体   中英

Handcoding Windows GUI in C++ without IDE

Hey, I've seen some questions on this topic but most of them only try to point out if its better to or not to use an IDE for creating a GUI, well thats not my question.

I want to use some IDE like Qt for writing bigger programs in the future, but at the moment i am new to c++ and especially GUIs, and want to learn how to handcode simple applications (eg "Hello World"-app with a button, maybe a textbox and a function to spit out a result). Maybe to prevent discussion about why i want to do this: its because i like to torture myself, and especially because i hate if something (in this case the IDE) creates something i don't understand but nevertheless i have to work with it.

So, are there any tutorials on that topic that gives a short introduction in handcoding small c++ apps with an editor like notepad++?

If you want to learn Win32 I (like many others) recommend Charles Peztold's book:

http://www.charlespetzold.com/pw5/index.html

Unless it has changed since the edition I have, it does not assume any kind of IDE or framework beyond Win32 itself and a C compiler. It will give you a great foundation in how the OS/API works and make it easy to understand the tools and frameworks built on top of it (should you decide to use them).

Here's a tutorial for creating a GUI that doesn't require any library, as it targets the native Windows API:

Creating Win32-Based Applications (C++) :
http://msdn.microsoft.com/en-us/library/bb384843.aspx

(As user Nubok wrote in a comment above, programming against the Win32 API is quite strenuous. But you will learn a lot about how Windows works internally.)

This tutorial assumes that you're working with Visual Studio; just ignore the bits where it talks about creating new solutions based on templates etc. That important bits in that article are the code examples.

When it comes to compiling and linking your code, you will need to check with your compiler's manual how exactly to reference external libraries etc. Just make sure that you include the Win32 API's import library in the linking process. (Look out for something called win32.lib , win32api.lib or similar.)

There is a great but dated tutorial covering the plain Windows GUI APIs at winprog.org . It uses plain C though, not C++.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM