NkWindow.dll

Introduction, NkDialog_AddColumn, NkDialog_AddControl, NkDialog_AddControlEx, NkDialog_AddMacroMessageHandler, NkDialog_AddRemoveOptions, NkDialog_AddRow, NkDialog_Create, NkDialog_FindControl, NkDialog_SendMessage, NkDialog_SendMessageString, NkFile_Append, NkFile_BrowseForFolder, NkFile_FindClose, NkFile_FindFirstFile, NkFile_FindNextFile, NkFile_GetOpenFileName, NkFile_Write, NkLsEdit_GetFlags, NkLsEdit_GetValue, NkLsEdit_SetFlags, NkLsEdit_SetFormat, NkLsEdit_SetRange, NkLsEdit_SetScale, NkLsEdit_SetUnit, NkLsEdit_SetValue, NkPMTGainEdit_AttachToHighVoltage, NkPMTGainEdit_IsNkPMTGainEditWindow, NkPMTGainEdit_SetCalibration, NkProgressBar_SetCompletionText, NkWindow_DestroyWindow, NkWindow_FindWindow, NkWindow_FindWindowByText, NkWindow_FindWindowDeep, NkWindow_GetMainWindow, NkWindow_GetMainWindowNext, NkWindow_GetParent, NkWindow_GetWindow, NkWindow_GetWindowLong, NkWindow_GetWindowPos, NkWindow_GetWindowRect, NkWindow_GetWindowSize, NkWindow_PostMessage, NkWindow_SendKeyboardInput, NkWindow_SendMessage, NkWindow_SendMessagePointer, NkWindow_SendMessageString, NkWindow_SendMouseInput, NkWindow_SetForeground, NkWindow_SetWindowLong, NkWindow_SetWindowPos, NkWindow_SetWindowRect, NkWindow_SetWindowSize, NkWindow_ShowWindow

Introduction

Description 

 Introduction();

The commands in the NkWindow.dll library implement creation of a custom dialog with controls. User interaction with the controls can trigger execution of macro functions. Run the macro ~nis\macros\NkWindow.mac to load the library in NIS. The example macros ~nis\Examples\NkPropSheetDemo.mac and ~\nis\Examples\NkWindowDemo.mac illustrate how to create a dialog and assign macros to handle the control notifications. To create a custom dialog, save the file NkPropSheetDemo.mac under a new name; replace the PSD_ prefix with another distinctive acronym and modify the dialog template definition. Most NkWindow commands relay to standard win32 API functions. Documentation for the win32 API is found here: https://learn.microsoft.com/en-us/windows/win32. The NkWindow.dll library includes commands for file operations: writing, appending, browsing and finding files and folders.

Example:

# a fragment from ~nis\Examples\NkPropSheetDemo.mac
int main()
{
if(!ExistProc("NPS_ShowPropertyDialog"))
{
RunMacro("c:/Program Files/NIS-Elements/macros/NkWindow.mac");
RunMacro("c:/Program Files/NIS-Elements/macros/NkPropSheet.mac");
}
PropSheetDemo_ShowDialog(0)
}
NkWindow_GetMainWindow

Description 

 NkWindow_GetMainWindow(
   char *title,
   char *szMainWindowClass,
   long *phMainWindow
);

Returns the window handle of the first top level window that matches the specified title and class. The main window can be specified as parent in the call to NkWindow_Create().

Example:
long hNIS;
NkWindow_GetMainWindow("NIS-Elements","lxMDIClient",&hNis);

Parameters

char *title

The title of the main window. If an empty string is passed, the szMainWindowClass argument should not be empty.

char *szMainWindowClass

The class of the main window. If an empty string is passed, the szMainWindowTitle argument should not be empty.

long *phMainWindow

The reference to the variable in which the handle of the main window is stored. This variable is set to 0 when no top-level window matches the criteria.

NkWindow_GetMainWindowNext

Description 

 NkWindow_GetMainWindowNext(
   char *title,
   char *szMainWindowClass,
   long *phNextMainWindow
);

