| Customize Help

C/C++ MILweb function reference



The following functions are available for creating a MILweb client with the C/C++ MILweb API.

To use these functions, you must include milweb.h and link to milwebclient.dll (under Windows) or milwebclient.so (under Linux).

The C++ function names are used. For C, replace the namespace with the prefix MilWeb. For example, instead of MilWeb::MappCloseConnection use MilWebMappCloseConnection.

MilWeb::Mapp

The functions prefixed with MilWeb::Mapp make up the MILweb Application module. The MILweb Application module allows you to connect to a MILweb server, inquire the MIL identifiers of objects published by a MILweb server, and hook functions to connection and publishing events.

MilWeb::MappCloseConnection

This function closes a connection to a MILweb server application opened by MilWeb::MappOpenConnection.

This function is similar, but not identical, to the MIL function MappCloseConnection().

void MilWeb::MappCloseConnection (MIL_ID AppId)

AppId

Specifies the client-side MIL application context identifier of the MILweb server application from which to disconnect. The application identifier must have been previously obtained, typically when connecting to the MILweb server application using MilWeb::MappOpenConnection.

MilWeb::MappControl

This function controls the settings of your MILweb client application environment.

This function is similar, but not identical, to the MIL function MappControl().

void MilWeb::MappControl (MIL_ID AppId, MIL_INT64 ControlType, MIL_INT ControlFlag)

ContextAppId

This parameter is reserved for future expansion and must be set to M_DEFAULT.

ControlType

Specifies the type of application setting about which to inquire. This parameter can be set to one of the following values:

M_ERROR

Sets whether the printing of error messages to screen is enabled.

In this case, set ControlFlag to one of the following values:

M_PRINT_DISABLE

Specifies not to print error messages.

If error printing is disabled, you can still check for errors. To do so, hook a function to application errors using MilWeb::MappHookFunction with M_ERROR. You can retrieve the error code within the hook-handler function, using MilWeb::MappGetHookInfo with M_ERROR.

M_PRINT_ENABLE

Specifies to print error messages.

This is the default value.

ControlFlag

Specifies the setting's new value.

See the ControlType parameter for possible values that can be specified.

MilWeb::MappGetHookInfo

This function retrieves information about the event that caused the hook-handler function to be called. This function should only be called within the scope of an application hook-handler function call (see MilWeb::MappHookFunction).

The returned value is the requested information.

This function is similar, but not identical, to the MIL function MappGetHookInfo().

MIL_INT MilWeb::MappGetHookInfo (MIL_ID AppId, MIL_ID EventId, MIL_INT64 InfoType, void * UserVarPtr)

AppId

This parameter is reserved for future expansion and must be set to M_DEFAULT.

EventId

Specifies the application event identifier received by the hook-handler function

InfoType

Specifies the type of information to get. This parameter can be set to one of the following values:

M_CURRENT

If the hook-handler function was called due to an M_ERROR event type:

Retrieves the error code returned by the last MILweb function call. The current-error code is reset to M_NULL_ERROR before each MILweb function call and is set to a specific error code if an error occurs while trying to execute the function.

This only retrieves error codes for your MILweb client application; it does not retrieve error codes for the MILweb server.

In this case, UserVarPtr returns the error code and the recommended casting type for the data is MIL_INT.

You can combine this value with M_MESSAGE.

M_CURRENT_SUB_1

If the hook-handler function was called due to an M_ERROR event type:

Retrieves the first error subcode returned by the last MILweb function call.

Note that when there is no error, the error subcode is set to M_NULL_ERROR.

This only retrieves error subcodes for your MILweb client application; it does not retrieve error codes for the MILweb server.

In this case, UserVarPtr returns the error subcode and the recommended casting type for the data is MIL_INT.

You can combine this value with M_MESSAGE.

M_CURRENT_SUB_NB

If the hook-handler function was called due to an M_ERROR event type:

Retrieves the number of error subcodes associated with the last MILweb function called, when it returns an error.

In this case, UserVarPtr returns the number of error subcodes and the recommended casting type for the data is MIL_INT.

M_OBJECT_ID

Retrieves the client-side MIL identifier of the MILweb server application or MIL object that generated the event.

