Thread: open a blank window in C

  1. #16
    Registered User
    Join Date
    Jul 2022
    Posts
    50
    basically, I have no idea what all the codes mean(other than #include <windows.h>)

    can we go over it?

    maybe someone can write comments beside all the codes



    thanks

  2. #17
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Quote Originally Posted by WaterSerpentM View Post
    basically, I have no idea what all the codes mean(other than #include <windows.h>)

    can we go over it?

    maybe someone can write comments beside all the codes



    thanks
    Maybe you could do that.

    Or maybe just write some of the waffle from the 25 minutes of YT video where they explain what each bit of code does in detail.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #18
    Registered User
    Join Date
    Jan 2010
    Posts
    206

    Yes

    Quote Originally Posted by WaterSerpentM View Post
    maybe I am just new to this, but,


    Is all that coding needed just to open up a blank window? or are there excess coding?
    Put simply...yes. That's what's needed to open a blank window afaik. You can check out a book that helped me (idk if it's still the best one?) Charles Petzold Programming Windows 5th Edition. Quite big and a bit pricey but very good. I got a copy on eBay.

    Your code gives a declaration of a window message handler function, then comes to the part where Windows enters your program (the WinMain part) then it creates a window class and then registers it.

    Then it creates the window. Then it enters the message loop which makes use of your window message handler function to process messages generated by any interaction with the window. The last part is where the window message handling function is defined.

    In your case your code only handles (explicitly) one message which is the destroy message that closes the window.

    If you don't know what any of that means it's time to do some work and reading

  4. #19
    Registered User
    Join Date
    Jan 2024
    Posts
    3
    call ShowWindow,
    ```
    HWND hWnd = CreateWindowW(L"myWindowClass",L"My Window",WS_EX_OVERLAPPEDWINDOW | WS_VISIBLE,100,100,500,500, NULL,NULL,NULL,NULL);


    ShowWindow(hWnd, SW_SHOWNORMAL);
    ```

  5. #20
    Registered User
    Join Date
    Jul 2022
    Posts
    50
    Quote Originally Posted by cuteblanket View Post
    call ShowWindow,
    ```
    HWND hWnd = CreateWindowW(L"myWindowClass",L"My Window",WS_EX_OVERLAPPEDWINDOW | WS_VISIBLE,100,100,500,500, NULL,NULL,NULL,NULL);


    ShowWindow(hWnd, SW_SHOWNORMAL);
    ```
    what's that for?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open URL in new window
    By Magos in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2006, 02:17 AM
  2. Keeping window open
    By jpipitone in forum C Programming
    Replies: 5
    Last Post: 12-01-2003, 12:56 PM
  3. new open/save window???
    By hostensteffa in forum Windows Programming
    Replies: 14
    Last Post: 06-26-2002, 12:12 PM
  4. Redrawing window blank
    By unanimous in forum Windows Programming
    Replies: 1
    Last Post: 04-06-2002, 09:12 PM
  5. How to open window maximized
    By Unregistered in forum Windows Programming
    Replies: 5
    Last Post: 02-04-2002, 04:29 PM

Tags for this Thread