Results 1 to 2 of 2
  1. 12-20-2009, 04:00 PM
    #1

    Veteran Hacker

    Expand

    ヘ(^_^ヘ)(ノ^_^)ノ's Avatar
    • My Statistics
      Join Date
      Sep 2009
      Posts
      218
      Contest Points
      0
      Beli
      0
      Received Thanks
      58
      Beli
      0 (0 Banked)
      EZKoins
      0 (0 Banked)

    Default [TUTORIAL]How to use the MSDN Library

    Since 75% of you on this forum dosen't know about the MSDN Library, or that it even exists. I will be here to explain to you how to use it, instead of coming here to ask questions about which function to use.

    This will teach you to use the MSDN Library. Read if you want or don't. I can care less.

    First lets explain some things.
    Primitive data types are data structures built into the programming language.

    Keywords is a list of reserved functions/data structures in C++. Since they are used by the language, these keywords are not available for or overloading by programmers.
    C++: int iNum;
    Visual Basic: Dim iNum As Integer
    Classes is an expanded concept of a data structure. Instead of holding only data, it can hold both data and functions.

    Objects are instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable.

    Functions are a group of statements that is executed when it is called from some point of the program.

    Constants are expressions with a fixed value.

    Arrays are series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.

    Pointers are variable that holds the address of another variable, function or data.

    Libraries are collection of functions, constants, classes, objects and templates that extends the C++ language providing basic functionality to perform several tasks, like classes to interact with the operating system, data containers, manipulators to operate with them and algorithms commonly needed.
    In C++, you include libraries that you need and use them. In Visual Basic, all the libraries are included by default and you have to declare the prototypes of the functions you want to use.
    For those who do not know what the MSDN Library is, it is the Microsoft Developer Network Library which holds documentation for all Miscrsoft compilers, libraries, functions and more.

    Now instead of coming to ask us how to do something, go search the MSDN first.

    When you look up a function on the MSDN Library, you see something like this:

    GetWindowRect Function
    The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
    Code:
    BOOL GetWindowRect(
         HWND hwnd
         LPRECT lpRect
    );
    Parameters
    hwnd [in] Handle to the window.

    lpRect [out] Pointer to a structure that receives the screen coordinates of the upper-left and lower-right corners of the window.
    Return Value
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError();
    Remarks
    In conformance with conventions for the RECT structure, the bottom-right coordinates of the returned rectangle are exclusive. In other words, the pixel at (right, bottom) lies immediately outside the rectangle.
    Example
    For an example, see Initializing a Dialog Box.
    Function Information
    Code:
    Minimum DLL               Versionuser32.dll
    Header                    Declared in Winuser.h, include Windows.h
    Import library            User32.lib
    Minimum operating systems Windows 95, Windows NT 3.1
    Unicode                   Implemented as Unicode version.


    Now I will explain what these all mean. The first line is the name of the function. Right under that is the explanation of the function. It tells you what it does.

    The thing in the block of code is the function. Here is the layout of a function.
    Code:
    RETURN_TYPE FUNCTION_NAME (PARAMETER_TYPE PARAMETER_NAME, ...)
    {
         CODE
    }
    RETURN_TYPE is the data type it will return. It dosen't have to return any value either.

    FUNCTION_NAME is the name of the function. You may give two functions the same name to overload them.
    Overloading is beyond the scope of this tutorial.
    PARAMETER_TYPE and PARAMETER_NAME are the parameter. The PARAMETER_TYPE refers to the data type that will be passed into the function. The PARAMETER_NAME is the name of that data type. You many have more than one function, or you may have no functions.

    CODE is the code that any function would have. It can be left blank.
    The parameters are also listed below the code. The [in] means that once a parameter goes in, it dose not get changed. The [out] means that the parameter is passed in and when the function is complete, that parameter is passed back out and is modified.

    The return is what the RETURN_TYPE is for. In this case the return type is a BOOL value, and if the function is successful in getting the window's RECT, it returns a non-zero value (which means any number but 0).

    The remarks are any additional comments didn't mentioned ablve. Sometimes these are just notes about how the functiosn work differently for different operating systems.

    The example is a link the how to use that code. Not all functions are generous enough to give you an example.

    The function Information is all the additional information required to use that function. Everything there is self-explanatory.

    The most important party of the MSDN Library is the ability to search what you need in there. So don't ask stupid here.

    DISCLAIMER:
    All code was provided by the MSDN Library. Warranty void if removed or altered. No purchase refunds after the limit of 30 days. Stop reading if this tutorial causes the following symptoms; dizziness, nausea, vomiting, or any discomfort and consult your doctor. This tutorial is not responsible for any emotional distress. Read at your own risk.
    Intel Corie i7 920 OC @ 4.0GHz + Prolimatech Megahalems CPU Cooler with 2 Fans @ 1200RPMs
    Evga X58 SLI Classified
    Evga GTX 470 FTW for 3 Way SLI + Evga GT 9800 GT for PhysX
    Corsair Dominator GT 1600MHz DDR3 6GB
    Corsair HX1000
    Corsair Obsidian 800D
    Kingston 64GB SSD for OS + Western Digital Caviar Black 1TB for Storage
    Alienware OptX 3D Monitor + Nvidia 3D Bundle
    Razer Lycosa, Mamba, Sphex, Mako, & Megalodon


  2. The Following 1 Users Say Thank You to ヘ(^_^ヘ)(ノ^_^)ノ For This Useful Post:

    Wintermute (01-11-2010)

  3. 01-11-2010, 05:59 PM
    #2

    Leecher

    Expand


    • My Statistics
      Join Date
      Dec 2009
      Posts
      3
      Contest Points
      0
      Beli
      0
      Received Thanks
      0
      Beli
      0 (0 Banked)
      EZKoins
      0 (0 Banked)

    Default Re: [TUTORIAL]How to use the MSDN Library

    Thanks, MSDN is a very good site for learning both c++ and winapi. You've inspired me, i might just go make a tutorial on winapi for noobies.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
"