Note that this MIL identifier should only be used within the instance of your MILweb client application that called this function. The MILweb server application, and other instances of your MILweb client application, use a different MIL identifier to refer to the same object.

In this case, UserVarPtr returns the client-side MIL identifier of the MILweb server application and the recommended casting type for the data is MIL_ID.

M_WEB_CLIENT_INDEX

Retrieves the index of this instance of the MILweb client application, from the perspective of the MILweb server application that generated the event.

This index is guaranteed not to change until this instance of the MILweb client application is disconnected. Note that this is not an iterable index; connected instances of your MILweb client are not guaranteed to be assigned sequential indices, and the indices do not shift when a client disconnects.

If this instance of the MILweb client is connected to multiple MILweb servers, each MILweb server assigns a different index to this instance of the MILweb client.

In this case, UserVarPtr returns the index of this instance of the MILweb client and the recommended casting type for the data is MIL_INT.

You can combine M_CURRENT and M_CURRENT_SUB_1 with the following:

M_MESSAGE

Returns the error message instead of the error code.

In this case, the recommended casting type for the data written to UserVarPtr is an array of MIL_TEXT_CHAR [optionally, in C++: MIL_STRING ].

You can combine this value with M_STRING_SIZE.

You can combine M_MESSAGE with the following:

M_STRING_SIZE

Retrieves the length of the string, including the terminating null character ("\0").

In this case, the recommended casting type for the data written to UserVarPtr is MIL_INT.

UserVarPtr

Specifies the address in which to write the requested information. Since this function also returns the requested information, you can set this parameter to M_NULL.

MilWeb::MappHookFunction

This function allows you to attach or detach a user-defined function to a specified application event. Once a hook-handler function is defined and hooked to an event, it is automatically called when the event occurs.

This function is similar, but not identical, to the MIL function MappHookFunction().

void MilWeb::MappHookFunction (MIL_ID AppId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandlerPtr, void * UserDataPtr)

AppId

Specifies the client-side MIL identifier of the MILweb server application to which to hook the function. The application identifier must have been previously obtained, typically when connecting to the MILweb server application using MilWeb::MappOpenConnection.

HookType

Specifies the event type. This parameter can be set to one of the following values:

To detach (unhook) a function you previously hooked, combine the event type with M_UNHOOK (for example, M_CONNECT + M_UNHOOK).

M_CONNECT

Specifies to call the hook-handler function when your MILweb client application establishes a connection to the specified MILweb server application (or one of its published MIL objects).

You can use MilWeb::MappGetHookInfo with M_OBJECT_ID to learn which application or object connected, and MilWeb::MobjInquire with M_OBJECT_TYPE to learn the type of the application or object.

M_DISCONNECT

Specifies to call the hook-handler function when your MILweb client application disconnects from the specified MILweb server application (or one of its published MIL objects).

You can use MilWeb::MappGetHookInfo with M_OBJECT_ID to learn which application or object disconnected, and MilWeb::MobjInquire with M_OBJECT_TYPE to learn the type of the application or object.

M_ERROR

Specifies to call the hook-handler function when an error occurs while attempting to connected to the MILweb server application or published MIL object.

M_OBJECT_PUBLISH_WEB

Specifies to call the hook-handler function each time the specified MILweb server application publishes or unpublishes an object.

HookHandlerPtr

Specifies the address of the function that should be called when an event occurs.

This function must have the following prototype: MIL_INT MFTYPE HookHandler(MIL_INT HookType, MIL_ID EventId, void * UserDataPtr).

UserDataPtr

Specifies the address of the user data that you want to make available to the hook-handler function. This address is passed to the hook-handler function, through its UserDataPtr parameter, when the specified event occurs. Set this parameter to M_NULL if user data is not required.

MilWeb::MappInquire

This function inquires about the specified application setting of either the MILweb client or MILweb server application.

The returned value is the requested information.

This function is similar, but not identical, to the MIL function MappInquire().

MIL_INT MilWeb::MappInquire (MIL_ID AppId, MIL_INT64 InquireType, void * UserDataPtr)

AppId

Specifies the client-side MIL identifier of the MILweb server application, the settings of which to inquire. The application identifier must have been previously obtained, typically when connecting to the MILweb server application using MilWeb::MappOpenConnection.

