CreateGadget

Core

CreateGadget creates a new Gadget of a given type. Depending on the specific flags, different Gadgets will actually be instantiated.  Once a Gadget of a specific type has been created, it can not be changed into a different type without being deleted and recreated.

HGADGET
CreateGadget(
    HANDLE hParent,             // Handle to parent
    UINT nFlags,                // Creation flags
    GADGETPROCEX pfnProc,       // Pointer to the Gadget procedure
    void * pvGadgetData)        // User data associated with this Gadget
);

Parameters

hParent
[in] Handle to parent
nFlags
[in] Specifies both what type of Gadget to created and any creation-time properties of that Gadget
Value Action
GC_HWNDHOST Creates a top-level Gadget that can host a GadgetTree inside the client area of a given HWND. hParent must be a valid HWND.
GC_NCHOST Creates a top-level Gadget that can host a GadgetTree inside the non-client area of a given HWND. hParent must be a valid HWND.
GC_DXHOST Creates a top-level Gadget that can host a GadgetTree inside a DXSurface. hParent must be an LPCRECT specifying the area of the surface the tree will be displayed on.
GC_COMPLEX Creates a sub-level Gadget that is optimized for a complex subtree below it containing many other Gadgets. More expensive than a Simple Gadget, Complex Gadgets provide optimized region management and are more equivalent to HWND's in both functionality and design.  hParent must specify a valid HGADGET.
GC_SIMPLE Creates a sub-level Gadget that is optimized for a simple subtree below it containing a few Gadgets. Simple Gadgets are cheaper to create and often use than Complex Gadgets if optimized region management is not needed. hParent must specify a valid HGADGET.
GC_DETACHED Creates a Gadget not integrated into a given Gadget tree. Since they are separated from a tree, operations must be explicitely forwarded to Detached Gadgets during processing. hParent is ignored.
GC_MESSAGE Creates a message-only Gadget that can receive and send messages, but does not articipate in any visual or interactive manner. hParent is ignored.
GC_MANUALDRAW Specifies that this top-level Gadget will be explicitely told when to draw. This flag can only be used with the GC_HWNDHOST, GC_NCHOST, and GC_DXHOST styles.
pfnProc
[in] Pointer to the Gadget procedure
pvGadgetData
[in] User data associated with this Gadget

Return Values

Components were successfully uninitialized.

See Also

CreateTransition, InitGadgetComponent

 

 


Internal Only

Build on Thursday, March 16, 2000
Copyright © 2000 by Microsoft Corporation.  All rights reserved
Send feedback to Jeff Stall