Driver Library Functions - Quick Reference

The following functions are supplied by the driver library. Most of the functions contained herein are the IB equivalent of a similar Windows API. While not all API's have been provided, we have selected those that are most appropriate for use in a IB application. It should also be noted that many of the dialog and window functions are nothing more than predefined routines that use the SendMessage function to send a command to a window or control. There is no reason why a IB programmer, who finds missing a function he or she requires, cannot write their own function following the style used in #coswin. If people would let us know of any functions that they would like to see included in the library, we will gladly consider them for some future release.

Driver Library State Control Functions

COS.Init Initializes WDL
COS.PushState Stacks the current state of the Driver library
COS.PopState Restores the state of the Driver library
COS.DestroyAll Destroys all dialogs and controls maintaind owned by the Driver Library

Menu Context Functions (Super Nova)

COS.LoadMenuContext Loads a specified menu context onto the frame window (menu/toolbar/accelerators)
COS.LoadMenuContextEx Same as above but with more parameters

Dynamic Link Library Functions

COS.OpenDll Opens an application specified DLL
COS.CloseDll Closes the currently open DLL

Primary Dialog Control Functions

COS.DoModal Creates and executes a modal dialog
COS.EndDialog Terminates a modal dialog
COS.AttachDialog Attaches WDL to an existing dialog
COS.CreateModeless Creates a modeless dialog
COS.DestroyDialog Terminates a modeless dialog

Secondary Dialog Control Functions

COS.FindDialog Find a dialog with a specified ID
COS.ModalLoop Executes a modal loop
COS.ExitModalLoop Terminates a modal loop
COS.EnableInterrupts Allows messages to be received from Windows
COS.DisableInterrupts Disables Windows messages
COS.FlushQueue Clear all messages pending in the msg. queue
COS.InitCmdFilter Initializes a WM.COMMAND filter
COS.AppendCmdFilter Adds entries to a WM.COMMAND filter
COS.InitMsgFilter Initializes a WM. Message filter
COS.AppendMsgFilter Adds entries to a WM. Message filter
COS.DialogHasFocus Determines if any control contained in a specified dialog has the focus.
COS.SetWindowPos Moves a dialog to a window quadrant or center

NOTE: This function has a windows counterpart, but due to an error, the functionality is different. For the functionality of the windows SetWindowPos function use COS.SetWIndowPosEx instead.

Dialog Functions

- These functions, most of which take a control id as an argument, assume the dialog handle is contained in the IB variable cosDlghDlg$.

General Dialog Functions

COS.GetDlgItemText Retrieves text contained in specified control
COS.SetDlgItemText Sets the text in a specified control
COS.SetDlgItemFocus Sets the input focus to the specified control
COS.EnableDlgItem Enables/disables a dialog control
COS.GetDlgItem Retrieves the handle of a dialog control
COS.ShowDlgItem Specifies how a dialog control is to be shown
COS.GetDlgItemTextLength Returns the length of a dialog control's text
COS.DlgMessageBox Displays a message box with a dialog parent

Button Related Dialog Functions

COS.CheckDlgButton Sets the state of a specified button control
COS.IsDlgButtonChecked Gets the state of a specified button control
COS.CheckRadioBtn Checks one of a group of radiobuttons
COS.GetCheckedRadioBtn Returns the currently checked radiobutton
COS.LoadButtonPic Loads a bitmap pushbutton with custom pictures from a resource file.
COS.AutoLoadButtonPic Loads a bitmap pushbutton with pictures from a resource file.

Edit Control Related Dialog Functions

COS.EditLimitText Limits the number of chars. in a edit control
COS.EditSetSel Sets the positions of an edit control selector
COS.EditReplaceSel Replaces selected text with specified text

Combo Box Related Dialog Functions

