Skip to content

ModernUI Library

mrfearless edited this page Jul 8, 2019 · 16 revisions

ModernUI Functions

ModernUI Base Functions

MUIGetExtProperty

Description: Get a specified property from the external properties structure. Properties are defined as equates and are actually offsets into the memory location used to store the properties.

Parameters: hControl, dwProperty

MUISetExtProperty

Description: Set a specified property with a value, which is stored in the external properties structure. Properties are defined as equates and are actually offsets into the memory location used to store the properties.

Parameters: hControl, dwProperty, dwPropertyValue

MUIGetIntProperty

Description: Get a specified property from the internal properties structure. Properties are defined as equates and are actually offsets into the memory location used to store the properties.

Parameters: hControl, dwProperty

MUISetIntProperty

Description: Set a specified property with a value, which is stored in the internal properties structure. Properties are defined as equates and are actually offsets into the memory location used to store the properties.

Parameters: hControl, dwProperty, dwPropertyValue

ModernUI Memory Functions

MUIAllocMemProperties

Description: Allocates memory for the internal or external properties storage - typically during WM_CREATEevent and this memory is freed by calla to the MUIFreeMemProperties function during WM_DESTROY event.

Parameters: hControl, cbWndExtraOffset, dwSizeToAllocate

MUIFreeMemProperties

Description: Frees memory allocated via the MUIAllocMemProperties function. Used at the WM_DESTROY event typically. Make sure any cleanup routines are called before freeing any memory.

Parameters: hControl, cbWndExtraOffset

MUIAllocStructureMemory

Description: Dynamically allocates (or reallocates) memory for a specified array of structures and auto increments the total items in the array, and returns a pointer to the new current item in the array of structures.

Parameters: dwPtrStructMem, TotalItems, ItemSize

ModernUI GDI Functions

MUIGDIDoubleBufferStart

Description: Starts double buffering. Used in a WM_PAINT event. Place after BeginPaint call. lpHDCBuffer points to a variable used to store the dc of the double buffer (eg. hdcMem). lpClientRect points to a RECT structure used to store the client rectangle. lphBufferBitmap points to a variable used to store the double buffer bitmap.

Parameters: hWin, hdcSource, lpHDCBuffer, lpClientRect, lphBufferBitmap

MUIGDIDoubleBufferFinish

Description: Finishes double buffering and cleans up afterwards. Used in a WM_PAINT event. Place before EndPaint call and after all Blt calls. hdcBuffer is the dc of the double buffer (eg. hdcMem). hBufferBitmap is the handle to the double buffer bitmap. hBitmapUsed, hFontUsed, hBrushUsed, and hPenUsed are optional parameters. If you have used a bitmap image (not the double buffer bitmap which is hBufferBitmap) or a font, brush or pen in your code in the hdcBuffer you can pass the handles here for cleaning up, otherwise pass 0 for the parameters that you havent used.

Parameters: hdcBuffer, hBufferBitmap, hBitmapUsed, hFontUsed, hBrushUsed, hPenUsed

MUIGDIBlend

Description:

Parameters: hWin, hdc, dwColor, dwBlendLevel

MUIGDIBlendBitmaps

Description:

Parameters: hBitmap1, hBitmap2, dwColorBitmap2, dwTransparency

MUIGDIStretchBitmap

Description:

Parameters: hBitmap, lpBoundsRect, lpdwBitmapWidth, lpdwBitmapHeight, lpdwX, lpdwY

MUIGDIStretchImage

Description:

Parameters: hImage, dwImageType, lpBoundsRect, lpdwImageWidth, lpdwImageHeight, lpdwImageX, lpdwImageY

MUIGDIRotateCenterBitmap

Description:

Parameters: hWin, hBitmap, dwAngle, dwBackColor

MUIGDIPaintFill

Description: Fills a rectangle with a specific color. lpFillRect is a pointer to a RECT containing the bounding box to fill. dwFillColor is an RGBCOLOR to paint fill the rectangle with.

Parameters: hdc, lpFillRect, dwFillColor

MUIGDIPaintFrame

Description: Draws a border (or parts of) around a rectangle with a specific color. lpFrameRect is a pointer to a RECT containing the bounding box of the frame. dwFrameColor is an RGBCOLOR to paint the frame edges. If dwFrameColor is -1 then no painting occurs. dwFrameStyle indicates what parts of the frame are painted. dwFrameStyle can be a combination of the following flags: MUIPFS_NONE, MUIPFS_LEFT, MUIPFS_TOP, MUIPFS_BOTTOM, MUIPFS_RIGHT, MUIPFS_ALL