To inquire about a setting of the MILweb client application, set this parameter to M_DEFAULT.

See the description of a setting for the InquireType parameter to learn whether the setting inquires the MILweb client applicaton or MILweb server application.

InquireType

Specifies the type of application setting about which to inquire. This parameter can be set to one of the following values:

M_ERROR

Inquires the error printing mode of the MILweb client application.

In this case, the recommended casting type for the data written to UserDataPtr is MIL_INT, and it returns one of the following values:

M_PRINT_DISABLE

Specifies not to print error messages.

M_PRINT_ENABLE

Specifies to print error messages.

M_WEB_CLIENT_INDEX

Retrieves the index of this instance of the MILweb client application, from the perspective of the specified MILweb server application. This index does not change for this instance of the MILweb client as long as it is connected. If this instance of the client disconnects and then reconnects, it is assigned a new index by the MILweb server.

If this instance of the MILweb client is connected to multiple MILweb servers, each MILweb server assigns a different index to this instance of the MILweb client.

Indexes of MILweb clients are not zero or one-based, nor are they sequential.

In this case, UserDataPtr returns the index of this instance of the MILweb client and the recommended casting type for the data is MIL_INT.

UserDataPtr

Specifies the address in which to write the requested information. Since this function also returns the requested information, you can set this parameter to M_NULL.

MilWeb::MappInquireConnection

This function inquires about the published MIL objects in the MILweb server application.

The returned value is the requested information.

This function is similar, but not identical, to the MIL function MappInquireConnection().

MIL_INT MilWeb::MappInquireConnection (MIL_ID AppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void * UserVarPtr)

AppId

Specifies the client-side MIL identifier of the MILweb server application, the published objects about which to inquire. The application identifier must have been previously obtained, typically when connecting to the MILweb server application using MilWeb::MappOpenConnection.

InquireType

Specifies the type of application setting about which to inquire. This parameter can be set to one of the following values:

M_WEB_PUBLISHED_LIST

Inquires the list of client-side MIL identifiers associated with the MIL objects published by the MILweb server application.

Published MIL objects are those MIL objects set to read or read/write.

In this case, UserDataPtr returns an array of client-side MIL identifiers of the published objects and the recommended casting type for the data is an array of type MIL_ID.

Use this function with M_WEB_PUBLISHED_LIST_SIZE to learn the number of published objects.

M_WEB_PUBLISHED_LIST_SIZE

Inquires the current number of MIL objects published by the MILweb server application.

In this case, UserDataPtr returns the number of published objects and the recommended casting type for the data is MIL_INT.

M_WEB_PUBLISHED_NAME

Inquires the Client-side MIL identifier of a published MIL object associated with the name specified by the ControlFlag parameter. This name must have been previously associated with an object in the MILweb server application using MobjControl() with M_OBJECT_NAME.

In this case, set ControlFlag to M_PTR_TO_MIL_INT(MIL_TEXT("ObjectName")). If you are passing the object name in a variable, don't enclose it in MIL_TEXT().

In this case, UserDataPtr returns the client-side MIL identifier of the published object and the recommended casting type for the data is MIL_ID.

Note that this client-side MIL identifier should only be used within the instance of your MILweb client application that called this function. The MILweb server application, and other instances of your MILweb client application, use a different MIL identifier to refer to the same object.

ControlFlag

Specifies an attribute of the inquire operation to perform.

If this parameter is not required for the inquire operation, it must be set to M_DEFAULT.

See the InquireType parameter for possible values that can be specified.

ExtraFlag

This parameter is reserved for future expansion and must be set to M_DEFAULT.

UserVarPtr

Specifies the address in which to write the requested information. Since this function also returns the requested information, you can set this parameter to M_NULL.

MilWeb::MappOpenConnection

This function opens a connection to a MILweb server application, through the listening port of the MILweb server application. The MILweb server application can be running on a local or remote computer.

You can later close the connection using MilWeb::MappCloseConnection.

This function is similar, but not identical, to the MIL function MappOpenConnection().

void MilWeb::MappOpenConnection (MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID * RemoteContextAppIdPtr)

ConnectionDescriptor

