Aerideus
Aerideus
  • 3
  • 156 249
Creating a Window using C++ and Win32 | Tutorial
This is a video tutorial on the simplest way to create and manage a Window in C++ using the Win32 API. If you have any questions then leave them in the comments and I will do my best to help you out!
All window styles:
docs.microsoft.com/en-us/windows/win32/winmsg/window-styles
Hope it was helpful!
/ Hugo
มุมมอง: 93 509

วีดีโอ

Reading a Bitmap Image (.bmp) using C++ | Tutorial
มุมมอง 22K3 ปีที่แล้ว
This is a video tutorial on reading bitmap images using C and it is built on my last video about creating bitmap images. I you have not seen that video, you can find it here: th-cam.com/video/vqT5j38bWGg/w-d-xo.html I recommend that you watch that video first as general information about bitmap images is explained there and a lot of the code is reused in this video. I hope it was helpful and if...
Creating a Bitmap Image (.bmp) using C++ | Tutorial
มุมมอง 41K3 ปีที่แล้ว
This is a video tutorial about exporting an image as a Bitmap Image File (.bmp) using C . If you have questions, just let me know in the comments section. If you are interested in reading bitmap images as well you can watch my following video in which I show exactly that: th-cam.com/video/NcEE5xmpgQ0/w-d-xo.html Hope it was helpful and have a great day! /Hugo

