Category: Visual Programming
Device Context (DC) – Display Device Context Defaults
Device Context (DC) We have studied a lot about GDI and its objects and now, we will know how to display GDI objects using Device context. A device context is a structure that defines a set of graphic objects and their associated attributes, as well as the graphic modes that affect output. The graphic objects [...]
UNREALIZEOBJECT and special cases
UNREALIZEOBJECT The UnrealizeObject function affects only brushes and palettes. As its name implies, the UnrealizeObject unction lets an application force GDI to re-realize an object from scratch when the object is next realized in a DC. The UnrealizeObject function lets an application reset the origin of the brush. When a patterned, hatched, or dithered brush [...]
Deletion of GDI Objects
Deletion of GDI Objects All applications should delete objects when they are no longer needed. To delete an object properly, first deselect it from any DC into which it was previously selected. To deselect an object, an application must select a different object of the same type into the DC. Common practice is to track [...]
Error Handling in GDI
Error Handling The two common types of errors associated with objects are failure to create and failure to select. Both are most commonly associated with low-memory conditions. During the creation process, GDI allocates a block of memory to store the logical object information. When the heap is full, applications cannot create any more objects until [...]
Creating vs. Recreating and Stock Objects in GDI
Creating vs. Recreating If an application uses an object repeatedly, should the object be created once and cached by the application, or should the application recreate the object every time it is needed and delete it when that part of the drawing is complete? Creating on demand is simpler and saves memory in GDIs heap [...]
Memory Usage in GDI
Memory Usage The amount of memory each object type consumes in GDIs heap and in the global memory heap depends on the type of the object. This topic is discussed in Microsoft Documentation 2003 Release. The following table describes memory used for storing logical objects. Object type GDI heap use (in bytes) Global memory use [...]
What Happens During Selection – Graphics Interface
What Happens During Selection Selecting a logical object into a DC involves converting the logical object into a physical object that the device driver uses for output. This process is called realization. The principle is the same for all objects, but the actual operation is different for each object type. When an application changes the [...]
GDI Objects and its API’s – GDI objects Creation
GDI Objects and its API’s This topic will discuss Graphics Device Objects and the API ‘s used to create, select, get, release, draw and delete GDI objects. GDI objects Creation Each type of object has a routine or a set of routines that is used to create that object. Pens are created with the CreatePen [...]
GDI (Graphics Device Interface) – Description Windows Classes
GDI (Graphics Device Interface) In previous lectures we have got some understanding about GDI. In this lecture, we will take a detail look on Graphics Device Interface and its Device independency. The graphical component of the Microsoft® Windows™ graphical environment is the graphics device interface (GDI). It communicates between the application and the device driver, [...]
Supper – classing and example of supper – classing
Supper-Classing Super-classing defines a class that adds new functionality to a predefined window class, such as the button or list box controls. Superclassing involves creating a new class that uses the window procedure of an existing class for basic functionality. Super-Classing (Example) Super-classing defines a class that adds new functionality to a predefined window class, [...]
Sub-Classing (Elaboration) – windows classes
Sub-Classing (Elaboration) We elaborate sub-classing by using following examples. DLGPROC oldWindowProc; hWnd = CreateWindow(“BUTTON”, “Virtual University”, BS_AUTOCHECKBOX | WS_VISIBLE | WS_OVERLAPPEDWINDOW, 50, 50, 200, 100, NULL, NULL, hInstance, NULL); oldWindowProc = (WNDPROC) SetWindowLong ( hWnd, GWL_WNDPROC, (LONG) myWindowProc); while(GetMessage(&msg, NULL, 0, 0) > 0) { DispatchMessage(&msg); } return msg.wParam; New Window Procedure LRESULT CALLBACK myWindowProc(HWND [...]
Get or Set ClassLong , Return Value
Get or Set ClassLong The GetClassLong() function retrieves the specified 32-bit (LONG) value from the WNDCLASS structure associated with the specified window. This will can be back ground brush, handle to instance, handle to windows procedure and handle to Icon etc. LONG SetClassLong( HWND hWnd, // handle to window int nIndex, // offset of value [...]