COS.ComboShowDropdown Open/Close dropdown combobox control
COS.ComboLimitText Set the max. no. of chars. In the edit control
COS.ComboAddString Adds a string to a combobox control
COS.ComboAddStringData Same as above but include 32 bits of data
COS.ComboSetCurSel Sets the index of the currently selected item
COS.ComboGetCurSel Returns the index of the currently selected item
COS.ComboSetEditSel Set the range of selected text In the edit control
COS.ComboResetContent Clears the contents of the combo control
COS.ComboSetItemData Adds 32 bits of data to a combo control item
COS.ComboGetItemData Retrieves the stored 32 bits of item data

List Box Related Dialog Functions

COS.ListAddString Adds a string to a listbox control
COS.ListAddStringData Same as above but include 32 bits of data
COS.ListSetCurSel Selects the current item in a listbox
COS.ListSetSel Selects an item in a multiple-select listbox
COS.ListGetCurSel Returns the index of the currently selected item
COS.ListSetItemData Adds 32 bits of data to a list control item
COS.ListGetItemData Retrieves the stored 32 bits of item data
COS.ListSetTabStops Set the tab stops for a listbox
COS.ListGetCount Returns the number of items in a listbox
COS.ListGetSelCount Returns the number of items select in a multi-select listbox
COS.ListGetSelItemsEx Returns a list of selected items in a multi-select listbox

Static Control Related Dialog Functions

COS.LoadPictureControl Loads a .BMP file into a picture frame control
COS.LoadPictureControlEx Same as above but uses DOS filename

Windows Functions Specific to Comet

COS.GetFrameWnd Returns a handle to the frame window
COS.GetViewWnd Returns a handle to the view window
COS.GetAppWin Same as COS.GetViewWnd
COS.SizeViewToWindow Resizes the view/frame windows to fit a specified window
COS.SizeViewToDialog Resizes the view/frame windows to fit a currently active dialog
COS.SetViewSize Sets the size of the view/frame windows.
COS.SetCaption Sets the caption on the Frame Window title bar
COS.SetStatusMessage Displays a status message on the bottom status bar.
COS.MapCoswRect Converts rectangle from COSW units to pixels
COS.GetCoswBaseUnits Returns the factor by which COSW units are measured.
COS.CreateStatic Creates a "static" control in a window
COS.CreateEdit Creates a "edit" control in a window
COS.CreateListBox Creates a "listbox" control in a window
COS.CreateComboBox Creates a "combobox" control in a window
COS.CreateButton Creates a "button" control in a window
COS.CreateControl Creates a pre-defined control in a window
COS.DestroyControl Destroys the specified Window control
COS.DestroyAllControls Destroys all Window controls

Generic Windows Functions

COS.SetWindowText Sets the text contained in a specified window
COS.GetWindowText Gets the text contained in a specified window
COS.GetWindowTextLength Returns length of text in a specified window
COS.GetTextExtent Returns the width & height of specified text
COS.SendMessage Sends a message to a specified window
COS.PostMessage Posts a message to a specified window
COS.ShowWindow Specifies how a window is to be shown
COS.EnableWindow Enables/disables a window
COS.IsWindowEnabled Determines if a window is enabled/disabled
COS.SetFocus Moves the input focus to the specified window
COS.GetFocus Gets the handle of the window with the focus
COS.GetParent Gets the handle of a window's parent
COS.InvalidateRect Invalidates a specified rectangle of a window
COS.GetDialogBaseUnits Returns the factor by which dialog control units are measured.
COS.MapDialogRect Converts rectangle from dialog units to pixels
COS.ClientToScreen Converts a point from client coordinates to screen coordinates.
COS.GetWindowRect Returns the rectangle defining a window in screen coordinates
COS.GetClientRect Returns the rectangle defining a window in client coordinates.
COS.SetWindowPosEx Moves, sizes and changes z-order of specified the window
COS.MoveWindow Moves and sizes a window to the specified screen coordinates
COS.MessageBox Displays a message box with a specified parent