ความคิดเห็น

  • @A1binoc
    @A1binoc 2 วันที่ผ่านมา

    I want to ask a question about padding bytes. Can we use "pragma pack" to avoid using padding bytes? I think it will be a little bit easier. (I'm not so good at programming, sorry if it is a stupid suggestion)

  • @darvin1743
    @darvin1743 5 วันที่ผ่านมา

    От лица y28 привет всем предыдущим годам, все мы тут были)

  • @needosleep
    @needosleep 10 วันที่ผ่านมา

    ITMO Y28 is here!!!

  • @johnnymuen4948
    @johnnymuen4948 19 วันที่ผ่านมา

    ty

  • @rageshadey
    @rageshadey หลายเดือนก่อน

    It might be because i'm using visual studio but wanted to put things that needed extra work for those following the guide: 2:37 Make sure to add "bool Window::ProcessMessages() { return false; }" to the Window.cpp. It didn't do it automatically for me.

  • @LoganGarrett-c6x
    @LoganGarrett-c6x หลายเดือนก่อน

    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?

    • @tnt8490
      @tnt8490 หลายเดือนก่อน

      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

  • @justcurious1940
    @justcurious1940 หลายเดือนก่อน

    So clean and so organized, Thanks a lot.

  • @justcurious1940
    @justcurious1940 หลายเดือนก่อน

    This is Gold content, God bless Bjarne Btroustrup.

  • @santitabnavascues8673
    @santitabnavascues8673 2 หลายเดือนก่อน

    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.

  • @cinemor_the_real_one
    @cinemor_the_real_one 3 หลายเดือนก่อน

    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

    • @cinemor_the_real_one
      @cinemor_the_real_one 3 หลายเดือนก่อน

      LOL 21:48 i did not add the '!' too it so whenever i wanted it to be running it was telling it to close

  • @lln6123
    @lln6123 3 หลายเดือนก่อน

    Thanks ALOT!

  • @stxrpen164
    @stxrpen164 4 หลายเดือนก่อน

    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; }

    • @eter9nitysslut131
      @eter9nitysslut131 3 หลายเดือนก่อน

      try putting #define UNICODE at top of each file

  • @antpalmer5856
    @antpalmer5856 4 หลายเดือนก่อน

    Love this video! Is the white tulip a fringe reference?

  • @nathanielsicard
    @nathanielsicard 4 หลายเดือนก่อน

    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.

  • @bluepiston9347
    @bluepiston9347 4 หลายเดือนก่อน

    but im on linux... L to me

  • @bluepiston9347
    @bluepiston9347 4 หลายเดือนก่อน

    hey i ran into an issue and had to change #include "Image.h" in the BmpTutorial.cpp file to #include "Image.cpp" it to work.

  • @supergubben
    @supergubben 4 หลายเดือนก่อน

    Would it be possible to make images with 10 bits for each color? (0-1023 instead of 0-255)

  • @GalaxiaDeFavio
    @GalaxiaDeFavio 5 หลายเดือนก่อน

    brutal

  • @BingtheLizard
    @BingtheLizard 6 หลายเดือนก่อน

    "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%.

  • @aeiou3701
    @aeiou3701 6 หลายเดือนก่อน

    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 👍

  • @joeagorn
    @joeagorn 6 หลายเดือนก่อน

    Amazing tutorial! From explaining how the bitmap file works, what the headers do, to implementing the code ... everything was great! I followed the tutorial and everything worked without errors.

  • @Satuts_Editor
    @Satuts_Editor 6 หลายเดือนก่อน

    I come to this from google gemini

  • @shootingthemoon
    @shootingthemoon 7 หลายเดือนก่อน

    I am 45 years old and just wrote my first code by following this video. It was very helpful. I tried a lot of other videos from different channels but kept getting error codes. I couldn't get anything to work. But this was great, you showed every step and explained everything clearly.

  • @alexzander1604
    @alexzander1604 7 หลายเดือนก่อน

    This video saved my project.

  • @Rjmortera
    @Rjmortera 8 หลายเดือนก่อน

    Hi, do you have a contact info? Would like to discuss work opportunity

  • @Kyler1Ace
    @Kyler1Ace 8 หลายเดือนก่อน

    excellent tutorial

  • @pualgror7083
    @pualgror7083 8 หลายเดือนก่อน

    Many thanks for the tutorial! Is this code available for download?

  • @messager3000
    @messager3000 8 หลายเดือนก่อน

    Thank you A LOT !

  • @giancarlo426
    @giancarlo426 9 หลายเดือนก่อน

    Nice. Thank you.

  • @bostjanlaba
    @bostjanlaba 10 หลายเดือนก่อน

    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?

    • @christoffer4862
      @christoffer4862 7 หลายเดือนก่อน

      Just create 2 windows and handle the other window's messages in a separate function.

  • @harrygray9887
    @harrygray9887 10 หลายเดือนก่อน

    sat there for 2 hours debugging iH[14] = 24; bits per pixel. Set it to zero and you are SOL

  • @anon_y_mousse
    @anon_y_mousse 11 หลายเดือนก่อน

    This is good, but you really need to adjust your volume.

  • @McGewen
    @McGewen ปีที่แล้ว

    super useful!!!

  • @НикитаЗмиевец
    @НикитаЗмиевец ปีที่แล้ว

    ITMO loves you

  • @xoxogamewolf7585
    @xoxogamewolf7585 ปีที่แล้ว

    First time trying this, and wow, very overwhelming.

  • @ПанюковаДарья-т4т
    @ПанюковаДарья-т4т ปีที่แล้ว

    Удачи всему y27 ❤

  • @Ilya-hi9xq
    @Ilya-hi9xq ปีที่แล้ว

    привет y27 от y26,мы тоже все были на этом видосе год назад)))))

  • @SingularityLabsAI
    @SingularityLabsAI ปีที่แล้ว

    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.

  • @kcvinu
    @kcvinu ปีที่แล้ว

    Great tutorial. Could you please do a video on how to connect an active com object like "Word.Application" in plain C or C++ ?

  • @BatBatov666
    @BatBatov666 ปีที่แล้ว

    Please use bigger fonts for tutorials

  • @LimeLiquide
    @LimeLiquide ปีที่แล้ว

    This video is great. You explained ( mostly ) everything. I watched it multiple times :)

  • @rjackyl
    @rjackyl ปีที่แล้ว

    WNDCLASS... are we creating a class insode another (Window) class?

    • @zhulikkulik
      @zhulikkulik ปีที่แล้ว

      It's not a class. Wndclass is a good old C struct that only has variables inside.

  • @dheovanixavierdacruz3043
    @dheovanixavierdacruz3043 ปีที่แล้ว

    Beautiful!

  • @sigsig77
    @sigsig77 ปีที่แล้ว

    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.

  • @sinfulbstbeats5479
    @sinfulbstbeats5479 ปีที่แล้ว

    thank you so much. this is really a very cool and understandable video. you seriously helped me out. the video about reading was also incredibly helpful

  • @abdotawfikmath
    @abdotawfikmath ปีที่แล้ว

    Can you make a tutorial on how to do it in C? Would really appreciate it!

  • @RockPotato
    @RockPotato ปีที่แล้ว

    Thanks, this and your other tutorial is exactly what I needed!

  • @tdman3475
    @tdman3475 ปีที่แล้ว

    Very nice vid, you deserve more subs

  • @MyRandomChannel24
    @MyRandomChannel24 ปีที่แล้ว

    Great Tutorial Understandable but I can't Get it working? Thanks for The Tutorial Though!

  • @theodoreroberts3407
    @theodoreroberts3407 ปีที่แล้ว

    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.