Parameters: hdc, lpFrameRect, dwFrameColor, dwFrameStyle

ModernUI GDIPlus Functions

MUIGDIPlusStart

Description: Wrapper for GDIPlus startup.

Parameters: None

MUIGDIPlusFinish

Description: Wrapper for GDIPlus shutdown.

Parameters: None

MUIGDIPlusDoubleBufferStart

Description:

Parameters: hWin, pGraphics, lpBitmapHandle, lpGraphicsBuffer

MUIGDIPlusDoubleBufferFinish

Description:

Parameters: hWin, pGraphics, hBitmap, pGraphicsBuffer

MUIGDIPlusRotateCenterImage

Description: Rotates an Image around its center. fAngle is a REAL4 value indicating the angle in degrees to rotate the original hImage by. Returns a new image handle of the rotated image.

Parameters: hImage, fAngle

MUIGDIPlusPaintFill

Description: Fills a rectangle with a specific color. lpFillRect is a pointer to a GDIRECT containing the bounding box to fill. dwFillColor is an ARGB color to paint fill the rectangle with (use MUI_ARGBCOLOR macro for ease of use in specifying ARGB color).

Parameters: pGraphics, lpFillGdipRect, dwFillColor

MUIGDIPlusPaintFillI

Description: Fills a rectangle with a specific color. lpFillRectI is a pointer to a RECT containing the bounding box to fill. dwFillColor is an ARGB color to paint fill the rectangle with.

Parameters: pGraphics, lpFillRectI, dwFillColor

MUIGDIPlusPaintFrame

Description: Draws a border (or parts of) around a rectangle with a specific color. lpFrameRect is a pointer to a GDIRECT containing the bounding box of the frame. dwFrameColor is an ARGB color to paint the frame edges (use MUI_ARGBCOLOR macro for ease of use in specifying ARGB color). If dwFrameColor is -1 then no painting occurs. dwFrameStyle indicates what parts of the frame are painted. dwFrameStyle can be a combination of the following flags: MUIPFS_NONE, MUIPFS_LEFT, MUIPFS_TOP, MUIPFS_BOTTOM, MUIPFS_RIGHT, MUIPFS_ALL

Parameters: pGraphics, lpFrameGdipRect, dwFrameColor, dwFrameStyle

MUIGDIPlusPaintFrameI

Description: Draws a border (or parts of) around a rectangle with a specific color. lpFrameRectI is a pointer to a RECT containing the bounding box of the frame. dwFrameColor is an ARGB color to paint the frame edges. If dwFrameColor is -1 then no painting occurs. dwFrameStyle indicates what parts of the frame are painted. dwFrameStyle can be a combination of the following flags: MUIPFS_NONE, MUIPFS_LEFT, MUIPFS_TOP, MUIPFS_BOTTOM, MUIPFS_RIGHT, MUIPFS_ALL

Parameters: pGraphics, lpFrameRectI, dwFrameColor, dwFrameStyle

MUILoadPngFromResource

Description:

Parameters: hWin, dwInstanceProperty, dwProperty, idPngRes

MUIGDIPlusRectToGdipRect

Description: Convert a normal RECT structure to a GDIPRECT structure.

Parameters: lpRect, lpGdipRect

ModernUI Painting And Color Functions

MUIPaintBackground

Description: Paints the background color of a dialog or window a specified RGB color and also a border for the window in a specified RGB color. The MUI_RGBCOLOR macro is provided for ease of use.

Parameters: hDialogWindow, dwBackColor, dwBorderColor

MUIPaintBackgroundImage

Description: Similar to MUIPaintBackground function, but allows painting of an image as well and specifies the location of the image with the dwImageLocation parameter, values can be one of the following: MUIIL_CENTER, MUIIL_BOTTOMLEFT, MUIIL_BOTTOMRIGHT, MUIIL_TOPLEFT, MUIIL_TOPRIGHT, MUIIL_TOPCENTER, or MUIIL_BOTTOMCENTER. Image types can be one of the following values: MUIIT_NONE, MUIIT_BMP,MUIIT_ICO, or MUIIT_PNG.

Parameters: hDialogWindow, dwBackColor, dwBorderColor, hImage, dwImageType, dwImageLocation

MUIGetParentBackgroundColor

Description: Retrieves the background color of the parent window and returns the value in eax as an RGB value. Useful for other controls to default to a particular color based on parents background color.

Parameters: hControl