Specifies the computer to which to connect, and if necessary the listening port of the MILweb server application.

You must specify the prefix "ws://", followed by the domain name or IP address of the computer, optionally followed by the listening port number. This should be enclosed in the MIL_TEXT macro. For example, MIL_TEXT("ws://localhost:7861") or MIL_TEXT("ws://192.168.1.51:7861").

You can always use the domain name localhost to connect to a MILweb server application running on the local computer.

In your MIL application, you can set the listening port using MappControl() with M_WEB_CONNECTION_PORT. The default port is 7861.

InitFlag

This parameter is reserved for future expansion and must be set to M_DEFAULT.

ControlFlag

This parameter is reserved for future expansion and must be set to M_DEFAULT.

RemoteContextAppIdPtr

Specifies the address in which to write the client-side identifier of the MILweb server. If the connection fails, the value M_NULL is written.

Note that this client-side MIL identifier should only be used within the instance of your MILweb client application that called this function. The MILweb server application, and other instances of your MILweb client application, use a different MIL identifier to refer to the same object.

MilWeb::Mdisp

The functions prefixed with MilWeb::Mdisp make up the MILweb Display module. The MILweb Display module allows you to show a published display in an HTML5 canvas, enable interactive manipulation of a published display, and hook functions to display events (such as user interaction).

MilWeb::MdispControl

This function controls the specified MIL display setting.

This function is similar, but not identical, to the MIL function MdispControl().

void MilWeb::MdispControl (MIL_ID DisplayId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag)

DisplayId

Specifies the client-side MIL display identifier of the display. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

ControlType

Specifies the type of application setting about which to inquire. This parameter can be set to one of the following values:

M_INTERACTIVE

Sets whether the local user can interact with the display.

For C/C++, MILweb does not automatically transmit user input to the MILweb server. You must manually pass through user input to the MIL display using MilWeb::MdispMessage.

To learn the default keyboard controls, see M_KEYBOARD_USE.

In this case, set ControlFlag to one of the following values:

M_DISABLE

Specifies that the local user can interact with the display, using a keyboard and mouse.

Only one connected instance of your MILweb client application can enable this feature at a time for the specified display. If another instance of the MILweb client application has this feature enabled for the specified display, this function has no effect.

M_ENABLE

Specifies that the local user cannot interact with the display.

Note that this instance of your MILweb client application will still generate mouse and keyboard events for the purposes of hooked functions. However, the events are not sent to the MILweb server application, or other instances of your MILweb client application.

This is the default value.

M_UPDATE_WEB

Sets whether the MILweb server application should send updated images of this display to this instance of the MILweb client application.

In this case, set ControlFlag to one of the following values:

M_DISABLE

Specifies not to update the display.

M_ENABLE

Specifies to update the display. Also, the display is forced to update immediately.

This is the default value.

M_NOW

Specifies to force an immediate update of the display. In this case, the display is updated even if M_UPDATE_WEB is set to M_DISABLE.

M_WEB_PUBLISHED_FORMAT

Sets whether to automatically convert the transmitted image to a different color format.

If you do not set this control, the transmitted image is stored in the RGBA32 color format.

The image of the display is always transmitted in the RGBA32 color format (the alpha channel is not used). If this control is set, conversion to a different format is performed on the local computer. This setting does not affect the display on the MILweb server, or other instances of the MILweb client.

In this case, set ControlFlag to the following value:

M_BGR32

Specifies to convert the image to the BGRA32 color format (the alpha channel is not used).

Once this control is set, it is not possible to revert it to the default (RGBA32) color format. To restore the default setting you must reinitialize the connection between this instance of your MILweb client and MILweb server.

ControlFlag

Specifies the setting's new value.

See the ControlType parameter for possible values that can be specified.

MilWeb::MdispGetHookInfo

This function retrieves information about the event that caused the hook-handler function to be called. This function should only be called within the scope of a display hook-handler function call (see MilWeb::MdispHookFunction).

The returned value is the requested information.

This function is similar, but not identical, to the MIL function MdispGetHookInfo().

MIL_INT MilWeb::MdispGetHookInfo (MIL_ID EventId MIL_INT64 InfoType, void * UserVarPtr)

EventId

Specifies the display event identifier received by the hook-handler function.

