Now THIS is great. When you strip away all the frameworks and abstractions, great though they are, you get to the raw native C API that Windows has been using since the 80's. Underneath all the "modern" layers, this is what's still going on. Really interesting.
I'm 100% self taught with 0 formal education in C/C++ with 3D Graphics going as far back as DirectX9.0c and Legacy OpenGL 1.0 and throughout the years, I've probably written that windows setup code 100 times... The first few times of writing it, it seem to be a bit esoteric but the more you use it, the easier it becomes to understand what is going on behind the scenes. These days you can include libraries and frameworks that handles all of that for you. My early projects would probably contain about 100 - 300 lines of just pure windows api code just to get either DirectX or OpenGL setup before you even begin to draw your first triangle to the screen. Today with modern frameworks you can do this in about 3-5 lines of code. When you finally get into the actual Graphics Pipelines and how images and objects are drawn to the screen, I had to learn how to write functions on loading and parsing image or texture files manually. Again, the same amount of abstraction can be applied. What use to take about 500 lines of code now only takes about a dozen! When I first started to learn, most of the responses I was getting was "why reinvent the wheel"? I fully understood what they were saying, however, that wasn't my intent or purpose. I wasn't trying to reinvent. I wanted to know exactly what was going on under the hood. I wanted to know how the hardware was able to do this and that. I wasn't concerned about abstracting away common tasks with simplified versions. I didn't go as far down as writing actual assembly to draw 3D Graphics even though I kind of wanted to, but at least at the C/C++ level I had gained a better understanding of how the graphics pipeline works and how the hardware operates to achieve such desired results. I gained this set of knowledge before I even moved from CPU calls to GPU calls using shaders. I'm now currently trying to learn and better understand the Vulkan API which is even more verbose towards the programmer / developer. There is less hand holding compared to previous APIs and I guess the same can be said about DirectX 12 versus older versions such as 10 and 11... There is definitely a trade off as you have a higher responsibility in knowing exactly what it is you are doing yet gaining more control and power over the hardware to fine tune it to your particular needs. Older versions of the APIs along with the cards drivers made a lot of assumptions about the code you were writing. The modern APIs make no assumptions as you have to be completely explicit with everything you are doing. For example, in Modern OpenGL and DirectX 10 & 11, you just had to set up your vertices, index buffers, etc. and pass that information to your shaders and then the shaders would do the work for you through the provided API calls. The same can be said about Vulkan, however within Vulkan you have to literally setup the entire graphics pipeline, the swap chain, the view port, etc. There is no one right way to do something as there is always a tradeoff! It basically comes down to your specific needs and what it is that you're trying to accomplish and or achieve! I guess the main reason I made this comment is that I took it upon myself to learn the inner workings and I fully appreciate seeing tutorials such as this that explains the underlying mechanics that most people today take for granted by assuming that they'll always work. Personally, I think it is worth knowing this so that this kind of knowledge and understanding doesn't become lost throughout time. More and more people are being taught: oh it just works so don't worry or concern yourself with the implementation details, just know that it works... And I think that this is a bad model for teaching. I'm not trying to argue against the fact that abstraction is good or bad. Yes, having layers of abstractions is very useful and helps to simplify things in the long run, however when we lose sight of what those abstractions are replacing then it can become harder in the long run to maintain such code bases. In other words, how much more could I have learned if this kind of information was available 20 years ago... If you want to be a better programmer, developer, engineer, then I believe it is a good thing to know what is happening at each level or layer of abstraction and how they communicate from one level to the next, from Assembly to C to Python not counting all of the OS calls in between! Yeah, anyone today can write a simple Python Script to get it to yield results, however, if they know nothing about system calls, and how the kernel speaks to the hardware... they will end up missing out on vital information that can make their program or application more efficient. If they don't understand how cache lines work, how branch prediction works, how the operating system manages processes and threads, etc... yeah. I guess I'm the kind of person that likes to or wants to know all that there is when it comes to computer architect and design and their operations. I'm not just limited to the software side of things, I've even began to learn about the hardware side of things including how a CPU is designed from Logic Gates, and how Logic Gates are made from basic circuits all the way down to basic Chemistry and Physics including all of the Mathematics that are involved. I think it is great to see that some people are still covering and explaining such basic concepts and principles so that future generations have the information available to them. This was a very good and clear presentation of getting a basic window up and running on the Windows Platform by providing the basic knowledge and information of what is important by not diving too deep into the actual Windows API and covering just enough for a simple window! Keep up the great work!
Thank you for your comment! I completely agree with your points. If I was only interested in making a simple game or something, then no, starting with Win32 would not be very efficient. I would have a finished game in no time if I just used unity. But that's not why I'm learning things like this. I'm currently learning DirectX 12 and as you explain about Vulcan, they aren't always simple to use, but if you want to make really good graphical applications at some point then all of that control over the hardware can be very useful. And most importantly, you know exactly what the computer is doing, which is really cool. I especially liked you points on "reinventing the wheel" because no, I don't really think we are. As you say, we are just trying to understand how the wheel works and we can use that to build better things. Thank you again for the support, means a lot! :)
@@aerideus For me, I'm highly intelligent, I understand numbers, math, physics, chemistry, electricity, circuits, computers, software to some degree. I don't know everything there is, however, I never stop learning and will learn all that I can when it comes to the functionality of modern computers and hardware. I am familiar with every topic there is. I'm not the best at computers as there are many others that design their internals for a living where I've only learned about the process of it. However throughout all of my own research and understanding there is one thing that I have at my core that allows me to be where I need to be and that is something that over 1/2 of your scientific community is missing or lacking and that is my understanding of who wrote, created, designed the numbers in the first place and I will tell you that it is not man! My being, my existence is due to the Breath of God and I try to do all that I can to keep the Holy Spirit as close to me so that I may not falter, yet I'm far from perfect as I have my own sins. I am baptised and I believe in Yeshua and there is nothing anyone can do to ever change that. As for me, I completely believe in Free Will. So I say each to their own, make up your own mind, just know that at the end of the day you and you alone are responsible for all of your choices, actions, including your own thoughts. You will have to live with the consequences of them. The best that I can do for another is to kindly say to them May You Walk With God! And leave it at that! Now due to my Spirit, I'll even challenge the status quo! I wager the Holy Spirit!
@@skilz8098 Agreeing until the end. I don't think we have nearly much free will at all. You were born in a society where your family and economic state were predetermined. Everything that you could do, your potential, what you could have learned, etc, were all possibilities that never could have existed without your interaction with other people and society. As you live your life, you are shaped uncontrollably by the events you experience in your life, and that changes you and forms you into who you are - whether you like it or not. You are a sum of all your parts, and your parts were not made by you. The degree of control you have over it is determined by your thoughts and mind - which themselves are yet again uncontrollably influenced and determined by your environment since childhood. People might have some tiny amount of free will, but most everything in your life is predictable, and everything could be reasonably concluded from your birth by someone with all knowledge. If you believe in god, what you believe in must be some sort of twisted entity that loves the suffering of man, because there's a lot of it and you couldn't possibly blame humans with their limited life experiences for it. A child does what he is shown. Ultimately the one in control, and the one responsible for "sin" in the first place, would be god.
Great tutorial man, had 3 problems out of my own fault but managed to find and fix them. You make for a good teacher, i suggest you continue building on this window, make some buttons and make it pick a random number between 1 and 100.
That really means a lot! Unfortunately I have extremely little time right now and I don't know when I'll get back into making videos. But I'll try to get something out during this fall at least. Comments like yours is what really motivates me!
@@aerideus One video a month is more than enough until you build an audience This retard youtube will not feature anybody unless you have like 50 videos or something
I found your channel through the bitmap videos, thank you for your effort. I use linux so this video wasn't for me but not the less i enjoy watching you. Have a nice day!
I'm sorry that this wasn't a useful video for you but there will be more videos in the future that you will be able to follow. Thank you for your encouragement!
If you are on linux, you can replace all of the Windows API calls with the equivalent "Linux" calls. At this point of the video, there is no current Graphics API being used. If he's using DirectX, you can follow along but replace everything with either OpenGL or Vulkan. There are subtle differences, but yet the overall concept of the application design is basically the same.
Very nice tutorial and voice. I found the official docs a bit confusing tbh... I'll make sure to point people to your channel if I ever get the chance :)
Thank you! I would truly appreciate that! And yes, the documentation can be a bit confusing. There is a lot of good information but it's often hard to know what you actually need to understand and use
you really helped me so thank you. i am here to ask for more tutorials like "how to add text" or "how to make buttons" because every other video is not as clear as you
Great to hear that! I honestly haven't worked much with that kind of stuff so I don't have anything planned at the moment. However, that might change because I have thought about reading more about it. My best advice if you want to add text and such is to read about GDI+. I don't have much experience with it myself but I have heard that it is good.
@@aerideus this video is totally awesome and even more awesome is your honesty level!! Everybody is learning something.... Would love to see more videos like this
@@vivekkoul4428 Really means a lot! I've been very busy the last couple of weeks but I'm planning to start releasing a lot more videos in about a month!
In my system, it creates a window with no background (as of 22:46). To fix, I added "wndClass.hbrBackground = GetSysColorBrush(COLOR_WINDOW);" between wndClass.hIcon and wndClass.hCursor lines. This used a system defined color to paint the background of the window white.
This is what i learn from mathematics; we don’t need to know what these structures mean; we need how to work; and when we see the results we understand what it mean. Like differential manifold.
wow this tutorial was absolutely amazing! I've been learning about programming, computer science and C++ for about a year now as a hobby, although it's turned into a sort of obsession lately ;) this is the best tutorial I've found in terms of explaining whats actually going on under the hood in windows when you do something as simple as create a window... I'm really astounded by how much us going on in the background! I would love to learn more about how this works, do you have a recommended resource for learning the winapi as you did? I would just like to learn it well enough to really understand all the details of the code you wrote here but I looked at the microsoft website and the documentation for win32 appears almost impenetrable to me so just curious if you know a good resource that explains the details and concepts of what you did here in a more relatively beginner friendly way ? thanks again for the video its really opened my eyes :)
I'm really glad to hear that! The API is really old unfortunately so I don't really know any good resources to learn it. The documentation is my "go to" but I totally agree with you on that it's a bit complicated and hard to read. My recommendation would probably be to look in resources for DirectX because it's still really common to use Win32 in that context. Most resources probably skip that part because it's not a part of DirectX but I've learned a lot from various tutorials even though the focus was DirectX. DirectX is also the most common and best way to draw to a Win32 window so it might be interesting anyway
gj .. more in-depth videos about win API would be highly appreciated. If you can go deeper into the event system on win API it would be great. How those messages working under the hood in which order. Explaining SetSublcassWndProc function and so on. Win API so old and so badly documented so if you have knowledge please share it with us.
I'm unfortunately not an expert on win32 so I don't think I'll be making more in depth videos. I know the API well enough to create a video like this one but I wouldn't be comfortable in teaching more complex topics. This was more meant to be a video that I can refer to when a I need to use a window in future tutorials. Sorry to disappoint you :/
Very simple and efficient explanation. I wonder what would the code be if we have a main window and we want to add another child window which is running on another thread?
Great tutorial! it was informative and very interesting. Thank you! :) Can you make a video, where you add a button and maybe an action to it. For example, when you press the button, you change some text or something.
A little late, but I found the issue was my compiler was not using unicode. In g++ I added the -DUNICODE flag, and it stopped screaming. I.e. g++ -DUNICODE .\window.cpp .\Program.cpp
getting a problem where it opens then immediately closes the window, probably an syntax error with my switch statement or while loop, ill look into it tomorrow, been messing around with code(not just this) for 2 and half hours today ready to relax for a bit
Hey, man I followed through the tutorial and I dont have an window only the print of "Opening Window" could you help me? (I can send you the code on disc if you have it)
"It has worked perfectly." That doesn't look remotely close to 640x480 window size to me. That, and I'm getting the same issue trying to successfully size a window with or without AdjustWindowRect. Windows doesn't seem to care what I specify and makes some scaled version of it instead by close to 60%.
I want to ask, why do you write your variables as "m_VARIABLENAME", I've seen others use this m_ initialization thing but I've never understood why they do it. Could you please explain? Thank you in advance!
Really epic work. Your explanation is very clear. But you didn't talk about things after the creating the window. I succesfully create it now, but how can I register sprites on it and control them? I searched on youtube but other youtubers' tutorials are different with yours, and the window creation part is not as clear as yours. Can you help me find another video talking about how to create the game itself, and its window creation part is similar to yours? Or can you make one yourself XD. Lots of thanks. You help me a lot.
@@selcukermaya I'm actually not really sure how to do that or if it is even possible so I'm unfortunately not going to make a video on that. My best guess though would be to remove the border and try to get transparency working. That could be an idea.
I keep getting an error that says "Undefined reference to Window::Window() " and the same thing for Window::~Window() Anyone know what might be happening?
How many total lines of code did you have to write just to get a blank window to show up on the screen? Why did MS get rid of their visual programming languages where you just drop stuff on a form, press run and boom you have a window pop up on the screen with 10 seconds worth of work and no programming needed to do it. I just don't get it. I understand you can use C++ for other platforms but why would MS get rid of something - Like popping up a window with 10 seconds worth of work - in favor of having to write (and learn) multiple lines of code and 23 minutes of work time to do the exact same thing.
If you just want a simple window with a few buttons and some text then I think C++ is the wrong language. C# forms or C# with WPF is fantastic for this kind of task. However, you don't have the same control over the underlying architecture that is needed when creating something like a game or a game engine. If you're using something like DirectX to do graphics then Win32 is the best way to handle the window in my opinion. You need the HWND when setting up the DirectX Swap Chain for example and the APIs were designed to work well together. But as I said, if you just want a quick and nice looking window then read up on C# and WPF because that's the best in my opinion (for windows).
Getting "Exception thrown at 0x00000000 in WindowTutorial.exe: 0xC0000005: Access violation executing location 0x00000000." Whenever I try to run the debugger whenever everything compiles
Seems like you are trying to read or write to memory outside of an array or maybe you are using a pointer to a deleted object. I'd start by checking that all code involving pointers is correct.
Hello! I am trying to code this up in my netbeans however I keep recieving an error when building, " Window.cpp:34:13: error: cannot convert 'const wchar_t*' to 'LPCSTR' {aka 'const char*'} " there seems to be an issue with the CLASS_NAME declaration, any ideas how to fix this? :)
Found the solution: Not specifically for netbeans since I use VS19. go to Project -> 'project name' properties at the bottom -> Advanced -> Charset changed to unicode. You may have to change it for your release, debug, and the active debug. I have not used netbeans, but It should be very similar.
I think the problem is that you are not using the newer wide character functions. I'm not 100% sure how this works in other editors but try either adding a W to RegisterClass (so use RegisterClassW) or change the wchar_t* to a normal char*. Hope that helps!
The best way is probably to use DirectX. The Win32 API can of course be used with OpenGL and other cross platform options but DirectX is made to work well with Win32 as it is Microsoft's own API. The HWND is for example used when creating the DirectX resources and it will be harder to connect the window to a different API, but not impossible
@@aerideus As Hugo said, you can use the DirectX API, the OpenGL API and or the Vulkan API, or you can design your application to use all 3 renderers and allow your user to decide which renderer they want to use! Typically the drawing calls will be setup and done by the APIs and the information will be sent to the Pipeline and typically you'll use shaders to do the processing of the vertices and pixels or fragments...
Yes, absolutely. The code is exactly the same, but with only functions instead of classes. I would create a struct containing the member variables and just move the methods out of the class. Hope that helps!
I'm not sure. There is a lot going on behind the scenes so I think it is hard measure that. The good thing is that it isn't enough to ever be something we have to think about.
@@ГеоргиЧавдаров-в7з Electron is not good for business, I work as IT and web developer, In business environment even small mistakes could cost a lot of money, or even bankrupt the entire company, C++ applications still the most stable and reliable executable format, others just trying to come close to it and fail.
@@مقاطعمترجمة-ش8ث Can you explain what kind of mistakes? And how much of them could be produces really by Electron-like library? And not last - if electron is based on V8, which is written in C, why we shouldn’t use it, in fact it is just expecting a JS code (which is more beautiful than C) and run it?
You fonts are too small to see. I can't work with such small fonts . Even after full screen mode I had to use a on screen magnifier to watch your video.
I avise every to not use Win32 API but to use Qt or another wrapper instead. Api Win32 is very old and awful to use that making code hard to developp and to maintain
I understand what you mean but I don't think it is a waste of time to learn basic Win32. It is still the "proper" way to do things on Windows and it can still be good to know what's underneath if you decide to use a wrapper to simplify everything
@@aerideus it's not the proper way... the automatic UI test tools like squish are hard to use with Win32.. No knowledge is bad but i think there a lot of more useful things to know as a developper
After Compiling I get an Error : Error LNK2019 unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) Any assistance would be awesome, also great video love to see more.
Sorry to bug you but I think I figured out infinite compression using IMAGES. You might have the knowledge to put together the pieces that would make this work. I would be very interested to hear what you have to say given your knowledge about BMP IMAGES and C++ Programming. PART 1 If you Open PAINT.NET and make a 1920x1080 IMAGE. APPROX. 2 Million pixels. Then ZOOM in to the Pixel level and make either a white pixel or a black pixel. White = 0 Black = 1 Fill the entire screen with these random 1s and 0s (Black and White PIXELS). APPROX 2 Million BITS(theoretical) Then Save that IMAGE using .TIFF file format in PAINT.NET Now check this. The Final file size of the .TIFF file is WAY less than the 2 Million BITS(theoretical) Black and White Dots you originally put into it. PART 2 Why Can't you just take the .TIFF file (1s and 0s) go back into PAINT.NET and PAINT them in and do it again?????? PART 3 You need a HEX editor to Grab the 1s and 0s. A Means of moving that info into a BINARY PIXEL MAP IMAGE. (I'm thinking a BMP file) then converting the BMP using .TIFF compression. Then take the .TIFF Back into the HEX editor, extract the 1 and 0s, Build a new BMP Map. A SMALLER BMP THAN THE FIRST!!!!!!...... What?!!?!? Then convert it into a .TIFF Please please tell me why this isn't infinite compression. I can do it, but I'm not a programmer so It's really really slow because I have to Paint Each Pixel and Copy and Paste the HEX Binaries into the BMP files ETC.. Can you make a program that would do all this. It's probably worth a Trillion dollars. I Don't care about money, I just want the technology in the hands of the People. TIFF was made available for free thru PAINT.NET another Free program. I think this Idea belongs to the world.
Very interesting! I'm not actually that familiar with different formats and compression as this is a very complex topic. What I do know is that reducing the file size a lot usually means that some data is lost. This is the case if you convert a .bmp image to a .jpg for example, the file is way smaller but you can see a difference in quality. There is also lossless compression and that is used in .png files which means that the file is smaller than a .bmp without any impact on quality. I don't think there is such a thing as infinite compression without loosing the image as the data must be stored somewhere but it's interesting that you managed to make the file smaller. Keep in mind though that compression can be used in .bmp files, I just didn't implement it but paint.net might use it and that can also be a reason why your file got smaller.
@@aerideus Thank you so much for the reply. I generated a Large Number of Different Noise distortion Filters in PAINT.NET. I would Flood fill the Screen Black. Then Apply the Noise Distortion. This would generate A Gray scale Cloud gradient down to a pixel level. That is 2,000,000 Pixels with like 8 colors = 8 to the Power of 2,000,000 Combinations. If you look at it as a binary image. In other words a String of 2,000,000 Characters with 8 color possibilities for each position. THAT'S A BIG NUMBER!! This Gray Scale Cloud Saves in .TIFF for like 206k. Another Problem with GrayScale clouds is it causes the TIFF compressor to dither pixels. So Preservation is an issue. NOW... I'm Using white and Black Dots not a Grayscale. From What I can tell TIFF can Literally and Fantastically take a giant field of White and Black Dots and Compress them without image quality loss of any kind. If you add an empty line between each row of DOTS it will also add further separation to prevent image quality loss. This will cut your space in half. So it will be 1,000,000 DOTS or 125,000k..... So again the File Save Size is Well Below that around 50,000k Imagine TIFF is just Really Amazing at Organizing Two Things.. So Good that it can organize Black and White DOTS in a Pixel Field to less 1s and 0s in the file it Saves. It's as Simple as That. The problem is interpreting 2,000,000 DOT PIXEL field into a PROGRAM _____________________________________________________________________________________________________________________________________ How I the NONE programmer would tell a Programmer what I would Want to create: Compression: A HEX editor Accesses a File. The Hex Editor Creates a BINARY IMAGE MAP BMP FILE of 1(BLACK) and 0(WHITE) Pixel Dots. This BMP Image MAP is now a sequential set of Binary digits. The Pixels are arranged Exactly to the MEMORY LOCATIONs of the FILE. This way if you wanted to Translate the Pixel DOT BMP image MAP Back it would be EASY. The Order would be the Same as when the BMP image MAP was created. Now you Have a BMP Pixel MAP representing a File. Convert it using .TIFF Conversion. BMP to TIFF You have now essentially Compressed 2 Million Bits of DATA into a 1 Million Bits TIFF file. __________________________________________________________________________________________________________________________________ Decompression: All final compressed files would be in TIFF format. Open a TIFF using a TIFF to BMP Image conversion. Take the BMP Image and Translate it thru the HEX editor back into it's original form. DONE! _______________________________________________________________________________________________________________________________ Magic: Take the TIFF files of compressed Data and run Compression on them using the above method. Result Infinite Compression Down to the Smallest Size a TIFF file can be.
@@hueborn2592 Once again, very interesting! I haven't worked with TIFF files but it seems like something worth reading up on. And as I wrote earlier, image compression is a complex and very interesting topic.Thank you for the great ideas!
@@hueborn2592 "Infinite Compression" is not possible, there is a theoretical maximum (which you can calculate!) that tells you how much you can compress data before you start losing it. This depends on the entropy of the data you're compressing (which is a measure of how "unpredictable" it is). This is also why random noise compresses badly, as it has a lot of entropy which makes it hard to compress. Now if you start discarding data, then yes you could technically achieve infinite compression, but then you would have no data left, rendering it useless.
im getting an error where hWnd is 0, when I call register class i am getting error message 87, and when I call createwindow i am getting error message 1407. what could be causing this? weirdly, I had this code coppied and it worked fine now it is refusing to work and Im not sure why.
Now THIS is great. When you strip away all the frameworks and abstractions, great though they are, you get to the raw native C API that Windows has been using since the 80's. Underneath all the "modern" layers, this is what's still going on. Really interesting.
This could be useful in coding Sabrina OS.
I'm 100% self taught with 0 formal education in C/C++ with 3D Graphics going as far back as DirectX9.0c and Legacy OpenGL 1.0 and throughout the years, I've probably written that windows setup code 100 times... The first few times of writing it, it seem to be a bit esoteric but the more you use it, the easier it becomes to understand what is going on behind the scenes. These days you can include libraries and frameworks that handles all of that for you. My early projects would probably contain about 100 - 300 lines of just pure windows api code just to get either DirectX or OpenGL setup before you even begin to draw your first triangle to the screen. Today with modern frameworks you can do this in about 3-5 lines of code.
When you finally get into the actual Graphics Pipelines and how images and objects are drawn to the screen, I had to learn how to write functions on loading and parsing image or texture files manually. Again, the same amount of abstraction can be applied. What use to take about 500 lines of code now only takes about a dozen!
When I first started to learn, most of the responses I was getting was "why reinvent the wheel"? I fully understood what they were saying, however, that wasn't my intent or purpose. I wasn't trying to reinvent. I wanted to know exactly what was going on under the hood. I wanted to know how the hardware was able to do this and that. I wasn't concerned about abstracting away common tasks with simplified versions. I didn't go as far down as writing actual assembly to draw 3D Graphics even though I kind of wanted to, but at least at the C/C++ level I had gained a better understanding of how the graphics pipeline works and how the hardware operates to achieve such desired results. I gained this set of knowledge before I even moved from CPU calls to GPU calls using shaders.
I'm now currently trying to learn and better understand the Vulkan API which is even more verbose towards the programmer / developer. There is less hand holding compared to previous APIs and I guess the same can be said about DirectX 12 versus older versions such as 10 and 11... There is definitely a trade off as you have a higher responsibility in knowing exactly what it is you are doing yet gaining more control and power over the hardware to fine tune it to your particular needs. Older versions of the APIs along with the cards drivers made a lot of assumptions about the code you were writing. The modern APIs make no assumptions as you have to be completely explicit with everything you are doing. For example, in Modern OpenGL and DirectX 10 & 11, you just had to set up your vertices, index buffers, etc. and pass that information to your shaders and then the shaders would do the work for you through the provided API calls. The same can be said about Vulkan, however within Vulkan you have to literally setup the entire graphics pipeline, the swap chain, the view port, etc. There is no one right way to do something as there is always a tradeoff! It basically comes down to your specific needs and what it is that you're trying to accomplish and or achieve!
I guess the main reason I made this comment is that I took it upon myself to learn the inner workings and I fully appreciate seeing tutorials such as this that explains the underlying mechanics that most people today take for granted by assuming that they'll always work. Personally, I think it is worth knowing this so that this kind of knowledge and understanding doesn't become lost throughout time. More and more people are being taught: oh it just works so don't worry or concern yourself with the implementation details, just know that it works... And I think that this is a bad model for teaching. I'm not trying to argue against the fact that abstraction is good or bad. Yes, having layers of abstractions is very useful and helps to simplify things in the long run, however when we lose sight of what those abstractions are replacing then it can become harder in the long run to maintain such code bases. In other words, how much more could I have learned if this kind of information was available 20 years ago...
If you want to be a better programmer, developer, engineer, then I believe it is a good thing to know what is happening at each level or layer of abstraction and how they communicate from one level to the next, from Assembly to C to Python not counting all of the OS calls in between! Yeah, anyone today can write a simple Python Script to get it to yield results, however, if they know nothing about system calls, and how the kernel speaks to the hardware... they will end up missing out on vital information that can make their program or application more efficient. If they don't understand how cache lines work, how branch prediction works, how the operating system manages processes and threads, etc... yeah. I guess I'm the kind of person that likes to or wants to know all that there is when it comes to computer architect and design and their operations. I'm not just limited to the software side of things, I've even began to learn about the hardware side of things including how a CPU is designed from Logic Gates, and how Logic Gates are made from basic circuits all the way down to basic Chemistry and Physics including all of the Mathematics that are involved.
I think it is great to see that some people are still covering and explaining such basic concepts and principles so that future generations have the information available to them. This was a very good and clear presentation of getting a basic window up and running on the Windows Platform by providing the basic knowledge and information of what is important by not diving too deep into the actual Windows API and covering just enough for a simple window! Keep up the great work!
Thank you for your comment! I completely agree with your points. If I was only interested in making a simple game or something, then no, starting with Win32 would not be very efficient. I would have a finished game in no time if I just used unity. But that's not why I'm learning things like this. I'm currently learning DirectX 12 and as you explain about Vulcan, they aren't always simple to use, but if you want to make really good graphical applications at some point then all of that control over the hardware can be very useful. And most importantly, you know exactly what the computer is doing, which is really cool. I especially liked you points on "reinventing the wheel" because no, I don't really think we are. As you say, we are just trying to understand how the wheel works and we can use that to build better things. Thank you again for the support, means a lot! :)
@@aerideus For me, I'm highly intelligent, I understand numbers, math, physics, chemistry, electricity, circuits, computers, software to some degree. I don't know everything there is, however, I never stop learning and will learn all that I can when it comes to the functionality of modern computers and hardware. I am familiar with every topic there is. I'm not the best at computers as there are many others that design their internals for a living where I've only learned about the process of it. However throughout all of my own research and understanding there is one thing that I have at my core that allows me to be where I need to be and that is something that over 1/2 of your scientific community is missing or lacking and that is my understanding of who wrote, created, designed the numbers in the first place and I will tell you that it is not man! My being, my existence is due to the Breath of God and I try to do all that I can to keep the Holy Spirit as close to me so that I may not falter, yet I'm far from perfect as I have my own sins. I am baptised and I believe in Yeshua and there is nothing anyone can do to ever change that. As for me, I completely believe in Free Will. So I say each to their own, make up your own mind, just know that at the end of the day you and you alone are responsible for all of your choices, actions, including your own thoughts. You will have to live with the consequences of them. The best that I can do for another is to kindly say to them May You Walk With God! And leave it at that! Now due to my Spirit, I'll even challenge the status quo! I wager the Holy Spirit!
Agreed with everything!
@@skilz8098 ah I see, someone discovered Terry
@@skilz8098 Agreeing until the end. I don't think we have nearly much free will at all. You were born in a society where your family and economic state were predetermined. Everything that you could do, your potential, what you could have learned, etc, were all possibilities that never could have existed without your interaction with other people and society. As you live your life, you are shaped uncontrollably by the events you experience in your life, and that changes you and forms you into who you are - whether you like it or not. You are a sum of all your parts, and your parts were not made by you. The degree of control you have over it is determined by your thoughts and mind - which themselves are yet again uncontrollably influenced and determined by your environment since childhood. People might have some tiny amount of free will, but most everything in your life is predictable, and everything could be reasonably concluded from your birth by someone with all knowledge. If you believe in god, what you believe in must be some sort of twisted entity that loves the suffering of man, because there's a lot of it and you couldn't possibly blame humans with their limited life experiences for it. A child does what he is shown. Ultimately the one in control, and the one responsible for "sin" in the first place, would be god.
Just so you know - I'm here and watching these video's so keep making them they're excellent :)
Thank you! Means a lot!
@@aerideus Where did you go haha.
I was having problems using the short cuts or what ever they were called and just used the functions and it worked so big ups 👍
Great tutorial man, had 3 problems out of my own fault but managed to find and fix them. You make for a good teacher, i suggest you continue building on this window, make some buttons and make it pick a random number between 1 and 100.
That really means a lot! Unfortunately I have extremely little time right now and I don't know when I'll get back into making videos. But I'll try to get something out during this fall at least. Comments like yours is what really motivates me!
@@aerideus One video a month is more than enough until you build an audience This retard youtube will not feature anybody unless you have like 50 videos or something
@@da_cat I'll try to do that when I have more time, thanks again!
This video is great. You explained ( mostly ) everything. I watched it multiple times :)
I found your channel through the bitmap videos, thank you for your effort. I use linux so this video wasn't for me but not the less i enjoy watching you. Have a nice day!
I'm sorry that this wasn't a useful video for you but there will be more videos in the future that you will be able to follow. Thank you for your encouragement!
If you are on linux, you can replace all of the Windows API calls with the equivalent "Linux" calls. At this point of the video, there is no current Graphics API being used. If he's using DirectX, you can follow along but replace everything with either OpenGL or Vulkan. There are subtle differences, but yet the overall concept of the application design is basically the same.
@@aerideus hey, if you tell us that there will be "more videos in the future", then upload them already. It's been 2-3 years
Very nice tutorial and voice. I found the official docs a bit confusing tbh...
I'll make sure to point people to your channel if I ever get the chance :)
Thank you! I would truly appreciate that! And yes, the documentation can be a bit confusing. There is a lot of good information but it's often hard to know what you actually need to understand and use
you really helped me so thank you.
i am here to ask for more tutorials like "how to add text" or "how to make buttons" because every other video is not as clear as you
Great to hear that! I honestly haven't worked much with that kind of stuff so I don't have anything planned at the moment. However, that might change because I have thought about reading more about it. My best advice if you want to add text and such is to read about GDI+. I don't have much experience with it myself but I have heard that it is good.
@@aerideus this video is totally awesome and even more awesome is your honesty level!! Everybody is learning something.... Would love to see more videos like this
@@vivekkoul4428 Really means a lot! I've been very busy the last couple of weeks but I'm planning to start releasing a lot more videos in about a month!
@@aerideus oh that would be great!! We are waiting
Vulkan also benefits from this, glfw is a great API, but may be you want finer control of what you do. Also, it means less dependencies.
This video saved my project.
Love your videos! We need more!! I love coding along
Good tutorial. I enjoyed it.
Love your videos man ❤
The complier gives me this error " error: cannot convert 'const wchar_t*' to 'LPCSTR' {aka 'const char*'} " , how can i fix it?
add a "L" without quotes in uppercase before the quotes where you are storing the name,this will convert it to desired type
Winapi strings don't seem to be explained verybwell
Finnaly one video that worked!!!!!
Just found your channel, great content man!
Thank you, appreciate it!
Great tutorial! Very clean and organized!
First time trying this, and wow, very overwhelming.
Very nice vid, you deserve more subs
Absolutely amazing, interesting and educational. Thank you!
In my system, it creates a window with no background (as of 22:46). To fix, I added "wndClass.hbrBackground = GetSysColorBrush(COLOR_WINDOW);" between wndClass.hIcon and wndClass.hCursor lines. This used a system defined color to paint the background of the window white.
How would you change this color on this?
This is what i learn from mathematics; we don’t need to know what these structures mean; we need how to work; and when we see the results we understand what it mean. Like differential manifold.
You are a legend bro, thank you so much
I just want to make a cookie-clicker clone for fun lol, so this tutorial is getting me past the, hopefully, biggest hurdle. Thanks for the vid.
wow this tutorial was absolutely amazing! I've been learning about programming, computer science and C++ for about a year now as a hobby, although it's turned into a sort of obsession lately ;) this is the best tutorial I've found in terms of explaining whats actually going on under the hood in windows when you do something as simple as create a window... I'm really astounded by how much us going on in the background! I would love to learn more about how this works, do you have a recommended resource for learning the winapi as you did? I would just like to learn it well enough to really understand all the details of the code you wrote here but I looked at the microsoft website and the documentation for win32 appears almost impenetrable to me so just curious if you know a good resource that explains the details and concepts of what you did here in a more relatively beginner friendly way ? thanks again for the video its really opened my eyes :)
I'm really glad to hear that! The API is really old unfortunately so I don't really know any good resources to learn it. The documentation is my "go to" but I totally agree with you on that it's a bit complicated and hard to read. My recommendation would probably be to look in resources for DirectX because it's still really common to use Win32 in that context. Most resources probably skip that part because it's not a part of DirectX but I've learned a lot from various tutorials even though the focus was DirectX. DirectX is also the most common and best way to draw to a Win32 window so it might be interesting anyway
Dan Appleman's guide to the Win32API. It holds legendary status.
@@mightyredstallion thank you for sharing the info Im definitely going to check that one out 👍 much appreciated 😊
gj .. more in-depth videos about win API would be highly appreciated. If you can go deeper into the event system on win API it would be great. How those messages working under the hood in which order. Explaining SetSublcassWndProc function and so on. Win API so old and so badly documented so if you have knowledge please share it with us.
I'm unfortunately not an expert on win32 so I don't think I'll be making more in depth videos. I know the API well enough to create a video like this one but I wouldn't be comfortable in teaching more complex topics. This was more meant to be a video that I can refer to when a I need to use a window in future tutorials. Sorry to disappoint you :/
Very simple and efficient explanation. I wonder what would the code be if we have a main window and we want to add another child window which is running on another thread?
Just create 2 windows and handle the other window's messages in a separate function.
Many thanks, you helped me a lot !
Great tutorial!
it was informative and very interesting. Thank you! :)
Can you make a video, where you add a button and maybe an action to it.
For example, when you press the button, you change some text or something.
excellent tutorial
Great tutorial. Could you please do a video on how to connect an active com object like "Word.Application" in plain C or C++ ?
Love this video! Is the white tulip a fringe reference?
I have the "cannot convert 'const wchar_t*' to 'LPCSTR'" message when compiling, anyone knows what to do?
A little late, but I found the issue was my compiler was not using unicode. In g++ I added the -DUNICODE flag, and it stopped screaming. I.e.
g++ -DUNICODE .\window.cpp .\Program.cpp
hey could you maybe explain the 2 lines after windows(); i havent seen this syntax yet and idk what it means.
Beautiful!
Great video!
getting a problem where it opens then immediately closes the window, probably an syntax error with my switch statement or while loop, ill look into it tomorrow, been messing around with code(not just this) for 2 and half hours today ready to relax for a bit
LOL 21:48 i did not add the '!' too it so whenever i wanted it to be running it was telling it to close
It's what I'm searching for, but I can't see the code. Borland C++ gave everything but the code to create a window.
Hey, man I followed through the tutorial and I dont have an window only the print of "Opening Window" could you help me? (I can send you the code on disc if you have it)
"It has worked perfectly."
That doesn't look remotely close to 640x480 window size to me. That, and I'm getting the same issue trying to successfully size a window with or without AdjustWindowRect. Windows doesn't seem to care what I specify and makes some scaled version of it instead by close to 60%.
I want to ask, why do you write your variables as "m_VARIABLENAME", I've seen others use this m_ initialization thing but I've never understood why they do it. Could you please explain? Thank you in advance!
m_ = membervariable
Really epic work. Your explanation is very clear. But you didn't talk about things after the creating the window. I succesfully create it now, but how can I register sprites on it and control them? I searched on youtube but other youtubers' tutorials are different with yours, and the window creation part is not as clear as yours. Can you help me find another video talking about how to create the game itself, and its window creation part is similar to yours? Or can you make one yourself XD. Lots of thanks. You help me a lot.
Thank you A LOT !
Thank you for making clear the process of creating a Window. Is it possible to create a blogpost or video for custom border / painting?
Glad I could help! Do you mean a custom border for a Win32 window? Like with a different shape or color? I'm not really sure what you mean
@@aerideus Yes. That's what i meant.
@@selcukermaya I'm actually not really sure how to do that or if it is even possible so I'm unfortunately not going to make a video on that. My best guess though would be to remove the border and try to get transparency working. That could be an idea.
I keep getting an error that says "Undefined reference to Window::Window() "
and the same thing for Window::~Window()
Anyone know what might be happening?
there is 2 possible:
1) your window.cpp file is not included window.h
2) if you build file with g++, maybe you haven't include all files
Thank you very much for this video! In my opinion you described it good ^^. Follow and like are already on the way :D
2:06, what do you mean by "Copy windows"? What specifically are you preventing the user from doing when you add these bits of code?
my guess is to prevent anyone using the Window class from copying a window
How many total lines of code did you have to write just to get a blank window to show up on the screen? Why did MS get rid of their visual programming languages where you just drop stuff on a form, press run and boom you have a window pop up on the screen with 10 seconds worth of work and no programming needed to do it. I just don't get it. I understand you can use C++ for other platforms but why would MS get rid of something - Like popping up a window with 10 seconds worth of work - in favor of having to write (and learn) multiple lines of code and 23 minutes of work time to do the exact same thing.
If you just want a simple window with a few buttons and some text then I think C++ is the wrong language. C# forms or C# with WPF is fantastic for this kind of task. However, you don't have the same control over the underlying architecture that is needed when creating something like a game or a game engine. If you're using something like DirectX to do graphics then Win32 is the best way to handle the window in my opinion. You need the HWND when setting up the DirectX Swap Chain for example and the APIs were designed to work well together. But as I said, if you just want a quick and nice looking window then read up on C# and WPF because that's the best in my opinion (for windows).
@@aerideus Thanks! I do appreciate the quick response.
@@dbreardon No problem! :)
WNDCLASS... are we creating a class insode another (Window) class?
It's not a class. Wndclass is a good old C struct that only has variables inside.
Getting "Exception thrown at 0x00000000 in WindowTutorial.exe: 0xC0000005: Access violation executing location 0x00000000." Whenever I try to run the debugger whenever everything compiles
Seems like you are trying to read or write to memory outside of an array or maybe you are using a pointer to a deleted object. I'd start by checking that all code involving pointers is correct.
Hello! I am trying to code this up in my netbeans however I keep recieving an error when building, " Window.cpp:34:13: error: cannot convert 'const wchar_t*' to 'LPCSTR' {aka 'const char*'} "
there seems to be an issue with the CLASS_NAME declaration, any ideas how to fix this?
:)
Found the solution: Not specifically for netbeans since I use VS19. go to Project -> 'project name' properties at the bottom -> Advanced -> Charset changed to unicode. You may have to change it for your release, debug, and the active debug. I have not used netbeans, but It should be very similar.
I think the problem is that you are not using the newer wide character functions. I'm not 100% sure how this works in other editors but try either adding a W to RegisterClass (so use RegisterClassW) or change the wchar_t* to a normal char*. Hope that helps!
how to enable visual style
Question: If I were to try to make a game in this way, how would you go about drawing graphics (lines/shapes, images, etc) to the created window?
The best way is probably to use DirectX. The Win32 API can of course be used with OpenGL and other cross platform options but DirectX is made to work well with Win32 as it is Microsoft's own API. The HWND is for example used when creating the DirectX resources and it will be harder to connect the window to a different API, but not impossible
@@aerideus As Hugo said, you can use the DirectX API, the OpenGL API and or the Vulkan API, or you can design your application to use all 3 renderers and allow your user to decide which renderer they want to use! Typically the drawing calls will be setup and done by the APIs and the information will be sent to the Pipeline and typically you'll use shaders to do the processing of the vertices and pixels or fragments...
Is it possible to create this in c, as the WIN32 api is written in c
Yes, absolutely. The code is exactly the same, but with only functions instead of classes. I would create a struct containing the member variables and just move the methods out of the class. Hope that helps!
How much memory does it take open win32 window?
I'm not sure. There is a lot going on behind the scenes so I think it is hard measure that. The good thing is that it isn't enough to ever be something we have to think about.
You should put the github source code in the description.
Greate tutorail, but can you make the font bigger since most of us care to read the code .
ty
Please use bigger fonts for tutorials
but im on linux... L to me
23 mins of creating one simple window. 😂 In nowadays' frameworks like Electron - it's just one minute work
This Window app is 65kb something in size Electron with it dependencies ~1GB
@@مقاطعمترجمة-ش8ث yes, but the time is money. Who cares nowadays about disk space…
@@ГеоргиЧавдаров-в7з Electron is not good for business, I work as IT and web developer, In business environment even small mistakes could cost a lot of money, or even bankrupt the entire company,
C++ applications still the most stable and reliable executable format, others just trying to come close to it and fail.
@@مقاطعمترجمة-ش8ث Can you explain what kind of mistakes? And how much of them could be produces really by Electron-like library? And not last - if electron is based on V8, which is written in C, why we shouldn’t use it, in fact it is just expecting a JS code (which is more beautiful than C) and run it?
You fonts are too small to see. I can't work with such small fonts . Even after full screen mode I had to use a on screen magnifier to watch your video.
Man, this older that shit.
its actually that complicated? Wow
brutal
very dificult to see what you write. Make the quality better please.
I avise every to not use Win32 API but to use Qt or another wrapper instead. Api Win32 is very old and awful to use that making code hard to developp and to maintain
I understand what you mean but I don't think it is a waste of time to learn basic Win32. It is still the "proper" way to do things on Windows and it can still be good to know what's underneath if you decide to use a wrapper to simplify everything
@@aerideus it's not the proper way... the automatic UI test tools like squish are hard to use with Win32.. No knowledge is bad but i think there a lot of more useful things to know as a developper
WTF is all this!! I just want a window to draw pixels on!!
When I compile the code, I keep getting this error that says "cannot convert 'const wchar_t*' to 'LPCSTR' {aka 'const char*'} in assignmentgcc" Could anyone help me?
//This is in window.cpp
#include "Window.h"
const wchar_t* CLASS_NAME = L"Hugos Window Class";
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CLOSE:
DestroyWindow(hWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
};
return DefWindowProc(hWnd, uMsg, wParam, lParam);
};
Window::Window()
: m_hInstance(GetModuleHandle(nullptr))
{
WNDCLASS wndClass = {};
wndClass.lpszClassName = CLASS_NAME; //Error occurs here
wndClass.hInstance = m_hInstance;
wndClass.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.lpfnWndProc = WindowProc;
RegisterClass(&wndClass);
DWORD style = WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; //32 bit int = DWORD
//Caption makes the window have a title
//Creates a minimize box in the corner
//Sysmenu displays minimize box and close button
const int width = 640;
const int height = 480;
RECT rect; //Dimensions of the window
rect.left = 250;
rect.top = 250;
rect.right = rect.left + width;
rect.bottom = rect.top + height;
AdjustWindowRect(&rect, style, false); //Corrects the rectangle to use the width and the height as the canvas size
m_hWnd = CreateWindowEx(
0,
CLASS_NAME,
L"Title",
style,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
NULL,
NULL, //Menus?
m_hInstance,
NULL
);
ShowWindow(m_hWnd, SW_SHOW);
}
Window::~Window()
{
UnregisterClass(CLASS_NAME, m_hInstance);
}
bool Window::ProcessMessages()
{
MSG msg = {};
while (PeekMessage(&msg, nullptr, 0u, 0u, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
return false;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
};
return true;
}
try putting
#define UNICODE
at top of each file
After Compiling I get an Error : Error LNK2019 unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
Any assistance would be awesome, also great video love to see more.
Sorry to bug you but I think I figured out infinite compression using IMAGES. You might have the knowledge to put together the pieces that would make this work. I would be very interested to hear what you have to say given your knowledge about BMP IMAGES and C++ Programming.
PART 1
If you Open PAINT.NET and make a 1920x1080 IMAGE. APPROX. 2 Million pixels.
Then ZOOM in to the Pixel level and make either a white pixel or a black pixel.
White = 0
Black = 1
Fill the entire screen with these random 1s and 0s (Black and White PIXELS). APPROX 2 Million BITS(theoretical)
Then Save that IMAGE using .TIFF file format in PAINT.NET
Now check this. The Final file size of the .TIFF file is WAY less than the 2 Million BITS(theoretical) Black and White Dots you originally put into it.
PART 2
Why Can't you just take the .TIFF file (1s and 0s) go back into PAINT.NET and PAINT them in and do it again??????
PART 3
You need a HEX editor to Grab the 1s and 0s. A Means of moving that info into a BINARY PIXEL MAP IMAGE. (I'm thinking a BMP file) then converting the BMP using .TIFF compression.
Then take the .TIFF Back into the HEX editor, extract the 1 and 0s, Build a new BMP Map.
A SMALLER BMP THAN THE FIRST!!!!!!...... What?!!?!?
Then convert it into a .TIFF
Please please tell me why this isn't infinite compression. I can do it, but I'm not a programmer so It's really really slow because I have to Paint Each Pixel and Copy and Paste the HEX Binaries into the BMP files ETC..
Can you make a program that would do all this. It's probably worth a Trillion dollars. I Don't care about money, I just want the technology in the hands of the People.
TIFF was made available for free thru PAINT.NET another Free program. I think this Idea belongs to the world.
Very interesting! I'm not actually that familiar with different formats and compression as this is a very complex topic. What I do know is that reducing the file size a lot usually means that some data is lost. This is the case if you convert a .bmp image to a .jpg for example, the file is way smaller but you can see a difference in quality. There is also lossless compression and that is used in .png files which means that the file is smaller than a .bmp without any impact on quality. I don't think there is such a thing as infinite compression without loosing the image as the data must be stored somewhere but it's interesting that you managed to make the file smaller. Keep in mind though that compression can be used in .bmp files, I just didn't implement it but paint.net might use it and that can also be a reason why your file got smaller.
@@aerideus
Thank you so much for the reply.
I generated a Large Number of Different Noise distortion Filters in PAINT.NET.
I would Flood fill the Screen Black. Then Apply the Noise Distortion.
This would generate A Gray scale Cloud gradient down to a pixel level.
That is 2,000,000 Pixels with like 8 colors = 8 to the Power of 2,000,000 Combinations. If you look at it as a binary image. In other words a String of 2,000,000 Characters with 8 color possibilities for each position. THAT'S A BIG NUMBER!!
This Gray Scale Cloud Saves in .TIFF for like 206k. Another Problem with GrayScale clouds is it causes the TIFF compressor to dither pixels. So Preservation is an issue.
NOW... I'm Using white and Black Dots not a Grayscale. From What I can tell TIFF can Literally and Fantastically take a giant field of White and Black Dots and Compress them without image quality loss of any kind. If you add an empty line between each row of DOTS it will also add further separation to prevent image quality loss. This will cut your space in half. So it will be 1,000,000 DOTS or 125,000k..... So again the File Save Size is Well Below that around 50,000k
Imagine TIFF is just Really Amazing at Organizing Two Things.. So Good that it can organize Black and White DOTS in a Pixel Field to less 1s and 0s in the file it Saves. It's as Simple as That. The problem is interpreting 2,000,000 DOT PIXEL field into a PROGRAM
_____________________________________________________________________________________________________________________________________
How I the NONE programmer would tell a Programmer what I would Want to create:
Compression:
A HEX editor Accesses a File. The Hex Editor Creates a BINARY IMAGE MAP BMP FILE of 1(BLACK) and 0(WHITE) Pixel Dots. This BMP Image MAP is now a sequential set of Binary digits. The Pixels are arranged Exactly to the MEMORY LOCATIONs of the FILE. This way if you wanted to Translate the Pixel DOT BMP image MAP Back it would be EASY. The Order would be the Same as when the BMP image MAP was created.
Now you Have a BMP Pixel MAP representing a File.
Convert it using .TIFF Conversion. BMP to TIFF
You have now essentially Compressed 2 Million Bits of DATA into a 1 Million Bits TIFF file.
__________________________________________________________________________________________________________________________________
Decompression:
All final compressed files would be in TIFF format.
Open a TIFF using a TIFF to BMP Image conversion.
Take the BMP Image and Translate it thru the HEX editor back into it's original form.
DONE!
_______________________________________________________________________________________________________________________________
Magic:
Take the TIFF files of compressed Data and run Compression on them using the above method.
Result Infinite Compression Down to the Smallest Size a TIFF file can be.
@@hueborn2592 Once again, very interesting! I haven't worked with TIFF files but it seems like something worth reading up on. And as I wrote earlier, image compression is a complex and very interesting topic.Thank you for the great ideas!
@Creative Destroyer that is a very good advice that I'll remember. Thank you!
@@hueborn2592 "Infinite Compression" is not possible, there is a theoretical maximum (which you can calculate!) that tells you how much you can compress data before you start losing it. This depends on the entropy of the data you're compressing (which is a measure of how "unpredictable" it is). This is also why random noise compresses badly, as it has a lot of entropy which makes it hard to compress. Now if you start discarding data, then yes you could technically achieve infinite compression, but then you would have no data left, rendering it useless.
im getting an error where hWnd is 0, when I call register class i am getting error message 87, and when I call createwindow i am getting error message 1407. what could be causing this? weirdly, I had this code coppied and it worked fine now it is refusing to work and Im not sure why.