Theo's Forum

IT-Berater: Theo Gottwald (IT-Consultant) => SDK and Third Party Know-How => Topic started by: Theo Gottwald on May 19, 2007, 03:42:40 PM

Title: (Phoenix) ButtonEx32
Post by: Theo Gottwald on May 19, 2007, 03:42:40 PM
Code: [Select]
'###############################################################################
' BEGIN ButtonEx_Class32
'###############################################################################

' ButtonEx styles
' ---------------
%BXS_LEFT                                   = &H0100??
' The image is on the left side of any text that is present.  If only
' text or an image is present, the displayed item is centered.

%BXS_TOP                                    = &H0400??
' The image is at the top of any text that is present.  If only
' text or an image is present, the displayed item is centered.

%BXS_RIGHT                                  = &H0200??
' The image is on the right side of any text that is present.  If only
' text or an image is present, the displayed item is centered.

%BXS_BOTTOM                                 = &H0800??
' The image is at the bottom of any text that is present.  If only
' text or an image is present, the displayed item is centered.

%BXS_OVERLAP                                = &H0020??
' The image is drawn below any text that is present.  Both text and image are centered.

%BXS_NOTIFY                                 = &H4000??
' Enables a button to send BXN_DBLCLK, BXN_KILLFOCUS, and BXN_SETFOCUS notification
' messages to its parent window. A button sends the BXN_CLICKED notification message
' regardless of whether it has this style.

%BXS_PUSHBUTTON                             = &H0000??
' Creates a push button that sends a WM_COMMAND message to the parent window when
' the user selects the button.

%BXS_DEFPUSHBUTTON                          = &H0001??
' Creates a push button that sends a WM_COMMAND message to the parent window when
' the user selects the button.  The button has a heavy black border.  This is a
' visual cue to alert the user that the most likely (default) option will be selected
' when the ENTER key is pressed even when the button does not have the input focus.

%BXS_FLAT                                   = &H8000??
' Creates a flat push button with no border.  The button has a raised appearance when
' it has the input focus.

%BXS_TRANSPARENT                            = &H0040??
' Creates a transparent push button.

%BXS_HOTTRACK                               = &H0080??
' The button sends a BXN_HOTITEMCHANGE notification message when the pointer enters or
' leaves its client area.  If the button has the BXS_FLAT style, it is automatically
' highlighted (appears raised) when the pointer moves over it.

' ButtonEx messages
' -----------------
%BXM_GETSTATE                               = &H00F2??
' Purpose: sent to determine the state of a button.
' wParam:  N/A
' lParam:  N/A
' Return:  The return value specifies the current state of the button.
'          You can use the following bitmasks to extract information about the state:

%BXST_PUSHED        = &H04
' Specifies the highlight state. A nonzero value indicates that the button is highlighted.
' A button is automatically highlighted when the user positions the cursor over it and
' presses and holds the left mouse button. The highlighting is removed when the user
' releases the mouse button.

%BXST_FOCUS         = &H08
' Specifies the focus state. A nonzero value indicates that the button has the
' keyboard focus.

%BXST_HOT           = &H80
' Specifies the hot state. A nonzero value indicates that the mouse is over the button.

%BXM_SETSTATE                               = &H00F3??
' Purpose: sent to change the highlight state of a button. The highlight state indicates
'          whether the button is highlighted as if the user had pushed it.
' wParam:  highlight state.
' lParam:  N/A
' Return:  N/A

%BXM_SETSTYLE                               = &H00F4??
' Purpose: sent to change the style of a button.
' wParam:  button style.
' lParam:  redraw flag.
' Return:  N/A

%BXM_CLICK                                  = &H00F5??
' Purpose: sent to simulate the user clicking a button. This message causes the button
'          to receive a WM_LBUTTONDOWN and a WM_LBUTTONUP message, and the button's
'          parent window to receive a BXN_CLICKED notification message.
' wParam:  N/A
' lParam:  N/A
' Return:  N/A