Returns the window handle of the next top level window that matches the specified title and style. The variable pWnd should be initialized by NkWindow_GetMainWindow().

Parameters

char *title

The title of the main window. If an empty string is passed, the szMainWindowClass argument should not be empty.

char *szMainWindowClass

The class of the main window. If an empty string is passed, the szMainWindowTitle argument should not be empty.

long *phNextMainWindow

The reference to the variable in which the handle of the next main window is stored. This variable is set to 0 when no next top-level window matches the criteria.

NkWindow_FindWindow

Description 

 NkWindow_FindWindow(
   long  hParentWnd,
   char *szChildWindowClass,
   char *szChildWindowTitle,
   long *phChildWindow
);

Finds a child window of the hWnd window with the specified title and class.

Parameters

long hParentWnd

The parent window handle.

char *szChildWindowClass

The class of the window. If an empty string is passed, the szChildWindowTitle argument should not be empty.

char *szChildWindowTitle

The title of the window. If an empty string is passed, the szChildWindowClass argument should not be empty.

long *phChildWindow

The reference to the variable in which the child window handle is stored.

NkWindow_FindWindowDeep

Description 

 NkWindow_FindWindowDeep(
   long  hParentWnd,
   char *szChildTitleOrClass,
   long *phChildWindow
);

Finds a (grant) child window of the hWnd window with the specified title or class.

Parameters

long hParentWnd

The parent window handle.

char *szChildTitleOrClass

The title or class name of the child window.

long *phChildWindow

The reference to the variable in which the child window handle is stored.

NkWindow_FindWindowByText

Description 

 NkWindow_FindWindowByText(
   long  hParentWnd,
   char *szChildTitle,
   long *phChildWindow
);

Finds a (grant) child window of the hWnd window with the specified title.

Parameters

long hParentWnd

The parent window handle.

char *szChildTitle

The title or class name of the (grant) child window.

long *phChildWindow

The reference to the variable in which the child window handle is stored.

NkWindow_GetWindow

Description 

 NkWindow_GetWindow(
   long  hWnd,
   long  uGetWindowCmd,
   long *phWnd
);

Returns the window handle of the window with the specified relation to the hWnd argument by calling the win32 API function. The uCmd argument constants are defined in the macro file win32.mac.

Parameters

long hWnd

The window handle.

long uGetWindowCmd

The relationship between the specified window and the window whose handle is to be retrieved. This parameter can be one of the following values:

GW_CHILD 5

The retrieved handle identifies the child window at the top of the Z order, if the specified window is a parent window; otherwise, the retrieved handle is NULL. The function examines only child windows of the specified window. It does not examine descendant windows.

GW_ENABLEDPOPUP 6

The retrieved handle identifies the enabled popup window owned by the specified window (the search uses the first such window found using GW_HWNDNEXT); otherwise, if there are no enabled popup windows, the retrieved handle is that of the specified window.

GW_HWNDFIRST 0

The retrieved handle identifies the window of the same type that is highest in the Z order. If the specified window is a topmost window, the handle identifies a topmost window. If the specified window is a top-level window, the handle identifies a top-level window. If the specified window is a child window, the handle identifies a sibling window.

GW_HWNDLAST 1

The retrieved handle identifies the window of the same type that is lowest in the Z order. If the specified window is a topmost window, the handle identifies a topmost window. If the specified window is a top-level window, the handle identifies a top-level window. If the specified window is a child window, the handle identifies a sibling window.

GW_HWNDNEXT 2

The retrieved handle identifies the window below the specified window in the Z order. If the specified window is a topmost window, the handle identifies a topmost window. If the specified window is a top-level window, the handle identifies a top-level window. If the specified window is a child window, the handle identifies a sibling window.

GW_HWNDPREV 3

The retrieved handle identifies the window above the specified window in the Z order. If the specified window is a topmost window, the handle identifies a topmost window. If the specified window is a top-level window, the handle identifies a top-level window. If the specified window is a child window, the handle identifies a sibling window.

GW_OWNER 4

The retrieved handle identifies the specified window's owner window, if any.

long *phWnd

The reference to the variable in which the child window handle is stored.