InfoType

Specifies the type of information to get. This parameter can be set to one of the following values:

M_DISPLAY

Retrieves the client-side MIL identifier of the display that generated the event.

Note that this MIL identifier should only be used within the instance of your MILweb client application that called this function. The MILweb server application, and other instances of your MILweb client application, use a different MIL identifier to refer to the same object.

In this case, UserDataPtr returns the index of this instance of the MILweb client and the recommended casting type for the data is MIL_INT.

UserVarPtr

Specifies the address in which to write the requested information. Since this function also returns the requested information, you can set this parameter to M_NULL.

MilWeb::MdispHookFunction

This function allows you to attach or detach a user-defined function to a specified display event. Once a hook-handler function is defined and hooked to an event, it is automatically called when the event occurs.

This function is similar, but not identical, to the MIL function MdispHookFunction().

void MilWeb::MdispHookFunction (MIL_ID DisplayId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandlerPtr, void * UserDataPtr)

ObjectId

Specifies the client-side MIL display identifier of the display to use. This identifier must have been previously inquired, typically using MappInquireConnection with M_WEB_PUBLISHED_NAME.

HookType

Specifies the event type. This parameter can be set to one of the following values:

To detach (unhook) a function you previously hooked, combine the event type with M_UNHOOK (for example, M_UPDATE_INTERACTIVE_STATE + M_UNHOOK).

M_UPDATE_INTERACTIVE_STATE

Specifies to call the hook-handler function each time a MILweb client takes or releases interactive control of the display (using MilWeb::MdispControl with M_INTERACTIVE). This includes other connected instances of your MILweb client application.

HookHandlerPtr

Specifies the address of the function that should be called when an event occurs.

This function must have the following prototype: MIL_INT MFTYPE HookHandler(MIL_INT HookType, MIL_ID EventId, void * UserDataPtr).

UserDataPtr

Specifies the address of the user data that you want to make available to the hook-handler function. This address is passed to the hook-handler function, through its UserDataPtr parameter, when the specified event occurs. Set this parameter to M_NULL if user data is not required.

MilWeb::MdispInquire

This function inquires about the specified display setting.

The returned value is the requested information.

This function is similar, but not identical, to the MIL function MdispInquire().

MIL_INT MilWeb::MdispInquire (MIL_ID DisplayId, MIL_INT64 InquireType, void * UserDataPtr)

DisplayId

Specifies the client-side MIL display identifier of the display to use. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

InquireType

Specifies the type of display setting about which to inquire. This parameter can be set to one of the following values:

M_IMAGE_HOST_ADDRESS

Inquires the host address (on the computer running your MILweb client application) of the bitmap image of the display transmitted by the MILweb server application. This address can be used to directly access the data of the transmitted image with the Host CPU.

The image is always transmitted in the RGBA32 packed format, whereby the different color components of each pixel are stored sequentially as 8-bit values (starting with the R value).

You can specify to automatically convert the data to the BGRA32 packed format using MilWeb::MdispControl with M_WEB_PUBLISHED_FORMAT and M_BGR32. In this case, MilWeb::MdispInquire returns the host address of the converted image data.

To learn the size and pitch of the image, use MilWeb::MdispInquire with M_SIZE_X, M_SIZE_Y, and M_PITCH_BYTE.

In this case, UserDataPtr returns the host address of the image and the recommended casting type for the data is MIL_INT8 *.

M_INTERACTIVE

Inquires whether the local user can interact with the display.

In this case, the recommended casting type for the data written to UserDataPtr is MIL_INT, and it returns one of the following values:

M_DISABLE

Specifies that the local user can interact with the display, using a keyboard and mouse.

M_ENABLE

Specifies that the local user cannot interact with the display.

M_PITCH_BYTE

Inquires the number of bytes between the beginnings of any two adjacent lines of the transmitted image data.

In this case, UserDataPtr returns the pitch of the transmitted image (in bytes) and the recommended casting type for the data is MIL_INT.

M_SIZE_BYTE

Inquires the total number of bytes in the transmitted image data.

In this case, UserDataPtr returns the size of the image data (in bytes) and the recommended casting type for the data is MIL_INT.

M_SIZE_X

