Quick question on learning win API...

This is a discussion on Quick question on learning win API... within the Windows Programming forums, part of the Platform Specific Boards category; From all the tutorials I've read, there is a lot to take in, and I was just wondering if you ...

  1. #1
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204

    Thumbs up Quick question on learning win API...

    From all the tutorials I've read, there is a lot to take in, and I was just wondering if you need to memorise all that stuff to make the window appear? Or do you just need to understand what all the functions do?

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,851
    The hard part of programming is knowing how to apply what you know. Memorising every last detail of every API call doesn't help you.

    But knowing the APIs of the most frequently used stuff, and having a good (and fast) local reference certainly helps to keep things moving along when you're programming.

    For example, to get a basic window, I'd just copy/paste some previous code, or maybe have a prepared template or two ready to go.

    Several IDEs for example come with preset project templates, so by saying "empty GUI project", you get all the stuff to display a blank window with a few mouse clicks. The hard part is then for you to make it do what you want.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,025
    You should know the steps involved in achieving this. For example, you should know that you must register a class, and then create a window and you need a message callback function, and you need a message loop to make your window work.
    It's good to remember the APIs and how to use them, but I don't think you'll be able to remember that. The best idea is to create simplified helper functions or classes to do all the work for you while you easily specify just enough information that you can easily remember (or document the function or class).
    So to create a window, and you'd have to do is call function CreateWindow which returns HWND, which also registers the class, create the window according to your preferences, registers its own message callback function and starts a message loop.

    Simple and easy. There are lots of APIs that takes these annoying structs of information and you have to set the correct mask to indicate what information you're providing. Believe me when I say you get frustrated because it doesn't work and you have no idea why. So... create helper functions and classes and look at tutorials and code snipets to get your work done.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    You dont need to memorize all the functions, just be aware of what is available and keep the help file handy. Other than a few extremely common functions like CreateThread() I dont bother with most of the API.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  5. #5
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,691
    You should make a basic template application.
    I made one for dev, it creates a centered window with a menu, and has a timer drawing to a double buffer, and helper functions for creating child windows.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  6. #6
    "Why use dynamic memory?"
    Join Date
    Aug 2006
    Posts
    186
    no programmer on earth can do WinAPI32 applications without a book beside him to look at
    "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
    Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,025
    But you mean a she can?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    If it's a simple program, sure you can. If not, well I'd bookmark MSDN.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help with this
    By tyrantil in forum C Programming
    Replies: 18
    Last Post: 01-30-2005, 04:53 PM
  2. win api literature
    By DMaxJ in forum Windows Programming
    Replies: 5
    Last Post: 04-30-2004, 04:25 PM
  3. Win API
    By Marky_Mark in forum Windows Programming
    Replies: 4
    Last Post: 10-23-2001, 01:57 PM
  4. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 03:12 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 06:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21