MUIGetParentBackgroundBitmap

Description: Attemps to retrieve the background, as a bitmap (returns hBitmap in eax), of the parent control, relative to the child control. Useful for faking transparency effects in the child control.

Parameters: hControl

ModernUI Window/Dialog Functions

MUIApplyToDialog

Description: Applies the ModernUI style to a dialogbox, which is a borderless window and removes the titlebar, system box, min, max, resore and exit buttons. Setting a modern looking caption and min, max, restore and exit buttons and can be achieved with the ModernUI_CaptionBar control. dwDropbShadow and dwClipping are parameters for enabling/disabling drop shadows and/or clipping by passing TRUE or FALSE.

Parameters: hDialogWindow, dwDropShadow, dwClipping

MUICenterWindow

Description: Centers a window relative to another window's position.

Parameters: hWndChild, hWndParent

MUIGetParentRelativeWindowRect

Description: Get rectangle of a window/control relative to it's parent. hControl is the handle to the control to get the relative rectangle for. lpRectControl points to a RECT structure that will store the result..

Parameters: hControl, lpRectControl

ModernUI Region Functions

MUILoadRegionFromResource

Description: Loads a GDI region that is stored as RC_DATA in a resource. On return the variables pointed to by thelpRegion, and lpdwSizeRegion parameters will contain the pointer to the region and the size of the region. The region can be used to make custom window shapes for controls or dialog windows.

Parameters: hInstance, idRgnRes, lpRegion, lpdwSizeRegion

MUISetRegionFromResource

Description: Loads a region from a resource (similar to the MUILoadRegionFromResource function) and sets the region to the window specified by the hWin parameter. Additionally creates a copy of the region and returns this to the variable pointed to by the lpdwCopyRgn parameter - for use with drawing frame borders for example.

Parameters: hWin, idRgnRes, lpdwCopyRgn, bRedraw

ModernUI Font Functions

MUIPointSizeToLogicalUnit

Description: Converts point sizes to logical units. Typically used for converting font sizes to logical units.

Parameters:; hControl, dwPointSize

ModernUI Image Functions

MUIGetImageSize

Description: Gets the image size of the specified image, based on the specified type: icon, bitmap or png. Width and Height are returned into the variables pointed to by the lpdwImageWidth and lpdwImageHeight parameters if successful.

Parameters: hImage, dwImageType, lpdwImageWidth, lpdwImageHeight

MUIGetImageSizeEx

Description: Similar to MUIGetImageSize, but also returns centering x and y co-ord information based on rectangle of hWin

Parameters: hWin, hImage, dwImageType, lpdwImageWidth, lpdwImageHeight, lpdwImageXPos, lpdwImageYPos

MUICreateIconFromMemory

Description: Create an icon from data stored in memory. Typically defined in the .data section as a variable with a sequence of binary data. Use bin2dbex from masm32 package to generate the byte sequence required. pIconData is a pointer to the icon file data.

Parameters: pIconData, iIcon

MUICreateCursorFromMemory

Description: Creates a cursor from icon/cursor data stored in memory. Typically defined in the .data section as a variable with a sequence of binary data. Use bin2dbex from masm32 package to generate the byte sequence required.pCursorData is a pointer to the cursor file data.

Parameters: pCursorData

MUICreateBitmapFromMemory

Description: Create an bitmap from data stored in memory. Typically defined in the .data section as a variable with a sequence of binary data. Use bin2dbex from masm32 package to generate the byte sequence required. pBitmapData is a pointer to the bitmap file data.

Parameters: pBitmapData

MUILoadBitmapFromResource

Description:

Parameters:

MUILoadIconFromResource

Description:

Parameters:

MUILoadImageFromResource

Description:

Parameters:

ModernUI DPI Functions

ModernUI Macros

MUI_ARGBCOLOR
MUI_ARGBCOLOR MACRO alpha, red, green, blue
   EXITM < alpha SHL 24 OR red SHL 16 OR green SHL 8 OR blue >
ENDM
AlphaRGB
AlphaRGB MACRO alpha, red, green, blue
   EXITM < alpha SHL 24 OR red SHL 16 OR green SHL 8 OR blue >
ENDM
MUI_RGBCOLOR
MUI_RGBCOLOR MACRO red:REQ, green:REQ, blue:REQ
   EXITM < red or green shl 8 or blue shl 16 >
ENDM
RGB
RGB MACRO red:REQ, green:REQ, blue:REQ
   EXITM < red or green shl 8 or blue shl 16 >
ENDM