Inquires the width of the transmitted image.

In this case, UserDataPtr returns the width of the transmitted image (in pixels) and the recommended casting type for the data is MIL_INT.

M_SIZE_Y

Inquires the height of the transmitted image.

In this case, UserDataPtr returns the height of the transmitted image (in pixels) and the recommended casting type for the data is MIL_INT.

M_WEB_PUBLISHED_FORMAT

Inquires the color format the bitmap image of the display, transmitted by the MILweb server application.

The image of the display is always transmitted in the RGBA32 format. If another color format is specified, the conversion is performed automatically on the local computer.

In this case, the recommended casting type for the data written to UserDataPtr is MIL_INT, and it returns one of the following values:

M_BGR32

Specifies that the image is automatically converted to the BGRA32 format (the alpha channel is not used).

M_RGB32

Specifies that the image is not converted; it remains in the transmitted RGBA32 format (the alpha channel is not used).

UserDataPtr

Specifies the address in which to write the requested information. Since this function also returns the requested information, you can set this parameter to M_NULL.

MilWeb::MdispMessage

This function genrates a mouse or keyboard event to be for the specified display. This manipulates the display if interactive control is enabled (using MilWeb::MdispControl with MilWeb.M_INTERACTIVE), and generates an event for the purposes of hooked functions. This allows you to simulate keyboard and mouse input.

Note that if interactive control is not enabled, the event is only generated for this instance of your MILweb client application (not for the MILweb server application). The event is never generated for other instances of your MILweb client application.

This function is not similar to any MIL function.

void MilWeb::MdispMessage (MIL_ID DisplayId, MIL_INT EventType, MIL_INT MousePositionX, MIL_INT MousePositionY, MIL_INT EventValue, MIL_INT CombinationKeys, MIL_INT UserValue)

DisplayId

Specifies the client-side MIL display identifier of the display to use. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

EventType

Specifies the type of event to generate. This parameter can be set to one of the following values:

M_KEY_DOWN

Specifies to generate an event as though a key was depressed.

In this case, set EventValue to one of the MIL constants associated with M_MIL_KEY_VALUE.

M_KEY_UP

Specifies to generate an event as though a key was released.

In this case, set EventValue to one of the MIL constants associated with M_MIL_KEY_VALUE.

M_MOUSE_LEFT_BUTTON_DOWN

Specifies to generate an event as though the left mouse button was pressed.

In this case, set EventValue to M_NULL.

M_MOUSE_LEFT_BUTTON_UP

Specifies to generate an event as though the left mouse button was released.

In this case, set EventValue to M_NULL.

M_MOUSE_MIDDLE_BUTTON_DOWN

Specifies to generate an event as though the middle mouse button was depressed.

In this case, set EventValue to M_NULL.

M_MOUSE_MIDDLE_BUTTON_UP

Specifies to generate an event as though the middle mouse button was released.

In this case, set EventValue to M_NULL.

M_MOUSE_MOVE

Specifies to generate an event as though the mouse was moved.

In this case, set MousePositionX and MousePositionY to the X and Y positions (in display coordinates) to which to simulate moving the mouse.

M_MOUSE_RIGHT_BUTTON_DOWN

Specifies to generate an event as though the right mouse button was depressed.

In this case, set EventValue to M_NULL.

M_MOUSE_RIGHT_BUTTON_UP

Specifies to generate an event as though the right mouse button was released.

In this case, set EventValue to M_NULL.

M_MOUSE_WHEEL

Specifies to generate an event as though the mouse wheel was moved.

In this case, set EventValue to the simulated value for the wheel's rotation. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotate backward, toward the user.

MousePositionX

Specifies the simulated position of the mouse cursor along the X-axis in display coordinates. If not used, set this value to M_DEFAULT.

MousePositionY

Specifies the simulated position of the mouse cursor along the Y-axis in display coordinates. If not used, set this value to M_DEFAULT.

CombinationKeys

Specifies which combination keys to simulate holding. This parameter can be set to M_DEFAULT (which specifies no combination keys), or any combination of the following values:

M_KEY_ALT

Specifies the Alt key.

M_KEY_CTRL

Specifies the CTRL key.

M_KEY_SHIFT

Specifies the Shift key.