%BXM_GETIMAGE                               = &H00F6??
' Purpose: sent to retrieve the handle of the image (bitmap, icon or cursor) associated
'          with the button.
' wParam:  N/A
' lParam:  N/A
' Return:  The return value is the handle of the image, if any; otherwise, it is NULL.

%BXM_SETIMAGE                               = &H00F7??
' Purpose: sent to associate a new image (bitmap, icon or cursor) with the button.
' wParam:  the type of image.
' lParam:  handle of new image.
' Return:  The return value is the handle of the image previously associated with
'          the button, if any; otherwise, it is NULL.

%BXM_GETTEXTCOLOR                           = &H00F8??
' Purpose: sent to retrieve the color used to draw text.
' wParam:  N/A
' lParam:  N/A
' Return:  The return value is the text color.

%BXM_SETTEXTCOLOR                           = &H00F9??
' Purpose: sent to set the color used to draw text.
' wParam:  N/A
' lParam:  new text color or &HFFFFFFFF??? to set the default (COLOR_BTNTEXT).
' Return:  The return value is the old text color.

%BXM_GETBACKCOLOR                           = &H00FA??
' Purpose: sent to retrieve the color used to color the background.
' wParam:  N/A
' lParam:  N/A
' Return:  The return value is the background color.

%BXM_SETBACKCOLOR                           = &H00FB??
' Purpose: sent to set the background color.
' wParam:  N/A
' lParam:  new background color or &HFFFFFFFF??? to set the default (COLOR_BTNFACE).
' Return:  The return value is the old background color.

' ButtonEx notifications
' ----------------------
%BXN_CLICKED                                = 0
' Purpose: sent when the user clicks a mouse button. The parent window of the button
'          receives this notification message through the WM_COMMAND message.
' wParam:  lowrd(wParam) = identifier of button.
'          hiwrd(wParam) = notification code.
' lParam:  handle of button.
' Return:  N/A

%BXN_DBLCLK                                 = 5
' Purpose: sent when the user double-clicks a mouse button. The button must have the
'          BXS_NOTIFY style to send this notification message. The parent window of the
'          button receives this notification message through the WM_COMMAND message.
' wParam:  lowrd(wParam) = identifier of button.
'          hiwrd(wParam) = notification code.
' lParam:  handle of button.
' Return:  N/A

%BXN_SETFOCUS                               = 6
' Purpose: sent when a button receives the keyboard focus. The button must have the
'          BXS_NOTIFY style to send this notification message.  The parent window of the
'          button receives this notification message through the WM_COMMAND message.
' wParam:  lowrd(wParam) = identifier of button.
'          hiwrd(wParam) = notification code.
' lParam:  handle of button.
' Return:  N/A

%BXN_KILLFOCUS                              = 7
' Purpose: sent when a button loses the keyboard focus. The button must have the
'          BXS_NOTIFY style to send this notification message.  The parent window of the
'          button receives this notification message through the WM_COMMAND message.
' wParam:  lowrd(wParam) = identifier of button.
'          hiwrd(wParam) = notification code.
' lParam:  handle of button.
' Return:  N/A

' The BUTTONEXNOTIFY structure is used by the BXCN_HOTITEMCHANGE notification
TYPE BUTTONEXNOTIFY 'bxn
  hdr             AS NMHDR        ' control handle and id information
  fLeaving        AS LONG         ' TRUE = mouse is leaving client area.  FALSE = mouse is entering client area.
END TYPE

%BXCN_HOTITEMCHANGE                         = 8
' Purpose: sent when the mouse enters or leaves the client area of the button.  The
'          parent window of the button receives this notification message through
'          the WM_NOTIFY message.
' wParam:  identifier of button.
' lParam:  address of BUTTONEXNOTIFY structure.
' Return:  N/A

DECLARE FUNCTION InitButtonEx LIB "BUTTON32.DLL" ALIAS "InitButtonEx" () AS LONG

'###############################################################################
' END ButtonEx_Class32
'###############################################################################