NkWindow_GetParent

Description 

 NkWindow_GetParent(
   long  hWnd,
   long *phParentWnd
);

Returns the window handle of the parent window of the specified window.

Parameters

long hWnd

The window handle.

long *phParentWnd

The reference to the variable in which the parent window handle is stored.

NkWindow_GetWindowLong

Description 

 NkWindow_GetWindowLong(
   long  hWnd,
   long  uGetWindowLongIndex
);

Returns the windows property value on position index of the window by calling the win32 API function GetWindowLong. Check the win32 documentation of GetWindowLong for more details.

Return value: The value of the property.

Parameters

long hWnd

The window handle.

long uGetWindowLongIndex

The index of the property to return.

NkWindow_SetWindowLong

Description 

 NkWindow_SetWindowLong(
   long  hWnd,
   long  uSetWindowLongIndex,
   long  uSetWindowLongValue
);

Sets the windows property value on position index of the window by calling the win32 API function SetWindowLong. Check the win32 documentation of SetWindowLong for more details.

Parameters

long hWnd

The window handle.

long uSetWindowLongIndex

The index of the property to set.

long uSetWindowLongValue

The new value of the property.

NkWindow_DestroyWindow

Description 

 NkWindow_DestroyWindow(
   long  hWnd
);

Destroys the window by calling the win32 API function DestroyWindow(). Use this function only for windows created with NkDialog_Create() and NkDialog_AddControl().

Parameters

long hWnd

The window handle.

NkWindow_ShowWindow

Description 

 NkWindow_ShowWindow(
   long  hWnd,
   long  nShowCmd
);

Shows or hides the window by calling the win32 API function ShowWindow(). The nShowCmd argument constants are defined in the macro file win32.mac.

Parameters

long hWnd

The window handle.

long nShowCmd

The show command. This argument can have the following values:

SW_HIDE 0

Hides the window and activates another window.

SW_SHOWNORMAL 1

Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.

SW_SHOWMINIMIZED 2

Activates the window and displays it as a minimized window.

SW_SHOWMAXIMIZED 3

Activates the window and displays it as a maximized window.

SW_SHOWNOACTIVATE 4

Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except that the window is not activated.

SW_SHOW 5

Activates the window and displays it in its current size and position.

SW_MINIMIZE 6

Minimizes the specified window and activates the next top-level window in the Z order.

SW_SHOWMINNOACTIVE 7

Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.

SW_SHOWNA 8

Displays the window in its current size and position. This value is similar to SW_SHOW, except that the window is not activated.

SW_RESTORE 9

Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.

SW_SHOWDEFAULT 10

Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.

SW_FORCEMINIMIZE 11

Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.

NkWindow_SendMessage

Description 

 NkWindow_SendMessage(
   long  hWnd,
   long  uMsg,
   long  wParam,
   long  lParam
);

Sends a win32 message to the window using the win32 API function SendMessage(). Check out the win32 SendMessage documentation for the arguments.

Parameters

long hWnd

The window handle.

long uMsg

The message.

long wParam

The first message argument.

long lParam

The second message argument.

NkWindow_SendMessageString

Description 

 NkWindow_SendMessageString(
   long  hWnd,
   long  uMsg,
   long  wParam,
   char *szlParam
);

Use this command to send a message to a window for messages that have string pointer as lParam argument.

Parameters

long hWnd

The window handle.

long uMsg

The message.

long wParam

The first message argument.

char *szlParam

The second message argument for messages that have a lParam string pointer argument.

NkWindow_SendMessagePointer

Description 

 NkWindow_SendMessagePointer(
   long  hWnd,
   long  uMsg,
   long  wParam,
   byte *pblParam
);

Use this command to send a message to a window for messages that have byte pointer as lParam argument.

Parameters

long hWnd

The window handle.

long uMsg

The message.

long wParam

The first message argument.

byte *pblParam

The second message argument for messages that have a lParam byte* pointer argument.

NkWindow_PostMessage

Description 

 NkWindow_PostMessage(
   long  hWnd,
   long  uMsg,
   long  wParam,
   long  lParam
);