M_KEY_WIN

Specifies the Windows key.

UserVar

This parameter is reserved for future expansion and must be set to M_NULL.

MilWeb::MdispZoom

This function associates a zoom factor in X and/or in Y with the specified display. This does not change the size of the image transmitted to the MILweb client; the transmitted image remains the same size as the displayed image buffer, but shows only the zoomed region of the image.

This zooms the display for all instances of your MILweb client application. If you need to zoom the image separately for each instance of your MILweb client application, you must allocate and publish a separate display for each instance and select the image to each display.

This function causes the MILweb server application to call the MIL function MdispZoom().

void MilWeb::MdispZoom (MIL_ID DisplayId, MIL_DOUBLE XFactor, MIL_DOUBLE YFactor)

DisplayId

Specifies the client-side MIL display identifier of the display to use. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

XFactor

Specifies the zoom factor for the X-direction of the display. This value must be larger than 0. A value greater than 1.0 will zoom in, while a value less than 1.0 will zoom out.

YFactor

Specifies the zoom factor for the Y-direction of the display. This value must be larger than 0. This value must be larger than 0. A value greater than 1.0 will zoom in, while a value less than 1.0 will zoom out.

MilWeb::Mobj

The functions prefixed with MilWeb::Mobj make up the MILweb Object module. The MILweb Object module allows you to read and write messages in MIL message mailboxes, inquire the types of published objects, and hook functions to the update and connection events of published objects.

MilWeb::MobjGetHookInfo

This function retrieves information about the event that caused the hook-handler function to be called. This function should only be called within the scope of an object hook-handler function call (see MilWeb::MobjHookFunction).

The returned value is the requested information.

This function is similar, but not identical, to the MIL function MobjGetHookInfo().

MIL_INT MilWeb::MobjGetHookInfo (MIL_ID EventId, MIL_INT64 InfoType, void * UserPtr)

EventId

Specifies the object event identifier that was received by the hook-handler function.

InfoType

Specifies the type of information about the event to return. This parameter can be set to the following value:

M_OBJECT_ID

Retrieves the MIL identifier of the object that generated the event.

Note that this MIL identifier should only be used within the instance of your MILweb client application that called this function. The MILweb server application, and other instances of your MILweb client application, use a different MIL identifier to refer to the same object.

UserPtr

Specifies the address in which to write the requested information. Since this function also returns the requested information, you can set this parameter to M_NULL.

MilWeb::MobjHookFunction

This function allows you to attach or detach a user-defined function to a specified object event. Once a hook-handler function is defined and hooked to an event, it is automatically called when the event occurs.

This function is similar, but not identical, to the MIL function MobjHookFunction().

void MilWeb::MobjHookFunction (MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandlerPtr, void * UserDataPtr)

ObjectId

Specifies the client-side MIL identifier of the object to use. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

HookType

Specifies the event type. This parameter can be set to one of the following values:

To detach (unhook) a function you previously hooked, combine the event type with M_UNHOOK (for example, M_UPDATE_WEB + M_UNHOOK).

M_UPDATE_WEB

Specifies to call the hook-handler function each time the contents of the object changes.

HookHandlerPtr

Specifies the address of the function that should be called when an event occurs.

This function must have the following prototype: MIL_INT MFTYPE HookHandler(MIL_INT HookType, MIL_ID EventId, void * UserDataPtr).

UserDataPtr

Specifies the address of the user data that you want to make available to the hook-handler function. This address is passed to the hook-handler function, through its UserDataPtr parameter, when the specified event occurs. Set this parameter to M_NULL if user data is not required.

MilWeb::MobjInquire

This function inquires about the specified object setting.

The returned value is the requested information.

This function is similar, but not identical, to the MIL function MobjInquire().

MIL_INT MilWeb:: MobjInquire (MIL_ID ObjectId, MIL_INT64 InquireType, void * UserDataPtr)

ObjectId

Specifies the client-side MIL identifier of the object to inquire. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

InquireType

Specifies the type of display setting about which to inquire. This parameter can be set to one of the following values:

M_OBJECT_NAME

Inquires the MIL object's user-defined name (set in the MILweb server application, using MobjControl() with M_OBJECT_NAME).

