StgSharpDebug Get the status of a certain key on the keyboard. Function handler to load an opengl function by searching its name. the name of the Opengl function An intptr value representing the pointer to the function Interface of all kinds OpenGL buffer objects Get the only handle to one of the Object instance Bind a buffer instance to OpenGL Index of handle of the object in this instance to be bind A collection of handle to Element Buffer Object in OpenglFunc. Each value indexed from instance of this class this is the only handle to one Element Buffer Object. Bind the frame buffer object with name frame buffer to the frame buffer target specified by target. will be set as default target. Index of object to be binded in handle set Bind the frame buffer object with name frame buffer to the frame buffer target specified by target. Target of this frame buffer should be set manually. The frame buffer target of the binding operation. Index of object to be binded in handle set Set data to current vertex buffer object Type of bufferData Index to find certain VBO in this instance Data to write in How OpenGL use these data, defined by Set data to current vertex buffer object Type of bufferData Index to find certain VBO in this instance Data to write in How OpenGL use these data, defined by Set data to current vertex buffer object Type of bufferData Index to find certain VBO in this instance A of data to write in How OpenGL use these data, defined by Set data to current vertex buffer object Type of bufferData Index to find certain VBO in this instance A of data to write in How OpenGL use these data, defined by Set data to current vertex buffer object Type of bufferData Index to find certain VBO in this instance A array of data to write in How OpenGL use these data, defined by Load all supported OpenGL APIs and bind them to given context. The used as current OpenGL context Get the function pointer of given OpenGL api name ContextName of the OpenGL api The funtion pointer of the api in stream of Bind a frame buffer to a frame buffer target Same function as glBindFramebuffer. The frame buffer target of the binding operation. The handle of the frame buffer object to bind. Init an OpenGl context if current form has not been binded to any context. and set the context binded to current form as current OpenGL context. Something goes wrong and StgSharp fails in creating a new OpenGL context. Create a set of . Amount of EBO to be created. Create a sets of Amount of textures to be created. Create a set of . Amount of VAO to be created. Create a set of . Amount of Object to be created. Create an instance of program New instance of instance. Attach one shader code to a shader program. Shader program to attach Index of shader code in current shader code set. Init a program with no shader attached. Get a uniform form current shader, the value type of the uniform should be provided. ContextName of the Uniform in shader code Get a uniform form current shader, the value type of the uniform should be provided. ContextName of the Uniform in shader code Get a uniform form current shader, the value type of the uniform should be provided. ContextName of the Uniform in shader code Get a uniform form current shader, the value type of the uniform should be provided. ContextName of the Uniform in shader code Link the shader to current context. Let the current context use this shader. A handle to an OpenGL object, must be indexed from a . Direct call will cause A handle to an OpenGL object. Release all resource in this handle. This will release all resource in this . This will be not usable. Set the size limit of current form Minimum width of current form Minimum height of current form Maximum width of current form Maximum height of current form Get (T is ) uniform from a shader. This uniform will be used as projection matrix of this camera. Additionally, for multi-shader rendering, each shader requires a uniform, so do not ignore return value of this method. Shader using this camera ContextName of projection camera named in shader (T is ) representing projection matrix in shader program. Get all uniform related to this . Shader program requires this camera. ContextName of all related uniforms. If you fallow form from Init an instance of OpenGL program, This method should be called before any other StgSharp api. Version of current StgSharp platform. Main version represent in hundred's digit, and sub version represent in ten's digit. Write a log message to log file, and mark the _level of this message. A string contains information of how current evironment runs. The severity of current message. OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1]. OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the range [0,1]. A two dimension vector defined by two elements. Vec2Ds in StgSharp are default used as colum vector. Orthogonalize two s, let their length be 1 and perpendicular to each other. Reurns the value of ArcSin(x) The sine value of the angle Get the value of E ^ x; Returns the value of ln(x). calculate the value of x^y Returns the value of x^y returns a random float number between 0 and 1. Generates a random seed in int value. A class contains a sets of methods to serialize several types An independent storage area, used as the only folder type in root folder. Contains several files reference as virtual disc. Data is actually stored in s in certain RAID mode. A sensor used for checking out if a bullet hit a player or something else A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y X position of an enenmy entity Y position of an enemy entity 当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常 The origin of this coordinate. The horizontial axis of the coordinate. Point to the right direction. The vertical axis of the coordinate. Point to the top direction. Plain geometry only contains straight sides. Calculate movement to center Current time tick A square Run all nodes repeatedly until it is instructed to terminate. Instructor to terminate all tasks. Returns if tasks should terminate Reset pipeline has risk, this operation is a direct operation to port in current node, the port on the other node cannot get the change. Init this form and render it on screen, and respond with operation Height of this form, represent in Width of this form, represent in Width of this form, represent in Resize the current form A (width,height) representing the new size of current form Set the size limit of current form Minimum size of current form. In form of a of (width,height) Maximum size of current form. In form of a of (width,height) Set the size limit of current form Minimum width of current form Minimum height of current form Maximum width of current form Maximum height of current form A microsecond-accuracy timer. It will refresh every a certain time span. Create a new and define the length of time span. Length of a single time span is defined in microseconds. Create a new and define the length of time span. Length of a single time span is defined in seconds. Create a new and define the length of time span. Length of a single time span is defined in microseconds. Time source provider provided in internal framework. The method this will call every time a new time span started. The COLORREF value is used to specify an RGB color. When specifying an explicit [RGB](/windows/desktop/api/Wingdi/nf-wingdi-rgb) color, the **COLORREF** value has the following hexadecimal form: `0x00bbggrr` The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF. To create a **COLORREF** color value, use the [RGB](/windows/desktop/api/Wingdi/nf-wingdi-rgb) macro. To extract the individual values for the red, green, and blue components of a color value, use the [**GetRValue**](/windows/desktop/api/Wingdi/nf-wingdi-getrvalue), [GetGValue](/windows/desktop/api/Wingdi/nf-wingdi-getgvalue), and [GetBValue](/windows/desktop/api/Wingdi/nf-wingdi-getbvalue) macros, respectively. Read more on docs.microsoft.com. A pointer to a null-terminated, constant, ANSI character string. A pointer to the first character in the string. The content should be considered readonly, as it was typed as constant in the SDK. Gets the number of characters up to the first null character (exclusive). Returns a with a copy of this character array, decoding as UTF-8. A , or if is . Returns a span of the characters in this string, up to the first null character (exclusive). A pointer to a null-terminated, constant character string. A pointer to the first character in the string. The content should be considered readonly, as it was typed as constant in the SDK. Gets the number of characters up to the first null character (exclusive). Returns a with a copy of this character array, up to the first null character (exclusive). A , or if is . Returns a span of the characters in this string, up to the first null character (exclusive). The RECT structure defines a rectangle by the coordinates of its upper-left and lower-right corners. The RECT structure is identical to the RECTL structure. Specifies the x-coordinate of the upper-left corner of the rectangle. Specifies the y-coordinate of the upper-left corner of the rectangle. Specifies the x-coordinate of the lower-right corner of the rectangle. Specifies the y-coordinate of the lower-right corner of the rectangle. Contains message information from a thread's message queue. Learn more about this API from docs.microsoft.com. Type: HWND A handle to the window whose window procedure receives the message. This member is NULL when the message is a thread message. Read more on docs.microsoft.com. Type: UINT The message identifier. Applications can only use the low word; the high word is reserved by the system. Read more on docs.microsoft.com. Type: WPARAM Additional information about the message. The exact meaning depends on the value of the message member. Read more on docs.microsoft.com. Type: LPARAM Additional information about the message. The exact meaning depends on the value of the message member. Read more on docs.microsoft.com. Type: DWORD The time at which the message was posted. Read more on docs.microsoft.com. Type: POINT The cursor position, in screen coordinates, when the message was posted. Read more on docs.microsoft.com. Contains the window class attributes that are registered by the RegisterClass function. (ANSI) > [!NOTE] > The winuser.h header defines WNDCLASS as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see [Conventions for Function Prototypes](/windows/win32/intl/conventions-for-function-prototypes). Read more on docs.microsoft.com. Type: UINT The class style(s). This member can be any combination of the Class Styles. Read more on docs.microsoft.com. Type: WNDPROC A pointer to the window procedure. You must use the CallWindowProc function to call the window procedure. For more information, see WindowProc. Read more on docs.microsoft.com. Type: int The number of extra bytes to allocate following the window-class structure. The system initializes the bytes to zero. Read more on docs.microsoft.com. Type: int The number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. If an application uses WNDCLASS to register a dialog box created by using the CLASS directive in the resource file, it must set this member to DLGWINDOWEXTRA. Read more on docs.microsoft.com. Type: HINSTANCE A handle to the instance that contains the window procedure for the class. Read more on docs.microsoft.com. Type: HICON A handle to the class icon. This member must be a handle to an icon resource. If this member is NULL, the system provides a default icon. Read more on docs.microsoft.com. Type: HCURSOR A handle to the class cursor. This member must be a handle to a cursor resource. If this member is NULL, an application must explicitly set the cursor shape whenever the mouse moves into the application's window. Read more on docs.microsoft.com. Type: HBRUSH A handle to the class background brush. This member can be a handle to the physical brush to be used for painting the background, or it can be a color value. A color value must be one of the following standard system colors (the value 1 must be added to the chosen color). If a color value is given, you must convert it to one of the following HBRUSH types: This doc was truncated. Read more on docs.microsoft.com. Type: LPCTSTR The resource name of the class menu, as the name appears in the resource file. If you use an integer to identify the menu, use the MAKEINTRESOURCE macro. If this member is NULL, windows belonging to this class have no default menu. Read more on docs.microsoft.com. Type: LPCTSTR A pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpszClassName; the high-order word must be zero. If lpszClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names. The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the RegisterClass function will fail. Read more on docs.microsoft.com. Contains the window class attributes that are registered by the RegisterClass function. (Unicode) > [!NOTE] > The winuser.h header defines WNDCLASS as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see [Conventions for Function Prototypes](/windows/win32/intl/conventions-for-function-prototypes). Read more on docs.microsoft.com. Type: UINT The class style(s). This member can be any combination of the Class Styles. Read more on docs.microsoft.com. Type: WNDPROC A pointer to the window procedure. You must use the CallWindowProc function to call the window procedure. For more information, see WindowProc. Read more on docs.microsoft.com. Type: int The number of extra bytes to allocate following the window-class structure. The system initializes the bytes to zero. Read more on docs.microsoft.com. Type: int The number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. If an application uses WNDCLASS to register a dialog box created by using the CLASS directive in the resource file, it must set this member to DLGWINDOWEXTRA. Read more on docs.microsoft.com. Type: HINSTANCE A handle to the instance that contains the window procedure for the class. Read more on docs.microsoft.com. Type: HICON A handle to the class icon. This member must be a handle to an icon resource. If this member is NULL, the system provides a default icon. Read more on docs.microsoft.com. Type: HCURSOR A handle to the class cursor. This member must be a handle to a cursor resource. If this member is NULL, an application must explicitly set the cursor shape whenever the mouse moves into the application's window. Read more on docs.microsoft.com. Type: HBRUSH A handle to the class background brush. This member can be a handle to the physical brush to be used for painting the background, or it can be a color value. A color value must be one of the following standard system colors (the value 1 must be added to the chosen color). If a color value is given, you must convert it to one of the following HBRUSH types: This doc was truncated. Read more on docs.microsoft.com. Type: LPCTSTR The resource name of the class menu, as the name appears in the resource file. If you use an integer to identify the menu, use the MAKEINTRESOURCE macro. If this member is NULL, windows belonging to this class have no default menu. Read more on docs.microsoft.com. Type: LPCTSTR A pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpszClassName; the high-order word must be zero. If lpszClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names. The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the RegisterClass function will fail. Read more on docs.microsoft.com. Represents a Win32 handle that can be closed with . Represents a Win32 handle that can be closed with . The GLYPHMETRICSFLOAT structure contains information about the placement and orientation of a glyph in a character cell. The values of GLYPHMETRICSFLOAT are specified as notional units. Specifies the width of the smallest rectangle (the glyph's black box) that completely encloses the glyph. Specifies the height of the smallest rectangle (the glyph's black box) that completely encloses the glyph. Specifies the x and y coordinates of the upper-left corner of the smallest rectangle that completely encloses the glyph. Specifies the horizontal distance from the origin of the current character cell to the origin of the next character cell. Specifies the vertical distance from the origin of the current character cell to the origin of the next character cell. The LAYERPLANEDESCRIPTOR structure describes the pixel format of a drawing surface. Please notice, as documented above, that certain layer plane properties are not supported in the current implementation. The implementation is the Microsoft GDI software implementation of OpenGL. Hardware manufacturers that enhance parts of OpenGL may support some layer plane properties not supported by the generic implementation. Specifies the size of this data structure. Set this value to sizeof(LAYERPLANEDESCRIPTOR). Specifies the version of this data structure. Set this value to 1. A set of bit flags that specify properties of the layer plane. The properties are generally not mutually exclusive; any combination of bit flags can be set, with the exceptions noted. The following bit flag constants are defined. This doc was truncated. Read more on docs.microsoft.com. Specifies the type of pixel data. The following types are defined. This doc was truncated. Read more on docs.microsoft.com. Specifies the number of color bitplanes in each color buffer. For RGBA pixel types, it is the size of the color buffer, excluding the alpha bitplanes. For color-index pixels, it is the size of the color-index buffer. Specifies the number of red bitplanes in each RGBA color buffer. Specifies the shift count for red bitplanes in each RGBA color buffer. Specifies the number of green bitplanes in each RGBA color buffer. Specifies the shift count for green bitplanes in each RGBA color buffer. Specifies the number of blue bitplanes in each RGBA color buffer. Specifies the shift count for blue bitplanes in each RGBA color buffer. Specifies the number of alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported. Specifies the shift count for alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported. Specifies the total number of bitplanes in the accumulation buffer. Specifies the number of red bitplanes in the accumulation buffer. Specifies the number of green bitplanes in the accumulation buffer. Specifies the number of blue bitplanes in the accumulation buffer. Specifies the number of alpha bitplanes in the accumulation buffer. Specifies the depth of the depth (z-axis) buffer. Specifies the depth of the stencil buffer. Specifies the number of auxiliary buffers. Auxiliary buffers are not supported. Not used. Must be zero. When the LPD_TRANSPARENT flag is set, specifies the transparent color or index value. Typically the value is zero. The PIXELFORMATDESCRIPTOR structure describes the pixel format of a drawing surface. Please notice carefully, as documented above, that certain pixel format properties are not supported in the current generic implementation. The generic implementation is the Microsoft GDI software implementation of OpenGL. Hardware manufacturers may enhance parts of OpenGL, and may support some pixel format properties not supported by the generic implementation. Specifies the size of this data structure. This value should be set to sizeof(PIXELFORMATDESCRIPTOR). Specifies the version of this data structure. This value should be set to 1. A set of bit flags that specify properties of the pixel buffer. The properties are generally not mutually exclusive; you can set any combination of bit flags, with the exceptions noted. The following bit flag constants are defined. This doc was truncated. Read more on docs.microsoft.com. Specifies the type of pixel data. The following types are defined. This doc was truncated. Read more on docs.microsoft.com. Specifies the number of color bitplanes in each color buffer. For RGBA pixel types, it is the size of the color buffer, excluding the alpha bitplanes. For color-index pixels, it is the size of the color-index buffer. Specifies the number of red bitplanes in each RGBA color buffer. Specifies the shift count for red bitplanes in each RGBA color buffer. Specifies the number of green bitplanes in each RGBA color buffer. Specifies the shift count for green bitplanes in each RGBA color buffer. Specifies the number of blue bitplanes in each RGBA color buffer. Specifies the shift count for blue bitplanes in each RGBA color buffer. Specifies the number of alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported. Specifies the shift count for alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported. Specifies the total number of bitplanes in the accumulation buffer. Specifies the number of red bitplanes in the accumulation buffer. Specifies the number of green bitplanes in the accumulation buffer. Specifies the number of blue bitplanes in the accumulation buffer. Specifies the number of alpha bitplanes in the accumulation buffer. Specifies the depth of the depth (z-axis) buffer. Specifies the depth of the stencil buffer. Specifies the number of auxiliary buffers. Auxiliary buffers are not supported. Specifies the number of overlay and underlay planes. Bits 0 through 3 specify up to 15 overlay planes and bits 4 through 7 specify up to 15 underlay planes. Ignored. Earlier implementations of OpenGL used this member, but it is no longer used. Specifies the transparent color or index of an underlay plane. When the pixel type is RGBA, dwVisibleMask is a transparent RGB color value. When the pixel type is color index, it is a transparent index value. Ignored. Earlier implementations of OpenGL used this member, but it is no longer used. The POINTFLOAT structure contains the x and y coordinates of a point. Learn more about this API from docs.microsoft.com. Specifies the horizontal (x) coordinate of a point. Specifies the vertical (y) coordinate of a point. Contains extern methods from "GDI32.dll". Contains extern methods from "KERNEL32.dll". Contains extern methods from "OPENGL32.dll". Contains extern methods from "USER32.dll". The DeleteObject function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid. A handle to a logical pen, brush, font, bitmap, region, or palette. If the function succeeds, the return value is nonzero. If the specified handle is not valid or is currently selected into a DC, the return value is zero. Do not delete a drawing object (pen or brush) while it is still selected into a DC. When a pattern brush is deleted, the bitmap associated with the brush is not deleted. The bitmap must be deleted independently. Read more on docs.microsoft.com. The ChoosePixelFormat function attempts to match an appropriate pixel format supported by a device context to a given pixel format specification. Specifies the device context that the function examines to determine the best match for the pixel format descriptor pointed to by ppfd. Pointer to a PIXELFORMATDESCRIPTOR structure that specifies the requested pixel format. In this context, the members of the PIXELFORMATDESCRIPTOR structure that ppfd points to are used as follows: This doc was truncated. Read more on docs.microsoft.com. If the function succeeds, the return value is a pixel format index (one-based) that is the closest match to the given pixel format descriptor. If the function fails, the return value is zero. To get extended error information, call GetLastError. You must ensure that the pixel format matched by the ChoosePixelFormat function satisfies your requirements. For example, if you request a pixel format with a 24-bit RGB color buffer but the device context offers only 8-bit RGB color buffers, the function returns a pixel format with an 8-bit RGB color buffer. The DescribePixelFormat function obtains information about the pixel format identified by iPixelFormat of the device associated with hdc. The function sets the members of the PIXELFORMATDESCRIPTOR structure pointed to by ppfd with that pixel format data. Specifies the device context. Index that specifies the pixel format. The pixel formats that a device context supports are identified by positive one-based integer indexes. The size, in bytes, of the structure pointed to by ppfd. The DescribePixelFormat function stores no more than nBytes bytes of data to that structure. Set this value to sizeof(PIXELFORMATDESCRIPTOR). Pointer to a PIXELFORMATDESCRIPTOR structure whose members the function sets with pixel format data. The function stores the number of bytes copied to the structure in the structure's nSize member. If, upon entry, ppfd is NULL, the function writes no data to the structure. This is useful when you only want to obtain the maximum pixel format index of a device context. If the function succeeds, the return value is the maximum pixel format index of the device context. In addition, the function sets the members of the PIXELFORMATDESCRIPTOR structure pointed to by ppfd according to the specified pixel format. If the function fails, the return value is zero. To get extended error information, call GetLastError. Learn more about this API from docs.microsoft.com. The DeleteEnhMetaFile function deletes an enhanced-format metafile or an enhanced-format metafile handle. A handle to an enhanced metafile. If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. If the hemf parameter identifies an enhanced metafile stored in memory, the DeleteEnhMetaFile function deletes the metafile. If hemf identifies a metafile stored on a disk, the function deletes the metafile handle but does not destroy the actual metafile. An application can retrieve the file by calling the GetEnhMetaFile function. The GetEnhMetaFilePixelFormat function retrieves pixel format information for an enhanced metafile. Identifies the enhanced metafile. Specifies the size, in bytes, of the buffer into which the pixel format information is copied. Pointer to a PIXELFORMATDESCRIPTOR structure that contains the logical pixel format specification. The metafile uses this structure to record the logical pixel format specification. If the function succeeds and finds a pixel format, the return value is the size of the metafile's pixel format. If no pixel format is present, the return value is zero. If an error occurs and the function fails, the return value is GDI_ERROR. To get extended error information, call GetLastError. When an enhanced metafile specifies a pixel format in its ENHMETAHEADER structure and the pixel format fits in the buffer, the pixel format information is copied into ppfd. When cbBuffer is too small to contain the pixel format of the metafile, the pixel format is not copied to the buffer. In either case, the function returns the size of the metafile's pixel format. For information on metafile recording and other operations, see Enhanced Metafile Operations. Read more on docs.microsoft.com. The GetPixelFormat function obtains the index of the currently selected pixel format of the specified device context. Specifies the device context of the currently selected pixel format index returned by the function. If the function succeeds, the return value is the currently selected pixel format index of the specified device context. This is a positive, one-based index value. If the function fails, the return value is zero. To get extended error information, call GetLastError. Learn more about this API from docs.microsoft.com. The SetPixelFormat function sets the pixel format of the specified device context to the format specified by the iPixelFormat index. Specifies the device context whose pixel format the function attempts to set. Index that identifies the pixel format to set. The various pixel formats supported by a device context are identified by one-based indexes. Pointer to a PIXELFORMATDESCRIPTOR structure that contains the logical pixel format specification. The system's metafile component uses this structure to record the logical pixel format specification. The structure has no other effect upon the behavior of the SetPixelFormat function. If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError. If hdc references a window, calling the SetPixelFormat function also changes the pixel format of the window. Setting the pixel format of a window more than once can lead to significant complications for the Window Manager and for multithread applications, so it is not allowed. An application can only set the pixel format of a window one time. Once a window's pixel format is set, it cannot be changed. You should select a pixel format in the device context before calling the wglCreateContext function. The wglCreateContext function creates a rendering context for drawing on the device in the selected pixel format of the device context. An OpenGL window has its own pixel format. Because of this, only device contexts retrieved for the client area of an OpenGL window are allowed to draw into the window. As a result, an OpenGL window should be created with the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles. Additionally, the window class attribute should not include the CS_PARENTDC style. Read more on docs.microsoft.com. The SwapBuffers function exchanges the front and back buffers if the current pixel format for the window referenced by the specified device context includes a back buffer. If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError. If the current pixel format for the window referenced by the device context does not include a back buffer, this call has no effect and the content of the back buffer is undefined when the function returns. With multithread applications, flush the drawing commands in any other threads drawing to the same window before calling SwapBuffers. Read more on docs.microsoft.com. Closes an open object handle. A valid handle to an open object. 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. If the application is running under a debugger, the function will throw an exception if it receives either a handle value that is not valid or a pseudo-handle value. This can happen if you close a handle twice, or if you call CloseHandle on a handle returned by the FindFirstFile function instead of calling the FindClose function. The CloseHandle function closes handles to the following objects: This doc was truncated. Read more on docs.microsoft.com. Frees the loaded dynamic-link library (DLL) module and, if necessary, decrements its reference count. A handle to the loaded library module. The LoadLibrary, LoadLibraryEx, GetModuleHandle, or GetModuleHandleEx function returns this handle. Read more on docs.microsoft.com. If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call the GetLastError function. The system maintains a per-process reference count for each loaded module. A module that was loaded at process initialization due to load-time dynamic linking has a reference count of one. The reference count for a module is incremented each time the module is loaded by a call to LoadLibrary. The reference count is also incremented by a call to LoadLibraryEx unless the module is being loaded for the first time and is being loaded as a data or image file. The reference count is decremented each time the FreeLibrary or FreeLibraryAndExitThread function is called for the module. When a module's reference count reaches zero or the process terminates, the system unloads the module from the address space of the process. Before unloading a library module, the system enables the module to detach from the process by calling the module's DllMain function, if it has one, with the DLL_PROCESS_DETACH value. Doing so gives the library module an opportunity to clean up resources allocated on behalf of the current process. After the entry-point function returns, the library module is removed from the address space of the current process. It is not safe to call FreeLibrary from DllMain. For more information, see the Remarks section in DllMain. Calling FreeLibrary does not affect other processes that are using the same module. Use caution when calling FreeLibrary with a handle returned by GetModuleHandle. The GetModuleHandle function does not increment a module's reference count, so passing this handle to FreeLibrary can cause a module to be unloaded prematurely. A thread that must unload the DLL in which it is executing and then terminate itself should call FreeLibraryAndExitThread instead of calling FreeLibrary and ExitThread separately. Otherwise, a race condition can occur. For details, see the Remarks section of FreeLibraryAndExitThread. Read more on docs.microsoft.com. Retrieves a module handle for the specified module. The module must have been loaded by the calling process. (Unicode) The name of the loaded module (either a .dll or .exe file). If the file name extension is omitted, the default library extension .dll is appended. The file name string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process. If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file). The GetModuleHandle function does not retrieve handles for modules that were loaded using the LOAD_LIBRARY_AS_DATAFILE flag. For more information, see LoadLibraryEx. Read more on docs.microsoft.com. If the function succeeds, the return value is a handle to the specified module. If the function fails, the return value is NULL. To get extended error information, call GetLastError. The returned handle is not global or inheritable. It cannot be duplicated or used by another process. If lpModuleName does not include a path and there is more than one loaded module with the same base name and extension, you cannot predict which module handle will be returned. To work around this problem, you could specify a path, use side-by-side assemblies, or use GetModuleHandleEx to specify a memory location rather than a DLL name. The GetModuleHandle function returns a handle to a mapped module without incrementing its reference count. However, if this handle is passed to the FreeLibrary function, the reference count of the mapped module will be decremented. Therefore, do not pass a handle returned by GetModuleHandle to the FreeLibrary function. Doing so can cause a DLL module to be unmapped prematurely. This function must be used carefully in a multithreaded application. There is no guarantee that the module handle remains valid between the time this function returns the handle and the time it is used. For example, suppose that a thread retrieves a module handle, but before it uses the handle, a second thread frees the module. If the system loads another module, it could reuse the module handle that was recently freed. Therefore, the first thread would have a handle to a different module than the one intended. Read more on docs.microsoft.com. Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL). A handle to the DLL module that contains the function or variable. The LoadLibrary, LoadLibraryEx, LoadPackagedLibrary, or GetModuleHandle function returns this handle. The GetProcAddress function does not retrieve addresses from modules that were loaded using the LOAD_LIBRARY_AS_DATAFILE flag. For more information, see LoadLibraryEx. Read more on docs.microsoft.com. The function or variable name, or the function's ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero. If the function succeeds, the return value is the address of the exported function or variable. If the function fails, the return value is NULL. To get extended error information, call GetLastError. The spelling and case of a function name pointed to by lpProcName must be identical to that in the EXPORTS statement of the source DLL's module-definition (.def) file. The exported names of functions may differ from the names you use when calling these functions in your code. This difference is hidden by macros used in the SDK header files. For more information, see Conventions for Function Prototypes. The lpProcName parameter can identify the DLL function by specifying an ordinal value associated with the function in the EXPORTS statement. GetProcAddress verifies that the specified ordinal is in the range 1 through the highest ordinal value exported in the .def file. The function then uses the ordinal as an index to read the function's address from a function table. If the .def file does not number the functions consecutively from 1 to N (where N is the number of exported functions), an error can occur where GetProcAddress returns an invalid, non-NULL address, even though there is no function with the specified ordinal. If the function might not exist in the DLL module—for example, if the function is available only on Windows Vista but the application might be running on Windows XP—specify the function by name rather than by ordinal value and design your application to handle the case when the function is not available, as shown in the following code fragment. This doc was truncated. Read more on docs.microsoft.com. Loads the specified module into the address space of the calling process. (LoadLibraryW) The name of the module. This can be either a library module (a .dll file) or an executable module (an .exe file). If the specified module is an executable module, static imports are not loaded; instead, the module is loaded as if by LoadLibraryEx with the `DONT_RESOLVE_DLL_REFERENCES` flag. The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file. If the string specifies a full path, the function searches only that path for the module. If the string specifies a relative path or a module name without a path, the function uses a standard search strategy to find the module; for more information, see the Remarks. If the function cannot find the module, the function fails. When specifying a path, be sure to use backslashes (\\), not forward slashes (/). For more information about paths, see Naming a File or Directory. If the string specifies a module name without a path and the file name extension is omitted, the function appends the default library extension ".DLL" to the module name. To prevent the function from appending ".DLL" to the module name, include a trailing point character (.) in the module name string. Read more on docs.microsoft.com. If the function succeeds, the return value is a handle to the module. If the function fails, the return value is NULL. To get extended error information, call GetLastError. To enable or disable error messages displayed by the loader during DLL loads, use the SetErrorMode function. LoadLibrary can be used to load a library module into the address space of the process and return a handle that can be used in GetProcAddress to get the address of a DLL function. LoadLibrary can also be used to load other executable modules. For example, the function can specify an .exe file to get a handle that can be used in FindResource or LoadResource. However, do not use LoadLibrary to run an .exe file. Instead, use the CreateProcess function. If the specified module is a DLL that is not already loaded for the calling process, the system calls the DLL's DllMain function with the DLL_PROCESS_ATTACH value. If DllMain returns TRUE, LoadLibrary returns a handle to the module. If DllMain returns FALSE, the system unloads the DLL from the process address space and LoadLibrary returns NULL. It is not safe to call LoadLibrary from DllMain. For more information, see the Remarks section in DllMain. Module handles are not global or inheritable. A call to LoadLibrary by one process does not produce a handle that another process can use — for example, in calling GetProcAddress. The other process must make its own call to LoadLibrary for the module before calling GetProcAddress. If lpFileName does not include a path and there is more than one loaded module with the same base name and extension, the function returns a handle to the module that was loaded first. If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended. However, the file name string can include a trailing point character (.) to indicate that the module name has no extension. When no path is specified, the function searches for loaded modules whose base name matches the base name of the module to be loaded. If the name matches, the load succeeds. Otherwise, the function searches for the file. The first directory searched is the directory containing the image file used to create the calling process (for more information, see the CreateProcess function). Doing this allows private dynamic-link library (DLL) files associated with a process to be found without adding the process's installed directory to the PATH environment variable. If a relative path is specified, the entire relative path is appended to every token in the DLL search path list. To load a module from a relative path without searching any other path, use GetFullPathName to get a nonrelative path and call LoadLibrary with the nonrelative path. For more information on the DLL search order, see Dynamic-Link Library Search Order. The search path can be altered using the SetDllDirectory function. This solution is recommended instead of using SetCurrentDirectory or hard-coding the full path to the DLL. If a path is specified and there is a redirection file for the application, the function searches for the module in the application's directory. If the module exists in the application's directory, LoadLibrary ignores the specified path and loads the module from the application's directory. If the module does not exist in the application's directory, LoadLibrary loads the module from the specified directory. For more information, see Dynamic Link Library Redirection. If you call LoadLibrary with the name of an assembly without a path specification and the assembly is listed in the system compatible manifest, the call is automatically redirected to the side-by-side assembly. The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count. Calling the FreeLibrary or FreeLibraryAndExitThread function decrements the reference count. The system unloads a module when its reference count reaches zero or when the process terminates (regardless of the reference count). Windows Server 2003 and Windows XP:  The Visual C++ compiler supports a syntax that enables you to declare thread-local variables: _declspec(thread). If you use this syntax in a DLL, you will not be able to load the DLL explicitly using LoadLibrary on versions of Windows prior to Windows Vista. If your DLL will be loaded explicitly, you must use the thread local storage functions instead of _declspec(thread). For an example, see Using Thread Local Storage in a Dynamic Link Library.

Security Remarks

Do not use the SearchPath function to retrieve a path to a DLL for a subsequent LoadLibrary call. The SearchPath function uses a different search order than LoadLibrary and it does not use safe process search mode unless this is explicitly enabled by calling SetSearchPathMode with BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE. Therefore, SearchPath is likely to first search the user’s current working directory for the specified DLL. If an attacker has copied a malicious version of a DLL into the current working directory, the path retrieved by SearchPath will point to the malicious DLL, which LoadLibrary will then load. Do not make assumptions about the operating system version based on a LoadLibrary call that searches for a DLL. If the application is running in an environment where the DLL is legitimately not present but a malicious version of the DLL is in the search path, the malicious version of the DLL may be loaded. Instead, use the recommended techniques described in Getting the System Version.
Read more on docs.microsoft.com.
The wglGetProcAddress function returns the address of an OpenGL extension function for use with the current OpenGL rendering context. When the function succeeds, the return value is the address of the extension function. When no current rendering context exists or the function fails, the return value is NULL. To get extended error information, call GetLastError. The OpenGL library supports multiple implementations of its functions. Extension functions supported in one rendering context are not necessarily available in a separate rendering context. Thus, for a given rendering context in an application, use the function addresses returned by the wglGetProcAddress function only. The spelling and the case of the extension function pointed to by lpszProc must be identical to that of a function supported and implemented by OpenGL. Because extension functions are not exported by OpenGL, you must use wglGetProcAddress to get the addresses of vendor-specific extension functions. The extension function addresses are unique for each pixel format. All rendering contexts of a given pixel format share the same extension function addresses. Read more on docs.microsoft.com. The wglDeleteContext function deletes a specified OpenGL rendering context. If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError. It is an error to delete an OpenGL rendering context that is the current context of another thread. However, if a rendering context is the calling thread's current context, the wglDeleteContext function changes the rendering context to being not current before deleting it. The wglDeleteContext function does not delete the device context associated with the OpenGL rendering context when you call the wglMakeCurrent function. After calling wglDeleteContext, you must call DeleteDC to delete the associated device context. Read more on docs.microsoft.com. The wglCreateContext function creates a new OpenGL rendering context, which is suitable for drawing on the device referenced by hdc. The rendering context has the same pixel format as the device context. If the function succeeds, the return value is a valid handle to an OpenGL rendering context. If the function fails, the return value is NULL. To get extended error information, call GetLastError. A rendering context is not the same as a device context. Set the pixel format of the device context before creating a rendering context. For more information on setting the device context's pixel format, see the SetPixelFormat function. To use OpenGL, you create a rendering context, select it as a thread's current rendering context, and then call OpenGL functions. When you are finished with the rendering context, you dispose of it by calling the wglDeleteContext function. The following code example shows wglCreateContext usage. This doc was truncated. Read more on docs.microsoft.com. The wglCreateLayerContext function creates a new OpenGL rendering context for drawing to a specified layer plane on a device context. If the function succeeds, the return value is a handle to an OpenGL rendering context. If the function fails, the return value is NULL. To get extended error information, call GetLastError. A rendering context is a port through which all OpenGL commands pass. Every thread that makes OpenGL calls must have one current, active rendering context. A rendering context is not the same as a device context; a rendering context contains information specific to OpenGL, while a device context contains information specific to GDI. Before you create a rendering context, set the pixel format of the device context with the SetPixelFormat function. You can use a rendering context in a specified layer plane of a window with identical pixel formats only. With OpenGL applications that use multiple threads, you create a rendering context, select it as the current rendering context of a thread, and make OpenGL calls for the specified thread. When you are finished with the rendering context of the thread, call the wglDeleteContext function. Read more on docs.microsoft.com. The wglCopyContext function copies selected groups of rendering states from one OpenGL rendering context to another. If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError. Using the wglCopyContext function, you can synchronize the rendering state of two rendering contexts. You can only copy the rendering state between two rendering contexts within the same process. The rendering contexts must be from the same OpenGL implementation. For example, you can always copy a rendering state between two rendering contexts with identical pixel format in the same process. You can copy the same state information available only with the glPushAttrib function. You cannot copy some state information, such as pixel pack/unpack state, render mode state, select state, and feedback state. When you call wglCopyContext, make sure that the destination rendering context, hglrcDst, is not current to any thread. Read more on docs.microsoft.com. The wglDescribeLayerPlane function obtains information about the layer planes of a given pixel format. If the function succeeds, the return value is TRUE. In addition, the wglDescribeLayerPlane function sets the members of the LAYERPLANEDESCRIPTOR structure pointed to by plpd according to the specified layer plane (iLayerPlane ) of the specified pixel format (iPixelFormat ). If the function fails, the return value is FALSE. The numbering of planes (iLayerPlane ) determines their order. Higher-numbered planes overlay lower-numbered planes. The wglGetCurrentContext function obtains a handle to the current OpenGL rendering context of the calling thread. If the calling thread has a current OpenGL rendering context, wglGetCurrentContext returns a handle to that rendering context. Otherwise, the return value is NULL. The current OpenGL rendering context of a thread is associated with a device context by means of the wglMakeCurrent function. You can use the wglGetCurrentDC function to obtain a handle to the device context associated with the current OpenGL rendering context. The wglGetCurrentDC function obtains a handle to the device context that is associated with the current OpenGL rendering context of the calling thread. If the calling thread has a current OpenGL rendering context, the function returns a handle to the device context associated with that rendering context by means of the wglMakeCurrent function. Otherwise, the return value is NULL. You associate a device context with an OpenGL rendering context when it calls the wglMakeCurrent function. You can use the wglGetCurrentContext function to obtain a handle to the calling thread's current OpenGL rendering context. Retrieves the palette entries from a given color-index layer plane for a specified device context. Type: int If the function succeeds, the return value is the number of entries that were set in the palette in the specified layer plane of the window. If the function fails or when no pixel format is selected, the return value is zero. To get extended error information, call GetLastError. Each color-index layer plane in a window has a palette with a size 2^n, where n is the number of bit planes in the layer plane. You cannot modify the transparent index of a palette. Use the wglRealizeLayerPalette function to realize the layer palette. Initially the layer palette contains only entries for white. Read more on docs.microsoft.com. The wglMakeCurrent function makes a specified OpenGL rendering context the calling thread's current rendering context. When the wglMakeCurrent function succeeds, the return value is TRUE; otherwise the return value is FALSE. To get extended error information, call GetLastError. The hdc parameter must refer to a drawing surface supported by OpenGL. It need not be the same hdc that was passed to wglCreateContext when hglrc was created, but it must be on the same device and have the same pixel format. GDI transformation and clipping in hdc are not supported by the rendering context. The current rendering context uses the hdc device context until the rendering context is no longer current. Before switching to the new rendering context, OpenGL flushes any previous rendering context that was current to the calling thread. A thread can have one current rendering context. A process can have multiple rendering contexts by means of multithreading. A thread must set a current rendering context before calling any OpenGL functions. Otherwise, all OpenGL calls are ignored. A rendering context can be current to only one thread at a time. You cannot make a rendering context current to multiple threads. An application can perform multithread drawing by making different rendering contexts current to different threads, supplying each thread with its own rendering context and device context. If an error occurs, the wglMakeCurrent function makes the thread's current rendering context not current before returning. Read more on docs.microsoft.com. The wglRealizeLayerPalette function maps palette entries from a given color-index layer plane into the physical palette or initializes the palette of an RGBA layer plane. If the function succeeds, the return value is TRUE, even if bRealize is TRUE and the physical palette is not available. If the function fails or when no pixel format is selected, the return value is FALSE. To get extended error information, call GetLastError. The physical palette for a layer plane is a shared resource among windows with layer planes. When more than one window attempts to realize a palette for a given physical layer plane, only one palette at a time is realized. When you call the wglRealizeLayerPalette function, the layer palette of a foreground window is always realized first. When a window's layer palette is realized, its palette entries are always mapped one-to-one into the physical palette. Unlike GDI logical palettes, with wglRealizeLayerPalette there is no mapping of other windows' layer palettes to the current physical palette. Whenever a window becomes the foreground window, call wglRealizeLayerPalette to realize its layer palettes again, even if the pixel type of the layer plane is RGBA. Because wglRealizeLayerPalette doesn't realize the palette of the main plane, use GDI palette functions to realize the main plane palette. Read more on docs.microsoft.com. Sets the palette entries in a given color-index layer plane for a specified device context. Type: int If the function succeeds, the return value is the number of entries that were set in the palette in the specified layer plane of the window. If the function fails or no pixel format is selected, the return value is zero. To get extended error information, call GetLastError. Each color-index plane in a window has a palette with a size 2^n, where n is the number of bit planes in the layer plane. You cannot modify the transparent index of a palette. Use the wglRealizeLayerPalette function to realize the layer palette. Initially the layer palette contains only entries for white. The wglSetLayerPaletteEntries function doesn't set the palette entries of the main plane palette. To update the main plane palette, use GDI palette functions. Read more on docs.microsoft.com. The wglShareLists function enables multiple OpenGL rendering contexts to share a single display-list space. When the function succeeds, the return value is TRUE. When the function fails, the return value is FALSE and the display lists are not shared. To get extended error information, call GetLastError. When you create an OpenGL rendering context, it has its own display-list space. The wglShareLists function enables a rendering context to share the display-list space of another rendering context; any number of rendering contexts can share a single display-list space. Once a rendering context shares a display-list space, the rendering context always uses the display-list space until the rendering context is deleted. When the last rendering context of a shared display-list space is deleted, the shared display-list space is deleted. All the indexes and definitions of display lists in a shared display-list space are shared. You can only share display lists with rendering contexts within the same process. However, not all rendering contexts in a process can share display lists. Rendering contexts can share display lists only if they use the same implementation of OpenGL functions. All client rendering contexts of a given pixel format can always share display lists. All rendering contexts of a shared display list must use an identical pixel format. Otherwise the results depend on the implementation of OpenGL used.
Note  The wglShareLists function is only available with OpenGL version 1.01 or later. To determine the version number of the implementation of OpenGL, call glGetString.
 
Read more on docs.microsoft.com.
The wglSwapLayerBuffers function swaps the front and back buffers in the overlay, underlay, and main planes of the window referenced by a specified device context. If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError. When a layer plane doesn't include a back buffer, calling the wglSwapLayerBuffers function has no effect on that layer plane. After you call wglSwapLayerBuffers, the state of the back buffer content is given in the corresponding LAYERPLANEDESCRIPTOR structure of the layer plane or in the PIXELFORMATDESCRIPTOR structure of the main plane. The wglSwapLayerBuffers function swaps the front and back buffers in the specified layer planes simultaneously. Some devices don't support swapping layer planes individually; they swap all layer planes as a group. When the PFD_SWAP_LAYER_BUFFERS flag of the PIXELFORMATDESCRIPTOR structure is set, it indicates that a device can swap individual layer planes and that you can call wglSwapLayerBuffers. With applications that use multiple threads, before calling wglSwapLayerBuffers, clear all drawing commands in all threads drawing to the same window. Read more on docs.microsoft.com. The wglUseFontBitmaps function creates a set of bitmap display lists for use in the current OpenGL rendering context. (Unicode) If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError. The wglUseFontBitmaps function defines count display lists in the current OpenGL rendering context. Each display list has an identifying number, starting at listBase. Each display list consists of a single call to glBitmap. The definition of bitmap listBase + i is taken from the glyph first + i of the font currently selected in the device context specified by hdc. If a glyph is not defined, then the function defines an empty display list for it. The wglUseFontBitmaps function creates bitmap text in the plane of the screen. It enables the labeling of objects in OpenGL. In the current version of Microsoft's implementation of OpenGL, you cannot make GDI calls to a device context that has a double-buffered pixel format. Therefore, you cannot use the GDI fonts and text functions with such device contexts. You can use the wglUseFontBitmaps function to circumvent this limitation and draw text in a double-buffered device context. The function determines the parameters of each call to glBitmap as follows. This doc was truncated. Read more on docs.microsoft.com. The wglUseFontOutlines function creates a set of display lists, one for each glyph of the currently selected outline font of a device context, for use with the current rendering context. (Unicode) When the function succeeds, the return value is TRUE. When the function fails, the return value is FALSE and no display lists are generated. To get extended error information, call GetLastError. The wglUseFontOutlines function defines the glyphs of an outline font with display lists in the current rendering context. The wglUseFontOutlines function works with TrueType fonts only; stroke and raster fonts are not supported. Each display list consists of either line segments or polygons, and has a unique identifying number starting with the listBase number. The wglUseFontOutlines function approximates glyph outlines by subdividing the quadratic B-spline curves of the outline into line segments, until the distance between the outline and the interpolated midpoint is within the value specified by deviation. This is the final format used when format is WGL_FONT_LINES. When you specify WGL_FONT_OUTLINES, the display lists created don't contain any normals; thus lighting doesn't work properly. To get the correct lighting of lines use WGL_FONT_POLYGONS and set glPolygonMode( GL_FRONT, GL_LINE ). When you specify format as WGL_FONT_POLYGONS the outlines are further tessellated into separate triangles, triangle fans, triangle strips, or quadrilateral strips to create the surface of each glyph. With WGL_FONT_POLYGONS, the created display lists call glFrontFace( GL_CW ) or glFrontFace( GL_CCW ); thus the current front-face value might be altered. For the best appearance of text with WGL_FONT_POLYGONS, cull the back faces as follows: This doc was truncated. Read more on docs.microsoft.com. Destroys an icon and frees any memory the icon occupied. Type: HICON A handle to the icon to be destroyed. The icon must not be in use. Read more on docs.microsoft.com. Type: BOOL 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. It is only necessary to call DestroyIcon for icons and cursors created with the following functions: CreateIconFromResourceEx (if called without the LR_SHARED flag), CreateIconIndirect, and CopyIcon. Do not use this function to destroy a shared icon. A shared icon is valid as long as the module from which it was loaded remains in memory. The following functions obtain a shared icon. This doc was truncated. Read more on docs.microsoft.com. Destroys a cursor and frees any memory the cursor occupied. Do not use this function to destroy a shared cursor. Type: HCURSOR A handle to the cursor to be destroyed. The cursor must not be in use. Read more on docs.microsoft.com. Type: BOOL 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. The DestroyCursor function destroys a nonshared cursor. Do not use this function to destroy a shared cursor. A shared cursor is valid as long as the module from which it was loaded remains in memory. The following functions obtain a shared cursor: This doc was truncated. Read more on docs.microsoft.com. Calculates the required size of the window rectangle, based on the desired client-rectangle size. The window rectangle can then be passed to the CreateWindow function to create a window whose client area is the desired size. Type: LPRECT A pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area. Read more on docs.microsoft.com. Type: DWORD The window style of the window whose required size is to be calculated. Note that you cannot specify the WS_OVERLAPPED style. Read more on docs.microsoft.com. Type: BOOL Indicates whether the window has a menu. Read more on docs.microsoft.com. Type: BOOL 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. A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window, which includes the client area and the nonclient area. The AdjustWindowRect function does not add extra space when a menu bar wraps to two or more rows. The AdjustWindowRect function does not take the WS_VSCROLL or WS_HSCROLL styles into account. To account for the scroll bars, call the GetSystemMetrics function with SM_CXVSCROLL or SM_CYHSCROLL. Read more on docs.microsoft.com. Destroys the specified menu and frees any memory that the menu occupies. Type: HMENU A handle to the menu to be destroyed. Read more on docs.microsoft.com. Type: BOOL 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. Before closing, an application must use the DestroyMenu function to destroy a menu not assigned to a window. A menu that is assigned to a window is automatically destroyed when the application closes. DestroyMenu is recursive, that is, it will destroy the menu and all its submenus. Read more on docs.microsoft.com. Creates an overlapped, pop-up, or child window with an extended window style; otherwise, this function is identical to the CreateWindow function. (Unicode) Type: DWORD The extended window style of the window being created. For a list of possible values, see Extended Window Styles. Read more on docs.microsoft.com. Type: LPCTSTR A null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, provided that the module that registers the class is also the module that creates the window. The class name can also be any of the predefined system class names. Read more on docs.microsoft.com. Type: LPCTSTR The window name. If the window style specifies a title bar, the window title pointed to by lpWindowName is displayed in the title bar. When using CreateWindow to create controls, such as buttons, check boxes, and static controls, use lpWindowName to specify the text of the control. When creating a static control with the SS_ICON style, use lpWindowName to specify the icon name or identifier. To specify an identifier, use the syntax "#num". Read more on docs.microsoft.com. Type: DWORD The style of the window being created. This parameter can be a combination of the window style values, plus the control styles indicated in the Remarks section. Read more on docs.microsoft.com. Type: int The initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero. Read more on docs.microsoft.com. Type: int The initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area. If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, then the y parameter determines how the window is shown. If the y parameter is CW_USEDEFAULT, then the window manager calls ShowWindow with the SW_SHOW flag after the window has been created. If the y parameter is some other value, then the window manager calls ShowWindow with that value as the nCmdShow parameter. Read more on docs.microsoft.com. Type: int The width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinates to the right edge of the screen; the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameter are set to zero. Read more on docs.microsoft.com. Type: int The height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, the system ignores nHeight. Read more on docs.microsoft.com. Type: HWND A handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle. This parameter is optional for pop-up windows. To create a message-only window, supply HWND_MESSAGE or a handle to an existing message-only window. Read more on docs.microsoft.com. Type: HMENU A handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window. Read more on docs.microsoft.com. Type: HINSTANCE A handle to the instance of the module to be associated with the window. Read more on docs.microsoft.com. Type: LPVOID Pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created window by this function before it returns. If an application calls CreateWindow to create a MDI client window, lpParam should point to a CLIENTCREATESTRUCT structure. If an MDI client window calls CreateWindow to create an MDI child window, lpParam should point to a MDICREATESTRUCT structure. lpParam may be NULL if no additional data is needed. Read more on docs.microsoft.com. Type: HWND If the function succeeds, the return value is a handle to the new window. If the function fails, the return value is NULL. To get extended error information, call GetLastError. This function typically fails for one of the following reasons: This doc was truncated. The CreateWindowEx function sends WM_NCCREATE, WM_NCCALCSIZE, and WM_CREATE messages to the window being created. If the created window is a child window, its default position is at the bottom of the Z-order. If the created window is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless the created window is itself topmost). For information on controlling whether the Taskbar displays a button for the created window, see Managing Taskbar Buttons. For information on removing a window, see the DestroyWindow function. The following predefined control classes can be specified in the lpClassName parameter. Note the corresponding control styles you can use in the dwStyle parameter. This doc was truncated. Read more on docs.microsoft.com. Calls the default window procedure to provide default processing for any window messages that an application does not process. (Unicode) Type: HWND A handle to the window procedure that received the message. Read more on docs.microsoft.com. Type: UINT The message. Read more on docs.microsoft.com. Type: WPARAM Additional message information. The content of this parameter depends on the value of the Msg parameter. Read more on docs.microsoft.com. Type: LPARAM Additional message information. The content of this parameter depends on the value of the Msg parameter. Read more on docs.microsoft.com. Type: LRESULT The return value is the result of the message processing and depends on the message. > [!NOTE] > The winuser.h header defines DefWindowProc as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see [Conventions for Function Prototypes](/windows/win32/intl/conventions-for-function-prototypes). Read more on docs.microsoft.com. Destroys the specified window. Type: HWND A handle to the window to be destroyed. Read more on docs.microsoft.com. Type: BOOL 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. A thread cannot use DestroyWindow to destroy a window created by a different thread. If the window being destroyed is a child window that does not have the WS_EX_NOPARENTNOTIFY style, a WM_PARENTNOTIFY message is sent to the parent. Read more on docs.microsoft.com. Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the GetMessage function. (DispatchMessageW) Type: const MSG* A pointer to a structure that contains the message. Read more on docs.microsoft.com. Type: LRESULT The return value specifies the value returned by the window procedure. Although its meaning depends on the message being dispatched, the return value generally is ignored. The MSG structure must contain valid message values. If the lpmsg parameter points to a WM_TIMER message and the lParam parameter of the WM_TIMER message is not NULL, lParam points to a function that is called instead of the window procedure. Note that the application is responsible for retrieving and dispatching input messages to the dialog box. Most applications use the main message loop for this. However, to permit the user to move to and to select controls by using the keyboard, the application must call IsDialogMessage. For more information, see Dialog Box Keyboard Interface. Read more on docs.microsoft.com. The GetDC function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen. A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen. If the function succeeds, the return value is a handle to the DC for the specified window's client area. If the function fails, the return value is NULL. The GetDC function retrieves a common, class, or private DC depending on the class style of the specified window. For class and private DCs, GetDC leaves the previously assigned attributes unchanged. However, for common DCs, GetDC assigns default attributes to the DC each time it is retrieved. For example, the default font is System, which is a bitmap font. Because of this, the handle to a common DC returned by GetDC does not tell you what font, color, or brush was used when the window was drawn. To determine the font, call GetTextFace. Note that the handle to the DC can only be used by a single thread at any one time. After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do not have to be released. ReleaseDC must be called from the same thread that called GetDC. The number of DCs is limited only by available memory. Read more on docs.microsoft.com. Loads the specified cursor resource from the executable (.EXE) file associated with an application instance. (Unicode) Type: HINSTANCE A handle to an instance of the module whose executable file contains the cursor to be loaded. Read more on docs.microsoft.com. Type: LPCTSTR The name of the cursor resource to be loaded. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can also be used to create this value. To use one of the predefined cursors, the application must set the hInstance parameter to NULL and the lpCursorName parameter to one the following values. This doc was truncated. Read more on docs.microsoft.com. Type: HCURSOR If the function succeeds, the return value is the handle to the newly loaded cursor. If the function fails, the return value is NULL. To get extended error information, call GetLastError. The LoadCursor function loads the cursor resource only if it has not been loaded; otherwise, it retrieves the handle to the existing resource. This function returns a valid cursor handle only if the lpCursorName parameter is a pointer to a cursor resource. If lpCursorName is a pointer to any type of resource other than a cursor (such as an icon), the return value is not NULL, even though it is not a valid cursor handle. The LoadCursor function searches the cursor resource most appropriate for the cursor for the current display device. The cursor resource can be a color or monochrome bitmap.

DPI Virtualization

This API does not participate in DPI virtualization. The output returned is not affected by the DPI of the calling thread.
Read more on docs.microsoft.com.
Dispatches incoming nonqueued messages, checks the thread message queue for a posted message, and retrieves the message (if any exist). (Unicode) Type: LPMSG A pointer to an MSG structure that receives message information. Read more on docs.microsoft.com. Type: HWND A handle to the window whose messages are to be retrieved. The window must belong to the current thread. If hWnd is NULL, PeekMessage retrieves messages for any window that belongs to the current thread, and any messages on the current thread's message queue whose hwnd value is NULL (see the MSG structure). Therefore if hWnd is NULL, both window messages and thread messages are processed. If hWnd is -1, PeekMessage retrieves only messages on the current thread's message queue whose hwnd value is NULL, that is, thread messages as posted by PostMessage (when the hWnd parameter is NULL) or PostThreadMessage. Read more on docs.microsoft.com. Type: UINT The value of the first message in the range of messages to be examined. Use WM_KEYFIRST (0x0100) to specify the first keyboard message or WM_MOUSEFIRST (0x0200) to specify the first mouse message. If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no range filtering is performed). Read more on docs.microsoft.com. Type: UINT The value of the last message in the range of messages to be examined. Use WM_KEYLAST to specify the last keyboard message or WM_MOUSELAST to specify the last mouse message. If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no range filtering is performed). Read more on docs.microsoft.com. Type: UINT Type: BOOL If a message is available, the return value is nonzero. If no messages are available, the return value is zero. PeekMessage retrieves messages associated with the window identified by the hWnd parameter or any of its children as specified by the IsChild function, and within the range of message values given by the wMsgFilterMin and wMsgFilterMax parameters. Note that an application can only use the low word in the wMsgFilterMin and wMsgFilterMax parameters; the high word is reserved for the system. Note that PeekMessage always retrieves WM_QUIT messages, no matter which values you specify for wMsgFilterMin and wMsgFilterMax. During this call, the system dispatches (DispatchMessage) pending, nonqueued messages, that is, messages sent to windows owned by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout, or SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The system may also process internal events. If no filter is specified, messages are processed in the following order: This doc was truncated. Read more on docs.microsoft.com. Indicates to the system that a thread has made a request to terminate (quit). It is typically used in response to a WM_DESTROY message. Type: int The application exit code. This value is used as the wParam parameter of the WM_QUIT message. Read more on docs.microsoft.com. The PostQuitMessage function posts a WM_QUIT message to the thread's message queue and returns immediately; the function simply indicates to the system that the thread is requesting to quit at some time in the future. When the thread retrieves the WM_QUIT message from its message queue, it should exit its message loop and return control to the system. The exit value returned to the system must be the wParam parameter of the WM_QUIT message. Read more on docs.microsoft.com. Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function. (RegisterClassW) Type: const WNDCLASS* A pointer to a WNDCLASS structure. You must fill the structure with the appropriate class attributes before passing it to the function. Read more on docs.microsoft.com. Type: ATOM If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow, FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method. If the function fails, the return value is zero. To get extended error information, call GetLastError. If you register the window class by using RegisterClassA, the application tells the system that the windows of the created class expect messages with text or character parameters to use the ANSI character set; if you register it by using RegisterClassW, the application requests that the system pass text parameters of messages as Unicode. The IsWindowUnicode function enables applications to query the nature of each window. For more information on ANSI and Unicode functions, see Conventions for Function Prototypes. All window classes that an application registers are unregistered when it terminates. No window classes registered by a DLL are unregistered when the DLL is unloaded. A DLL must explicitly unregister its classes when it is unloaded. Read more on docs.microsoft.com. The ReleaseDC function releases a device context (DC), freeing it for use by other applications. The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. It has no effect on class or private DCs. A handle to the window whose DC is to be released. A handle to the DC to be released. The return value indicates whether the DC was released. If the DC was released, the return value is 1. If the DC was not released, the return value is zero. The application must call the ReleaseDC function for each call to the GetWindowDC function and for each call to the GetDC function that retrieves a common DC. An application cannot use the ReleaseDC function to release a DC that was created by calling the CreateDC function; instead, it must use the DeleteDC function. ReleaseDC must be called from the same thread that called GetDC. Read more on docs.microsoft.com. Sets the specified window's show state. Type: HWND A handle to the window. Read more on docs.microsoft.com. Type: int Type: BOOL If the window was previously visible, the return value is nonzero. If the window was previously hidden, the return value is zero. To perform certain special effects when showing or hiding a window, use AnimateWindow. The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter. As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in the structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window. On subsequent calls, the application must call ShowWindow with nCmdShow set to SW_SHOWDEFAULT to use the startup information provided by the program that launched the application. This behavior is designed for the following situations: This doc was truncated. Read more on docs.microsoft.com. Translates virtual-key messages into character messages. The character messages are posted to the calling thread's message queue, to be read the next time the thread calls the GetMessage or PeekMessage function. Type: const MSG* A pointer to an MSG structure that contains message information retrieved from the calling thread's message queue by using the GetMessage or PeekMessage function. Read more on docs.microsoft.com. Type: BOOL If the message is translated (that is, a character message is posted to the thread's message queue), the return value is nonzero. If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the return value is nonzero, regardless of the translation. If the message is not translated (that is, a character message is not posted to the thread's message queue), the return value is zero. The TranslateMessage function does not modify the message pointed to by the lpMsg parameter. WM_KEYDOWN and WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message. WM_SYSKEYDOWN and WM_SYSKEYUP combinations produce a WM_SYSCHAR or WM_SYSDEADCHAR message. TranslateMessage produces WM_CHAR messages only for keys that are mapped to ASCII characters by the keyboard driver. If applications process virtual-key messages for some other purpose, they should not call TranslateMessage. For instance, an application should not call TranslateMessage if the TranslateAccelerator function returns a nonzero value. Note that the application is responsible for retrieving and dispatching input messages to the dialog box. Most applications use the main message loop for this. However, to permit the user to move to and to select controls by using the keyboard, the application must call IsDialogMessage. For more information, see Dialog Box Keyboard Interface. Read more on docs.microsoft.com. The UpdateWindow function updates the client area of the specified window by sending a WM_PAINT message to the window if the window's update region is not empty. Handle to the window to be updated. If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Learn more about this API from docs.microsoft.com. Represents a Win32 handle that can be closed with .