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 typesFor 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.
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;Classes
Visual Basic: Dim iNum As Integer
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.
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:
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.
hwnd [in] Handle to the window.Return Value
lpRect [out] Pointer to a structure that receives the screen coordinates of the upper-left and lower-right corners of the window.
If the function succeeds, the return value is nonzero.Remarks
If the function fails, the return value is zero. To get extended error information, call GetLastError();
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
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.
RETURN_TYPE FUNCTION_NAME (PARAMETER_TYPE PARAMETER_NAME, ...)
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.
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 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.
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.