Sends a win32 message to the window using the win32 API function PostMessage(). Check out the win32 PostMessage documentation for the arguments.

Parameters

long hWnd

The window handle.

long uMsg

The message.

long wParam

The first message argument.

long lParam

The second message argument.

NkWindow_GetWindowRect

Description 

 NkWindow_GetWindowRect(
   long  hWnd,
   long *left,
   long *top,
   long *right,
   long *bottom
);

This command returns the position of all sides of the window.

Parameters

long hWnd

The window handle.

long *left

The left side position of the window.

long *top

The top side position of the window.

long *right

The right side position of the window.

long *bottom

The bottom side position of the window.

NkWindow_SetWindowRect

Description 

 NkWindow_SetWindowRect(
   long  hWnd,
   long  left,
   long  top,
   long  right,
   long  bottom
);

This command sets the position of all sides of the window.

Parameters

long hWnd

The window handle.

long left

The left side position of the window.

long top

The top side position of the window.

long right

The right side position of the window.

long bottom

The bottom side position of the window.

NkWindow_SetWindowPos

Description 

 NkWindow_SetWindowPos(
   long  hWnd,
   long  left,
   long  top
);

This command sets the position of the window.

Parameters

long hWnd

The window handle.

long left

The left side position of the window.

long top

The top side position of the window.

NkWindow_GetWindowPos

Description 

 NkWindow_GetWindowPos(
   long  hWnd,
   long *left,
   long *top
);

This command returns the position of the window.

Parameters

long hWnd

The window handle.

long *left

The left side position of the window.

long *top

The top side position of the window.

NkWindow_GetWindowSize

Description 

 NkWindow_GetWindowSize(
   long  hWnd,
   long *width,
   long *height
);

This command returns the size of the window.

Parameters

long hWnd

The window handle.

long *width

The width of the window.

long *height

The height of the window.

NkWindow_SetWindowSize

Description 

 NkWindow_SetWindowSize(
   long  hWnd,
   long  width,
   long  height
);

This command sets the size of the window.

Parameters

long hWnd

The window handle.

long width

The width of the window.

long height

The height of the window.

NkWindow_SetForeground

Description 

 NkWindow_SetForeground(
   long  hWnd
);

This command moves the window to the foreground by calling the win32 API function SetForeGround().

Parameters

long hWnd

The window handle.

NkWindow_SendMouseInput

Description 

 NkWindow_SendMouseInput(
   long  x,
   long  y,
   long  uSendMouseInputData,
   long  uSendMouseInputFlags
);

This command mimics a mouse input action with the specified conditions. Check the win32 API function SendInput() with the INPUT_MOUSE for more details.

Parameters

long x

The x-coordinate.

long y

The y-coordinate.

long uSendMouseInputData

For wheel events: the amount of wheel movement, for X button events: the index of the button.

long uSendMouseInputFlags

The type of mouse event. Check win32 MOUSEINPUT structure documentation for details.

NkWindow_SendKeyboardInput

Description 

 NkWindow_SendKeyboardInput(
   long  uVirtualKey,
   long  uScanCode,
   long  uSendKeyboardInputFlags
);

This command mimics a keyboard input action with the specified conditions. Check the win32 API function SendInput() with the INPUT_KEYBOARD for more details.

Parameters

long uVirtualKey

The virtual key code.

long uScanCode

The hardware scan code.

long uSendKeyboardInputFlags

Flags indicating a up or down press and the format of the scancode parameter. Check the win32 KEYBDINPUT structure documentation for details.

NkDialog_Create

Description 

 NkDialog_Create(
   long  hDialogParent,
   char *Title,
   long *phDlg
);

This command creates a modeless dialog to which controls can be added using NkDialog_AddControl and NkDialog_AddControlEx. See the macro NkWindowDemo.mac in the ~nis\Examples folder illustrates the use of this function.

Parameters

long hDialogParent

The parent window as returned by NkWindow_GetMainWindow().

char *Title

Title name.

long *phDlg

The address of the variable in which the handle of the created window is returned.

NkDialog_AddRemoveOptions