In this case, UserDataPtr returns the name, and the recommended casting type for the data is an array of MIL_TEXT_CHAR [optionally, in C++: MIL_STRING ].

M_OBJECT_TYPE

Inquires what type of access to the object your MILweb client application has (set in the MILweb server application, using MobjControl() with M_WEB_PUBLISH).

In this case, the recommended casting type for the data written to UserDataPtr is MIL_INT, and it returns one of the following values:

M_APPLICATION

Specifies a MILweb server application.

M_DISPLAY

Specifies a MIL display (allocated using MdispAlloc() in the MILweb server application).

M_MESSAGE_MAILBOX

Specifies a MIL message mailbox (allocated using MobjAlloc() with M_MESSAGE_MAILBOX in the MILweb server application).

M_WEB_PUBLISH

Inquires what type of access to the object your MILweb client application has (set in the MILweb server application, using MobjControl() with M_WEB_PUBLISH).

In this case, the recommended casting type for the data written to UserDataPtr is MIL_INT, and it returns one of the following values:

M_READ_ONLY

Specifies that the object can only be read from by the MILweb client application.

M_READ_WRITE

Specifies that the object can be read from and written to by the MILweb client application.

UserDataPtr

Specifies the address in which to write the requested information. Since this function also returns the requested information, you can set this parameter to M_NULL.

MilWeb::MobjMessageRead

This function reads from a message sent to a message mailbox (previously published by a MILweb server application).

Reading a message using this function always removes the message from the mailbox (if the read operation is successful).

The returned value is the size of the message (the same as the value written in MessageOutSizePtr).

This function is similar, but not identical, to the MIL function MobjMessageRead().

MIL_INT64 MilWeb::MobjMessageRead (MIL_ID MessageId, MIL_INT64 * MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 * MessageTagPtr, MIL_INT64 * StatusPtr, MIL_INT64 OperationFlag)

MessageId

Specifies the client-side MIL identifier of the message mailbox. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

MessagePtr

Specifies the address of the variable in which the message is to be written.

This must be a pointer to an array of type MIL_UINT8 [optionally, in C++: a reference to a std::vector<MIL_UINT8> ].

If M_NULL is specified, this function will instead return the length of the message.

MessageInSize

Specifies the size of the array pointed to by MessagePtr, in bytes. You must set this value to 0 if MessagePtr is set to M_NULL.

When using a standard vector (std::vector) overload function in C++, you can pass M_DEFAULT to this parameter and MIL will automatically determine the size based on the number of items in the vector passed to the parameter.

MessageOutSizePtr

Specifies the address of the variable in which the size of the message to be read will be written. If unused, set to M_NULL.

MessageTagPtr

Specifies the address of the variable in which the message tag associated with the message will be written. If unused, set to M_NULL.

StatusPtr

Specifies the address of the variable in which the status of the read operation will be written. This parameter returns one of the following values.

M_BUFFER_TOO_SMALL

Specifies the current message is not copied or deleted. The returned message length will be the required length in bytes.

M_SUCCESS

Specifies the message is copied to MessagePtr.

OperationFlag

This parameter is reserved for future expansion and must be set to M_DEFAULT.

MilWeb::MobjMessageWrite

This function writes a message that will be added to a message mailbox (previously published by a MILweb server application).

This function is similar, but not identical, to the MIL function MobjMessageWrite().

void MilWeb::MobjMessageWrite (MIL_ID MessageId, const void * MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64 OperationFlag)

MessageId

Specifies the client-side MIL identifier of the message mailbox. This identifier must have been previously inquired, typically using MilWeb::MappInquireConnection with M_WEB_PUBLISHED_NAME.

MessagePtr

Specifies the address of the variable of the user message to write.

This must be a pointer to an array of type MIL_UINT8 [optionally, in C++: a reference to a std::vector<MIL_UINT8> ].

MessageSize

Specifies the length of the message to write, in Bytes.

When using a standard vector (std::vector) overload function in C++, you can pass M_DEFAULT to this parameter and MIL will automatically determine the size based on the number of items in the vector passed to the parameter.

MessageTag

Specifies a user-defined tag to send with the message.

OperationFlag

This parameter is reserved for future expansion and must be set to M_DEFAULT.