Documentation for Win32lib v0.70.18
Table of Contents

System Attributes

These are routines that let you inspect and alter attributes of various system-wide elements.


  • func adjustCreateFont( sequence changes)   changes some of the attributes of the font used for controls when they are created.
  • proc classAutoSelect( object type, integer Flag )   Turns on and off edit controls' default auto-selection property.
  • func classDefaults(integer class, sequence pData)   Used to change the default values for style and extended style flags.
  • func clientToClient(integer id1, integer id2, sequence xy)    Converts a point in id1 to a relative point in id2
  • func ClientToScreen(integer id, integer x, integer y)   Converts a point in a control to screen-based coordinates.
  • func convPctToPixel(integer id, object x, object y, object width, object height)   Converts relative coordinates to pixel coordinates.
  • func findWindow(sequence ClassName, sequence WindowTitle)   Looks to see if the named window exists in the system. Only top level or pop-up windows are inspected.
  • func getActiveWindow()    Returns the id of the control that the user is working on.
  • func getAppName()   Gets the application's name.
  • func getClassName(integer id)   Gets the Windows Class name for the control.
  • func getHandle(integer controlID OR sequence {TVid, TVItemID} )   Returns the Windows Handle of the specified control
  • func getHWND(integer controlID)   Returns the Windows Handle of the specified control
  • func getId( object hWnd )    Finds the control/window ID given a Window Handle.
  • func getIdName(integer controlID)   Returns the name of a control, given it's id.
  • func getKeyState(atom key)    Gets the depressed stats of the key.
  • func getLEDs()   Returns or'ed flags representing the state of the keyboard LEDs.
  • func getMainWindow()   Gets the id of the main window for this application.
  • func getNameId(sequence Name)   Returns the id of a control, given it's name.
  • func getNameIdInContext(sequence Name, integer Parent)   Returns the id of a control, given it's name and parent control.
  • func getPathFromIDList(atom pidl)   Translates values returned from selection folder standard dialog boxes into a folder name.
  • func getSysColor( window, color )   Return atom with value of a system color.
  • func getSystemMetrics( object Code )   Allows you to get miscellaneous information about the Windows system your application is running on.
  • func getUserName()   Fetches the id of the currently logged in user.
  • func getWinVersion()   Gets the version information of the windows platform you are running in.
  • func loadIconFromFile( object iconfile )   Get an icon from a file.
  • func manageToolTip( integer pAction, integer pNewControl)   Helps manage the ToolTip controls.
  • func ScreenToClient(integer id, integer x, integer y)   Converts a point on a screen to control-based coordinates.
  • func setAppName(sequence Name)   Sets the text used as a class name prefix for new Windows.
  • func setAutoFocusLabels(integer NewValue)   Possibly sets whether or not a '&' in labels set focus to subsequent edit field.
  • func setCreateFont( sequence faceName, atom points, object attrib, atom color )   sets the font used for controls when they are created.
  • func setEndAction(integer code)   Sets the exit code and behaviour at application closure.
  • proc setIdName(integer controlID, sequence Name)   Sets the name of a control, given it's id.
  • func setMainWindow(integer New)   Used to tell the library which window is the primary one.
  • func setTooltipTiming(integer id,object timings)    Possibly sets the timings for all the tooltips the tooltip conrol id manages.
  • func validId(object id)   Tests to see if the specified id is a valid one.
  • proc WinMain( window, style )   Run event loop.

    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    adjustCreateFont
    ( sequence changes)

    changes some of the attributes of the font used for controls when they are created.

    Returns: SEQUENCE: The previous values for the creation font.

    Category: System Attributes

    When controls are created, they need to have a font associated with them. By default Win32lib initially uses "ms sans serif", 8 point, Normal. You can use this function to set a different font for new controls rather than change the font after they are created.

    The changes sequence is a sequence of pairs. The first element in a pair is any of w32FontName, w32FontSize, w32FontAttrib or w32FontColor. The second element is the new value. Even if the change sequence is empty, the current value is returned.

    Example

          sequence oldFont
          -- Set a bigger font to use.
          oldFont = adjustCreateFont({w32FontSize,14})
          -- Create some controls
          fldA = create(Editbox, ...
          fldB = create(Editbox, ...
          fldC = create(List, ...
          -- Restore fot to initial one.
          VOID = setCreateFont(oldFont[1], oldFont[2], oldFont[3], oldFont[4])
    

    See Also: classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    classAutoSelect
    ( object type, integer Flag )

    Turns on and off edit controls' default auto-selection property.

    Category: System Attributes

    If flag is w32True, controls of type are set to have Auto-Selection, otherwise they do not have Auto-Selection behaviour by default when created.

    type can be either a single control type or a list of types in a sequence.

    Auto-selection means that when the edit control gets focus, all its contents is selected automatically for you.

    Example:

          -- Set the default for EditText fields.
          classAutoSelect(EditText, w32True)
    

    See Also: adjustCreateFont, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    classDefaults
    (integer class, sequence pData)

    Used to change the default values for style and extended style flags.

    Returns: The current values of these flags prior to changing them.

    Category: System Attributes

    class is the type of control whose defaults you want to change.
    pData is a sequence that contains zero or more sub-sequences. Each sub-sequence must have two elements, the first is the type of flag being changed, and the other is the new value for the flag. The flag value can be either an atom with all the flags or'd, or a sequence of individual flags.
    The types of flags that can be changed are:

  • CCflags - Standard control flags
  • CCexflags - Extended control flags
  • CCwinstyle - Only applies to Window - the class style flags.

    Note, if pData is an empty sequence, the current flags are returned. example:

       sequence oldFlags
       -- Make LText initially hidden and have a border when displayed.
       oldFlags = classDefaults(LText, {
                       {CCflags, {WS_CHILD, ES_LEFT}},
                       {CCexflags, WS_EX_CLIENTEDGE}
                          })
       -- Change the default class flags for windows.
       oldFlags = classDefaults(Window, {
                       {CCwinstyle, {CS_HREDRAW,CS_DBLCLKS}}
                          })
    

    See Also: adjustCreateFont, classAutoSelect, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    clientToClient
    (integer id1, integer id2, sequence xy)

    Converts a point in id1 to a relative point in id2

    Returns: SEQUENCE: {X, Y}

    Category: System Attributes

    xy is a sequence in the format { X, Y} which specifies a point in the control id1. This value is transformed so that it is relative to the control id2.

    Example

          sequence mXY
          -- Find where the point 2,-4 relative to the editbox is
          -- relative to the label.
          mXY = clientToClient(MyEditBox, MyLabelText, {2, -4 })
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    ClientToScreen
    (integer id, integer x, integer y)

    Converts a point in a control to screen-based coordinates.

    Returns: SEQUENCE: {screenX, screenY}

    Category: System Attributes

    Example

          sequence sPosn
          -- Find the screen position of the window's top left corner.
          sPosn = ClientToScreen(myWindow, 0, 0)
          printf(o, "Window is at %d, %d", {sPosn[1], sPosn[2]})
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    convPctToPixel
    (integer id, object x, object y, object width, object height)

    Converts relative coordinates to pixel coordinates.

    Returns: SEQUENCE: 4-element list {Left, Top, Width, Height}

    Category: System Attributes

    This is used internally by create() and a number of other routines to convert things like % values to pixels.

    Each dimension can be expressed as either...
    a) an integer >= 0, in which case it is not touched.
    eg. 50 (= 50 pixels)
    b) an atom in the range > 0 and < 1, which is taken to be a %
    of the control's parent dimension.
    eg. 0.50 (= 50% of parent's size)
    c) The constant w32Edge which signifies the parent's extreme
    client edge for the dimension. That is, either the rightmost or
    bottom most edge, as appropriate.
    d) a sequence of two elements, the first as in (b) or (c) above, and
    the other a pixel offset. The offset is added after converting.
    eg. {0.50, -3} ( = 50% of parent size less 3 pixels)
    eq (w32Edge, -10} ( = right/bottom pixel less 10 pixels)
    e) a sequence of three elements, the first two as in (d), and
    the other a two-element sequence containing the minimum and
    maximum allowable values. These can be a percentage or a
    pixel amount.
    eg. {0.50, -3, {20, 300}} ( = 50% of parent size less
    3 pixels, and a minimum of 20 pixels and a
    maximum of 300 pixels)
    Example:

           sequence BBox
           BBox = convPctToPixels( myEditBox, 0.30, {w32Edge,-40}, {0.1,4}, 35)
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    findWindow
    (sequence ClassName, sequence WindowTitle)

    Looks to see if the named window exists in the system. Only top level or pop-up windows are inspected.

    Returns: SEQUENCE: {0,0} if not found otherwise {id, hWnd} if found.

    Category: System Attributes

    ClassName can be zero or a string containing the registered classname of the window you are looking for.
    WindowTitle can be zero or a string containing the sought after window's caption text.

    Note: You must supply at least one non-zero parameter.

    Example

          sequence h
          h = findWindow(0, "Super Database")
          if equal(h, {0,0}) then
              -- not found
          else
              if h[1] > 0 then
                  -- A control in my running app
              else
                  -- A window belonging to another app
              end if
          end if
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getActiveWindow
    ()

    Returns the id of the control that the user is working on.

    Returns: INTEGER: The id of the window or 0 if the app does not have an active window.

    Category: System Attributes

    You can use this to find out if the application is currently the active one.

    Example:

          integer ActiveID
          ActiveID = getActiveWindow()
          if ActiveID = 0 then
              -- No window for this app is active
          else
              -- I have an active window.
          end if
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getAppName
    ()

    Gets the application's name.

    Returns: SEQUENCE: The application's name as set by setAppName

    Category: System Attributes

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getClassName
    (integer id)

    Gets the Windows Class name for the control.

    Returns: SEQUENCE: The class name string

    Category: System Attributes

    Example

          sequence lName
          lName = getClassName( fld1 )
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getHandle
    (integer controlID OR sequence {TVid, TVItemID} )

    Returns the Windows Handle of the specified control

    Returns: The control's hWnd

    Category: System Attributes

    This aborts the application if the specified id is invalid.

    This can also return the handle of a treeview item by using the syntax {tv, tvitem}

    Example

          atom hWnd, hTV
          hWnd = getHandle(myWindow)
          hTV = getHandle( {myTreeView, Itemx} )
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getHWND
    (integer controlID)

    Returns the Windows Handle of the specified control

    Returns: The control's hWnd

    Category: System Attributes

    This function is almost the same as getHandle except that it does not validate the controlID value supplied to it, and it cannot be used to get the handle of a Treeview item.
    You would use this function if you already knew that the controlID was valid and you needed a faster routine than getHandle.

    Example

          atom hWnd
          hWnd = getHWND(myWindow)
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getId
    ( object hWnd )

    Finds the control/window ID given a Window Handle.

    Returns: INTEGER: The Id corresponding to the hWnd supplied.

    Category: System Attributes

    If the supplied hWnd is invalid or not belonging to a control created by win32lib, this function will return zero.

    Note 1 this can be used to find a TreeView Item's Id from it's handle by using the syntax: id = getId( {TV, hTVI} )

    Note 2 if hWnd is the special value w32GetMainWindow, it will return the Id of the main window as used in the WinMain() routine. This is useful if you are writing an add-on library to this one.

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getIdName
    (integer controlID)

    Returns the name of a control, given it's id.

    Returns: SEQUENCE: The control's name or INTEGER: No name available.

    Category: System Attributes

    Also see: setIDName and newUIObj

    A return of "" means that the controlID was not valid.
    A return of 0 means that the controlID has no name.

    Example

          sequence name
          name = getIdName(myWindow)
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getKeyState
    (atom key)

    Gets the depressed stats of the key.

    Returns: INTEGER: w32True if the key is pressed otherwise w32False

    Category: System Attributes

    Example:

          if getKeyState( VK_NUMPAD0) then
              cmd = kStop
          elsif getKeyState( VK_NUMPAD2) then
              cmd = kDown
          elsif getKeyState( VK_NUMPAD4) then
              cmd = kLeft
          elsif getKeyState( VK_NUMPAD6) then
              cmd = kRight
          elsif getKeyState( VK_NUMPAD8) then
              cmd = kUp
          else
              cmd = 0
          end if
          processCmd(cmd)
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getLEDs
    ()

    Returns or'ed flags representing the state of the keyboard LEDs.

    Returns: INTEGER: A sum of zero or more LED flags.

    Category: System Attributes

    Known flags are:

  • NumLockFlag
  • CapsLockFlag
  • ScrollLockFlag

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getMainWindow
    ()

    Gets the id of the main window for this application.

    Returns: INTEGER: ID of main window.

    Category: System Attributes

    Example

          win = getMainWindow()
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getNameId
    (sequence Name)

    Returns the id of a control, given it's name.

    Returns: SEQUENCE: The control's ID.

    Category: System Attributes

    Also see: setIdName, getIdName and newUIObj

    A return of zero indicates that the name was not found.
    If more than one control has the same name, the result is still returned but it may be any of those controls. In this case it might be better to use getNameIdInContext().

    Example

          integer id
          id = getNameId("Prime Window")
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getNameIdInContext
    (sequence Name, integer Parent)

    Returns the id of a control, given it's name and parent control.

    Returns: SEQUENCE: The control's ID.

    Category: System Attributes

    Also see: setIdName, getNameId, getIdName and newUIObj

    A return of zero indicates that the name was not found.

    Example

          integer id
          id = getNameIdInContext("AcceptButton", CustomerWindow)
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getPathFromIDList
    (atom pidl)

    Translates values returned from selection folder standard dialog boxes into a folder name.

    Returns: (SEQUENCE) A string, the name of the folder which the callback applies to.

    Category: System Attributes

    For more information, please refer to the documentation for the SHGetPathFromIDList Win32 shell API routine.

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getSysColor
    ( window, color )

    Return atom with value of a system color.

    Returns: ATOM:Returns the RGB value of the specified system color.

    Category: System Attributes

    The system colors in Windows are listed here.

  • COLOR_SCROLLBAR
  • COLOR_BACKGROUND
  • COLOR_DESKTOP
  • COLOR_ACTIVECAPTION
  • COLOR_INACTIVECAPTION
  • COLOR_MENU
  • COLOR_WINDOW
  • COLOR_WINDOWFRAME
  • COLOR_MENUTEXT
  • COLOR_WINDOWTEXT
  • COLOR_CAPTIONTEXT
  • COLOR_ACTIVEBORDER
  • COLOR_INACTIVEBORDER
  • COLOR_APPWORKSPACE
  • COLOR_HIGHLIGHT
  • COLOR_HIGHLIGHTTEXT
  • COLOR_BTNFACE
  • COLOR_BTNSHADOW
  • COLOR_GRAYTEXT
  • COLOR_BTNTEXT
  • COLOR_INACTIVECAPTIONTEXT
  • COLOR_BTNHIGHLIGHT
  • COLOR_3DDKSHADOW
  • COLOR_3DLIGHT
  • COLOR_INFOTEXT
  • COLOR_INFOBK
  • COLOR_HOTLIGHT
  • COLOR_GRADIENTACTIVECAPTION
  • COLOR_GRADIENTINACTIVECAPTION
  • COLOR_MENUHILIGHT
  • COLOR_MENUBAR

    Example:

              -- Set the window to the button color
               setWindowBackColor( MyWindow, getSysColor( COLOR_BTNFACE ) )
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getSystemMetrics
    ( object Code )

    Allows you to get miscellaneous information about the Windows system your application is running on.

    Returns: Depends on the input Code.

    Category: System Attributes

    Note that Code can be an atom for single requests or a sequence of atoms for multiple requests in one call.
    The codes and their return values are enumerated here.

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getUserName
    ()

    Fetches the id of the currently logged in user.

    Returns: SEQUENCE: The user ID

    Category: System Attributes

    Example:

          sequence lUser
          lUser  = getUserName()
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getWinVersion
    ()

    Gets the version information of the windows platform you are running in.

    Returns: SEQUENCE: {WinVer, VariantString, BuildNo}

    Category: System Attributes

    WinVer return value can be one of these.
    VariantString is a service pack name.
    BuildNo is the operating system's build number.

    Example

          sequence winver
          winver = getWinVersion()
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    loadIconFromFile
    ( object iconfile )

    Get an icon from a file.

    Returns: ATOM: A handle to an icon

    Category: System Attributes

    iconfile is the name of an icon file. This can be a ICO, EXE, or DLL file. However, this will only fetch the first icon in that file. Some icon files can contain multiple icons. To use one of the other icons in a multi-icon file, you need to use the syntax {filename, icon#}. The icon# is the number of the icon to use. The first icon is 1, the second is 2, etc...

    Example:

          -- get the icon from a file
          hIcon = loadIconFromFile("euphoria.ico" )
    

    -- get the 3rd icon from a file hIcon = loadIconFromFile({"applib.ico", 3} )

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    manageToolTip
    ( integer pAction, integer pNewControl)

    Helps manage the ToolTip controls.

    Returns: The current tooltip control id.

    Category: System Attributes

    Use this to activate or deactivate the current tooltip control, or to just get the id of the current tooltip control.

    Set pAction to 1 to activate tooltips or 0 to deactivate them. Any other value has no effect.
    In all cases, the id of the current tooltip control is returned.

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    ScreenToClient
    (integer id, integer x, integer y)

    Converts a point on a screen to control-based coordinates.

    Returns: SEQUENCE: {ControlX, ControlY}

    Category: System Attributes

    Example

          sequence cPosn, mXY
          -- Find where the mouse is relative to the window.
          mYX = getPointerPos()
          cPosn = ScreenToClient(myWindow, mXY[1], mXY[2])
          printf(o, "Mouse is at %d, %d", {cPosn[1], cPosn[2]})
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setAppName
    (sequence Name)

    Sets the text used as a class name prefix for new Windows.

    Returns: Zero if the same application name is not already running

    Category: System Attributes

    This needs to be run before the first Window is created in your application. The initial value is Win32Lib AppWindow

    A non-zero return code is actually the Windows hWnd value for the other instance of the application.

    Example

         if setAppName("Super Database") != 0 then
             warnErr("Application is already running")
         end if
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setAutoFocusLabels
    (integer NewValue)

    Possibly sets whether or not a '&' in labels set focus to subsequent edit field.

    Returns: Returns INTEGER: The current value of the flag.

    Category: System Attributes

    By default, this is set to w32False. Which means that any '&' in label captions is ignored as far as setting focus to a subsequently defined input field.
    If you set this to w32True then the '&' notation will cause focus to move to the next input field defined after the label. Passing w32GetValue will return the current flag without setting it.

    Example:

          integer lPrevFlag
          . . .
          -- Make labels focus on its input field.
          lPrevFlag = setAutoFocusLabels(w32True)
          -- The '&N' in the caption means that Alt-N will
          -- set focus to the next input field.
          lblX = create(LText, "&Name", Win, 5, 5, 40, 25, 0)
          fldX = create(Editbox, "", Win, 5, 30, 120, 25, 0)
          -- Set the flag back to whatever it was.
          lPrevFlag = setAutoFocusLabels(lPrevFlag)
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setCreateFont
    ( sequence faceName, atom points, object attrib, atom color )

    sets the font used for controls when they are created.

    Returns: SEQUENCE: The previous values for the creation font.

    Category: System Attributes

    When controls are created, they need to have a font associated with them. By default Win32lib initially uses "ms sans serif", 8 point, Normal. You can use this function to set a different font for new controls rather than change the font after they are created.

    Example

          sequence oldFont
          -- Set a special font to use.
          oldFont = setCreateFont("Times New Roman", 14, Normal, Black)
          -- Create some controls
          fldA = create(Editbox, ...
          fldB = create(Editbox, ...
          fldC = create(List, ...
          -- Restore fot to initial one.
          VOID = setCreateFont(oldFont[1], oldFont[2], oldFont[3], oldFont[4])
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setEndAction
    (integer code)

    Sets the exit code and behaviour at application closure.

    Returns: INTEGER: Current value of the exit code

    Category: System Attributes

    This is used to signal what is to happen when the main window is closed. At that time, if the last use of setEndAction() uses a code less than zero, control returns to the application from the WinMain() call. However, a code of zero or higher causes the library to call the standard Euphoria abort() routine using the value of code.

    Example

          integer CurrentVal
          -- Set the app to end when the main window is closed.
          CurrentVal = setEndAction(0)
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setIdName, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    setIdName
    (integer controlID, sequence Name)

    Sets the name of a control, given it's id.

    Category: System Attributes

    Also see: getIDName and newUIObj
    This routine ensures that only alphanumeric and '_' characters are in the name. All other characters stripped off the Name parameter.

    Example

          sequence name
          setIdName(myWindow, "Prime Window")
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setMainWindow, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setMainWindow
    (integer New)

    Used to tell the library which window is the primary one.

    Category: System Attributes

    This is only used if you wish to change the default window that is set by calling WinMain().

    Example

          integer CurWin
          CurWin = setMainWindow( AltWindow )
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setTooltipTiming, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setTooltipTiming
    (integer id,object timings)

    Possibly sets the timings for all the tooltips the tooltip conrol id manages.

    Returns: The previous or current values.

    Category: System Attributes

    Three durations are associated to a tooltip. If timings is a sequence, its elements are:

  • the initial delay (in miliseconds) during which the mouse must hover for the tooltip window to pop up;
  • the autopop duration, in miliseconds: this is the time during which the tooltip window remeinas visible;
  • the reshow delay, in milliseconds: delay from a change of hovered upon control and the next popping up of a tooltip window for the new target control. For each of these, use w32False to set to default and w32GetValue to return without setting. If timings is a positive integer, the initial delay is set to the supplied value, the autopop duration to ten times the initial delay, and the reshow delay to a fifth of the initial delay. Using w32False will return the values to default - 500, 5000 and 100ms respetivelly. Using w32GetValue will skip any setting. At any rate, the three timings are returned.

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, validId, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    validId
    (object id)

    Tests to see if the specified id is a valid one.

    Returns: w32True if valid, w32False otherwise.

    Category: System Attributes

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, WinMain


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    WinMain
    ( window, style )

    Run event loop.

    Category: System Attributes

    This is the main processing loop for Win32Lib. Call WinMain after all the controls and their handlers have been defined for the initial running of the application.

    The main window is set to window. When window is closed, the application is shut down. Note that if window is -1 then the first window defined is used as the primary window.

    If you wish to have an application that has no window under the control of win32lib, but still wish to use its Windows Message loop, then set window as 0.

    The style flag is one of the following:

  • Normal: Original size.
  • Minimized: Minimized into the task bar.
  • Maximized: Fills the client area of the screen.

    The WinMain function will open the application's main window.

    It it possible to specify the control that will get the initial focus when the window opens. See openWIndow for details.

    For example:

          -- set MyWindow as main window, open normally
          -- with the initial focus on the Login button.
           WinMain( {MyWindow, btnLogin}, Normal )
    

    See Also: adjustCreateFont, classAutoSelect, classDefaults, clientToClient, ClientToScreen, convPctToPixel, findWindow, getActiveWindow, getAppName, getClassName, getHandle, getHWND, getId, getIdName, getKeyState, getLEDs, getMainWindow, getNameId, getNameIdInContext, getPathFromIDList, getSysColor, getSystemMetrics, getUserName, getWinVersion, loadIconFromFile, manageToolTip, ScreenToClient, setAppName, setAutoFocusLabels, setCreateFont, setEndAction, setIdName, setMainWindow, setTooltipTiming, validId