Description 

 NkDialog_AddRemoveOptions(
   long  hDlg,
   dword  dwDialogOptionsToAdd,
   dword  dwDialogOptionsToRemove
);

This command adds or removes option flags from the dialog. The NKD_AUTONEXTROW can be removed to add controls to the same line (using the left parameter to position them right of the previous control). When the NKD_AUTONEXTROW flag is removed, the function NkDialog_AddRow() must be called to position new controls on the next line.

Parameters

long hDlg

The handle of the dialog.

dword dwDialogOptionsToAdd

Specify 0 to add no options. Specify the option NKD_AUTONEXTROW to enable that NkDialog_AddControl positions new control on a new line.

dword dwDialogOptionsToRemove

Specify 0 to remove no optionsr. Specify the option NKD_AUTONEXTROW to make NkDialog_AddControl position new control on the same line.

NkDialog_AddRow

Description 

 NkDialog_AddRow(
   long  hDlg
);

By default the dialog option NKD_AUTONEXTROW is active and each new control is position on a new line. After removing the option NKD_AUTONEXTROW, new controls are positioned on the same line. Call NkDialog_AddRow() to position the next control on a new row.

Parameters

long hDlg

The handle of the dialog.

NkDialog_AddColumn

Description 

 NkDialog_AddColumn(
   long  hDlg
);

The NkDialog_AddControl command adds a control from top to bottom. Call NkDialog_AddColumn to position the next control on a new column.

Parameters

long hDlg

The handle of the dialog.

NkDialog_AddControl

Description 

 NkDialog_AddControl(
   long  hDlg,
   char *szControlID,
   char *szControlClass,
   long  uControlStyle,
   long  lControlLeftOrHeight,
   long  lControlWidth,
   long *phCtrl
);

This commands adds a control to a dialog created by NkDialog_Create(). See the macro NkWindowDemo.mac in the ~nis\Examples folder illustrates the use of this function. Controls are added from top to bottom. Call NkDialog_AddColumn to move to the next column.

Parameters

long hDlg

The handle of the dialog.

char *szControlID

The identifier of the control, that can be used with FindControl() to get the handle of the control.

char *szControlClass

The class name of the control. All standard win32 control classes are supported. In addition the NkWindow library implements these control classes:

NkLsEdit

EDIT control for numbers in a range. Check the NkLsEdit_ commands for specifying the range, scale, format, unit and other options.

NkLsScrollbar

SCROLLBAR that connects to the previously created NkLsEdit control.

NkProgressbar

msctls_progress32 control that supports automatically counting up or down and can show a text on completion. Set a timer with ID to count up; set a timer with ID 2 to count down. Use the command NkProgressBar_SetCompletionText() to set the completion text.

NkPMTGainEdit

a NkLsEdit control that implements the double logarithmic relation between PMT High Voltage and gain. Check the NkPMTGainEdit_ functions for details.

long uControlStyle

The style options for the control. Check the documentation of the win32 control class for available style options. The styles WS_VISIBLE and WS_CHILD are automatically added when creating the control.

long lControlLeftOrHeight

The left position of the control (relative to the current column position). Specify a negative number to create a control that spans more rows (e.g. -2 for 2 rows).

long lControlWidth

The width of the control.

long *phCtrl

The address of the variable in which the handle of the created control is returned.

NkDialog_AddControlEx

Description 

 NkDialog_AddControlEx(
   long  hDlg,
   char *szControlID,
   char *szControlClass,
   long  uControlStyleEx,
   long  lControlLeftOrHeight,
   long  lControlWidth,
   long *phCtrl
);

This commands adds a control with an extra style to a dialog created by NkDialog_Create(). See the macro NkWindowDemo.mac in the ~nis\Examples folder illustrates the use of this function. Controls are added from top to bottom. Call NkDialog_AddColumn to move to the next column.

Parameters

long hDlg

The handle of the dialog.

char *szControlID

The identifier of the control, that can be used with FindControl() to get the handle of the control.

char *szControlClass

The class name of the control. All standard win32 control classes are supported. In addition the NkWindow library implements these control classes:

NkLsEdit

EDIT control for numbers in a range. Check the NkLsEdit_ commands for specifying the range, scale, format, unit and other options.

NkLsScrollbar

SCROLLBAR that connects to the previously created NkLsEdit control.

NkProgressbar

msctls_progress32 control that supports automatically counting up or down and can show a text on completion. Set a timer with ID to count up; set a timer with ID 2 to count down. Use the command NkProgressBar_SetCompletionText() to set the completion text.

NkPMTGainEdit

a NkLsEdit control that implements the double logarithmic relation between PMT High Voltage and gain. Check the NkPMTGainEdit_ functions for details.

long uControlStyleEx

The extra style options for the control. E.G. use WS_EX_CLIENTEDGE for EDIT controls to get a nice border.

long lControlLeftOrHeight

The left position of the control (relative to the current column position). Specify a negative number to create a control that spans more rows (e.g. -2 for 2 rows).

long lControlWidth

The width of the control.

long *phCtrl

The address of the variable in which the handle of the created control is returned.

NkDialog_AddMacroMessageHandler

Description 

 NkDialog_AddMacroMessageHandler(
   long  hDlg,
   char *szControlID,
   long  uMsg,
   long  wParam,
   long  wParamMask,
   long  lParam,
   long  lParamMask,
   char *Macro
);

This command registers a NIS macro that is invoked when the indicated control receives a message with the specified arguments. Check the win32 control class documentation for the details of notification messages. Many notification IDs are defined in the macro file win32.mac.

Parameters

long hDlg

The handle of the dialog.

char *szControlID

The identifier of the control, that can be used with FindControl() to get the handle of the control.

long uMsg

The message.

long wParam

The first message argument.

long wParamMask

A mask applied to the argument before comparing it with the wParam parameter. Specify 0 both both wParam and wParamMask to accept any value. Specify -1 to compare the full value. Specify 0xFFFF (65535) to compare only the lower 16 bits.

long lParam

The second message argument.

long lParamMask

A mask applied to the argument before comparing it with the wParam parameter. Specify 0 both both wParam and wParamMask to accept any value. Specify -1 to compare the full value. Specify 0xFFFF (65535) to compare only the lower 16 bits.

char *Macro

The command to be invoked.

NkDialog_FindControl

Description 

 NkDialog_FindControl(
   long  hDlg,
   char *szControlID,
   long *phCtrl
);

This command returns the control handle of the control with specified controld ID.

Parameters

long hDlg

The handle of the dialog.

char *szControlID

The identifier of the control, that can be used with FindControl() to get the handle of the control.

long *phCtrl

The address of the variable in which the handle of the created control is returned.

NkDialog_SendMessage

Description 

 NkDialog_SendMessage(
   long  hDlg,
   char *szControlID,
   long  wParam,
   long  lParam
);

Sends a win32 message to the control using the win32 API function SendMessage(). Check out the win32 SendMessage documentation for the arguments.

Parameters

long hDlg

The handle of the dialog.

char *szControlID

The identifier of the control, that can be used with FindControl() to get the handle of the control.

long wParam

The first message argument.

long lParam

The second message argument.

NkDialog_SendMessageString

Description 

 NkDialog_SendMessageString(
   long  hDlg,
   char *szControlID,
   long  wParam,
   char *szlParam
);

Use this command to send a message to a control for messages that have string pointer as lParam argument.

Parameters

long hDlg

The handle of the dialog.

char *szControlID

The identifier of the control, that can be used with FindControl() to get the handle of the control.

long wParam

The first message argument.

char *szlParam

The second message argument for messages that have a lParam string pointer argument.

NkLsEdit_SetRange

Description 

 NkLsEdit_SetRange(
   long  hCtrl,
   double  lower,
   double  higher,
   double  increment
);

This command sets the range and resolution of a NkLsEdit control.

Parameters

long hCtrl

The handle of the control.

double lower

The lower limit of the value.

double higher

The higher limit of the value.

double increment

The resolution of the value.

NkLsEdit_SetScale

Description 

 NkLsEdit_SetScale(
   long  hCtrl,
   double  scale,
   double  Offset
);

his command sets the scale and the offset of a NkLsEdit control. The scale and the offset are applied when calling NkLsEdit_GetValue() and NkLsEdit_SetValue(). E.G. when vbalid values range between 0 and 1000 and a scale of 0.1 and unit % are specified, the value 1000 is shown as 100.0%.

Parameters

long hCtrl

The handle of the control.

double scale

The scale between the value and the text shown in the control.

double Offset

The offset between the value and the text shown in the control.

NkLsEdit_SetFormat

Description 

 NkLsEdit_SetFormat(
   long  hCtrl,
   char *format
);

This command sets sprintf format of the text shown in a NkLsEdit control. E.g. to show a value with two significant digits, use the format %.2lf.

Parameters

long hCtrl

The handle of the control.

char *format

The format used to display the value.

NkLsEdit_SetUnit

Description 

 NkLsEdit_SetUnit(
   long  hCtrl,
   char *unit
);

This command sets the unit for displaying the value in a NkLsEdit control.

Parameters

long hCtrl

The handle of the control.

char *unit

The unit added when displaying the value.

NkLsEdit_SetValue

Description 

 NkLsEdit_SetValue(
   long  hCtrl,
   double  value
);

This command sets the value of a NkLsEdit control. The value is clipped to the lower and higher limits and specified increment. It is displayed with the specified scale, offset, format and unit. When a NkLsScrollbar control is attached, the scrollbar will be updated as well.

Parameters

long hCtrl

The handle of the control.

double value

The new value.

NkLsEdit_GetValue

Description 

 NkLsEdit_GetValue(
   long  hCtrl
);

This command returns the value of a NkLsEdit control.

Return value: the value.

Parameters

long hCtrl

The handle of the control.

NkLsEdit_SetFlags

Description 

 NkLsEdit_SetFlags(
   long  hCtrl,
   dword  uNkLsEditFlags
);

This command sets the options flags of a NkLsEdit control.

Parameters

long hCtrl

The handle of the control.

dword uNkLsEditFlags

Any combination of these values:

1, NKSLE_REVERSE_FLAG

Reverse the scrollbar (left is higher limit; right is lower limit).

2, NKSLE_LOGARITHMIC_FLAG

The scrollbar moves logarithmically.

4, NKSLE_NODRAGNOTIFY_FLAG

Don't send SB_THUMBTRACK and SB_THUMBPOSITION notifications during dragging the scrollbar.

16, NKSLE_NODRAG_FLAG

Don't update the edit box when dragging the scrollbar.

NkLsEdit_GetFlags

Description 

 NkLsEdit_GetFlags(
   long  hCtrl
);

This command returns the options flags of a NkLsEdit control. See the documentation of the NkLsEdit_SetFlags command for details.

Return value: the option flags.

Parameters

long hCtrl

The handle of the control.

NkPMTGainEdit_IsNkPMTGainEditWindow

Description 

 NkPMTGainEdit_IsNkPMTGainEditWindow(
   long  hCtrl
);

This command returns if this control is a NkPMTGainEdit control.

Return value: TRUE (1) if the control is a NkPMTGainEdit control or FALSE (0) if not.

Parameters

long hCtrl

The handle of the control.

NkPMTGainEdit_SetCalibration

Description 

 NkPMTGainEdit_SetCalibration(
   long  hCtrl,
   double  a,
   double  b
);

This command sets the calibration of the double logarithmic relation between the high voltage value and the shown gain. The conversion formula is: gain = a * log10(high_voltage) + b.

Parameters

long hCtrl

The handle of the control.

double a

The calibration value a.

double b

The calibration value b.

NkPMTGainEdit_AttachToHighVoltage

Description 

 NkPMTGainEdit_AttachToHighVoltage(
   long  hCtrl,
   long  hWndHighVoltage
);

This command connects a NkPMTGainGainEdit control to a PMT high voltage EDIT control. When the gain in the NkPMTGainEdit control is changed, the corresponding High Voltage value is send to the PMT high voltage EDIT control.

Parameters

long hCtrl

The handle of the control.

long hWndHighVoltage

The high voltage edit control.

NkProgressBar_SetCompletionText

Description 

 NkProgressBar_SetCompletionText(
   long  hCtrl,
   long  hEdit,
   char *szCompletionText
);

This command programs the NkProgressBar to set the text of the specified hEdit control upon completion.

Parameters

long hCtrl

The handle of the control.

long hEdit

The handle of the edit control.

char *szCompletionText

The completion text.

NkFile_Write

Description 

 NkFile_Write(
   char *file,
   char *text,
   int  bConvertToAscii
);

Saves the text string to the file. An existing file will be overwritten. Set bConvertToAscii to TRUE to convert the 2-byte UNICODE strings used by NIS to 1-byte ASCII characters.

Parameters

char *file

Name of the file.

char *text

The text string that is written to the file.

int bConvertToAscii

Set to 0 to write the text in the 2-byte UNICODE format, 1 to convert the string to the 1-byte ASCII format.

NkFile_Append

Description 

 NkFile_Append(
   char *file,
   char *text,
   int  bConvertToAscii
);

Appends the text string to the file. The file will be created if it does not exist. Set bConvertToAscii to TRUE to convert the 2-byte UNICODE strings used by NIS to 1-byte ASCII characters.

Parameters

char *file

Name of the file.

char *text

The text string that is written to the file.

int bConvertToAscii

Set to 0 to write the text in the 2-byte UNICODE format, 1 to convert the string to the 1-byte ASCII format.

NkFile_FindFirstFile

Description 

 NkFile_FindFirstFile(
   int64 *find_data,
   char *pattern,
   char *szFoundFile
);

Finds the first file that matches the specified pattern. Returns 1 if a file was found. Call NkFile_FindNextFile() to find more files. Call NkFile_FindClose() afterwards.

Return value: 0 when no file matches the pattern, 1 when a file was found.

Parameters

int64 *find_data

The address of a handle used to store the temporary find_data.

char *pattern

The path and file mask, including the wild search characters * and ?

char *szFoundFile

The buffer in which the path and name is returned: it must be at least 260 characters.

NkFile_FindNextFile

Description 

 NkFile_FindNextFile(
   int64 *find_data,
   char *szFoundFile
);

Finds the next file that matches the pattern specified in the call to NkFile_FindFirstFile(). Returns 1 if a file was found. Call NkFile_FindNextFile() to find more files. Call NkFile_FindClose() afterwards.

Return value: 0 when no file matches the pattern, 1 when a file was found.

Parameters

int64 *find_data

The address of the handle initialized by NkFile_FindFirstFile().

char *szFoundFile

The buffer in which the path and name is returned: it must be at least 260 characters.

NkFile_FindClose

Description 

 NkFile_FindClose(
   int64 *find_data
);

Releases the resources allocated when calling NkFile_FindFirstFile().

Parameters

int64 *find_data

The address of the handle initialized by NkFile_FindFirstFile().

NkFile_GetOpenFileName

Description 

 NkFile_GetOpenFileName(
   char *folder,
   char *Name,
   long  name_size,
   char *filter,
   long  filter_index,
   char *Title,
   int64  ofn_flags
);

Prompts the user to browse to a file.

Return values: 1 if the user selected a file, 0 if the user canceled the operation.

Parameters

char *folder

The initial folder.

char *Name

The path and the name of the file.

long name_size

The size of the name array.

char *filter

The file types: a list of | separated fields with the file type extension followed by the mask: e.g. "TIFF Files (*.tif)|*.tif|all files (*.*)|*.*".

long filter_index

The index of the initial selected filter.

char *Title

The title of the dialog.

int64 ofn_flags

The OpenFileName options, e.g.: OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY.

NkFile_BrowseForFolder

Description 

 NkFile_BrowseForFolder(
   char *folder,
   char *Title
);

Prompts the user to browse to a folder.

Return values: 1 if the user selected a file, 2 if the user canceled the operation.

Parameters

char *folder

The initial folder.

char *Title

The title of the dialog.