Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

ExitWindowsMBS(mode as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS Win Plugin No Yes No Yes, Windows only No
Function: Shutdown a Windows PC.
Example:
dim b as boolean
b=ExitWindowsMBS(0)
Notes:
Mode constants:
LOGOFF0Shuts down all processes running in the security context of the process that called the ExitWindows function. Then it logs the user off.
SHUTDOWN1Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped.
REBOOT2Shuts down the system and then restarts the system.
FORCE4Forces processes to terminate. When this flag is set, the system does not send the WM_QUERYENDSESSION and WM_ENDSESSION messages. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.
POWEROFF8Shuts down the system and turns off the power. The system must support the power-off feature.
FORCEIFHUNG16(Windows 2000) Forces processes to terminate if they do not respond to the WM_QUERYENDSESSION or WM_ENDSESSION message. This flag is ignored if FORCE is used.

Returns true if successfull.

The ExitWindows function returns as soon as it has initiated the shutdown. The shutdown or logoff then proceeds asynchronously.

During a shutdown or log-off operation, applications that are shut down are allowed a specific amount of time to respond to the shutdown request. If the time expires, the system displays a dialog box that allows the user to forcibly shut down the application, to retry the shutdown, or to cancel the shutdown request. If the FORCE value is specified, the system always forces applications to close and does not display the dialog box. If the FORCEIFHUNG value is specified, the system forces hung applications to close and does not display the dialog box.

Windows NT: To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.

Some FAQ entries about this method:

Feedback, Comments & Corrections

GestaltMBS(code as string, byref result as Integer) as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS QuickTime Plugin 3.2 Yes Yes No No No
Function: The same as the Gestalt function in Realbasic.
Notes: GestaltMBS supports Windows, what System.Gestalt does not.

Some examples using this method:

Feedback, Comments & Corrections

GetDoubleClickIntervalMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS Util Plugin Yes Yes Yes Yes No
Function: Returns the time in ticks which makes two clicks to one double click.
Example:
sub MouseUp(X as Integer, Y as Integer)
dim currentClickTicks as Integer
currentClickTicks = ticks

if (currentClickTicks - lastClickTicks) <= GetDoubleClickIntervalMBS then
if abs(x - lastClickX) <= 5 and abs (y - lastClickY) <= 5 then
DoubleClick //Fire new Doubleclick event
return
end
end

lastClickTicks = currentClickTicks
lastClickX = x
lastClickY = y
MouseUp
End sub
Notes: Time returned in ticks. One tick is 1/60 of a second.

Feedback, Comments & Corrections

GetMaximumOpenFileCountMacOSXMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSXCF Plugin Yes No Yes Yes No
Function: The number of simultan open files
Example:
msgbox str(GetMaximumOpenFileCountMacOSXMBS)
Notes:
On Mac OS X per default a process can have 256 files open at the same time.
This function allows you to increase the number of open files. It seems that you can't have more than 10240 files open on Mac OS X.
Returns -2 if the function is not available and -1 if the current number of open files is unknown.

Feedback, Comments & Corrections

IsWindows95MBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS Win Plugin 5.4 No Yes No Yes, Windows only No
Function: Checks whether operation system is Windows 95/98/ME.
Example:
if IsWindows95MBS then
MsgBox "Windows 95/98/ME"
else
MsgBox "no Windows 95/98/ME"
end if
Notes: Returns true or false on Windows and alway false on other platforms.

Some examples using this method:

Feedback, Comments & Corrections

IsWindowsAdminUserMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS Win Plugin 5.4 No Yes No Yes, Windows only No
Function: Checkes whether the current user is an Admin User on Windows.
Example:
if IsWindowsAdminUserMBS then
MsgBox "Is admin user."
else
MsgBox "no admin user."
end if
Notes: Returns true or false on Windows and alway false on other platforms.

Some examples using this method:

Feedback, Comments & Corrections

IsWindowsNTMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS Win Plugin 5.4 No Yes No Yes, Windows only No
Function: Checks whether operation system is Windows NT/2000/XP.
Example:
if IsWindowsNTMBS then
MsgBox "Windows NT/2000/XP"
else
MsgBox "no Windows NT/2000/XP"
end if
Notes: Returns true or false on Windows and alway false on other platforms.

Some examples using this method:

Feedback, Comments & Corrections

MacCountryCodeMBS as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS Mac Plugin 3.1 Yes No No No No
Function: Returns the country code for
Example:
msgbox MacCountryCodeMBS // Shows DE in Germany.
Notes:
On any error returns "".
Requires Mac OS 8.6 or newer (or Mac OS X).
Fix in Plugin version 4.0 to no longer return random strings, but now you must accept that this function may fail on Mac if it has nothing to report. (unkown reason)

Feedback, Comments & Corrections

OpenMacOSXPreferencesPaneMBS(name as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSX Plugin 2.8 Yes No No Yes, macOS only No
Function: Opens a named preference pane on Mac OS X.
Example:
dim e as Integer
e=OpenMacOSXPreferencesPaneMBS("Network")
Notes:
Returns a Mac OS X error code. For example -43 if file not found, -1 if function is not available or 0 if successfull.

Possible values for Mac OS X:
UniversalAccessPref
StartupDisk
Speech
Sound
Network
MyAccount
Mouse
LoginItems
Localization
Keyboard
Internet
Ink
General
EnergySaver
DigiHubDiscs
DesktopPictures
Dock
ColorSync
QuickTime
Classic
Bluetooth
ARDPref
DateAndTime
Accounts
Displays
SoftwareUpdate
SharingPref
ScreenSaver

Some examples using this method:

Some FAQ entries about this method:

Feedback, Comments & Corrections

RunningOnCarbonXMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSX Plugin Yes No No Yes, macOS only No
Function: Returns true if we are running Carbon on Mac OS X.
Example:
if RunningOnCarbonXMBS then
' do Stuff for Mac OS X only
end if
Notes: Does always return false on Windows and Mac OS Classic.

Some examples using this method:

Feedback, Comments & Corrections

SetMaximumOpenFileCountMacOSXMBS(Value as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSXCF Plugin Yes No Yes Yes No
Function: The number of simultan open files
Example:
SetMaximumOpenFileCountMacOSXMBS 500
Notes:
On Mac OS X per default a process can have 256 files open at the same time.
This function allows you to increase the number of open files. It seems that you can't have more than 10240 files open on Mac OS X.

Some examples using this method:

Feedback, Comments & Corrections

ShowCharacterPaletteMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSX Plugin 4.1 Yes No No Yes, macOS only No
Function: Shows the character palette.
Example:
ShowCharacterPaletteMBS
Notes:
Works on Mac OS X 10.3 and newer.
We have no way to close this window.

Some FAQ entries about this method:

Feedback, Comments & Corrections

SystemControlByNameMBS(name as string) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSXCF Plugin 6.2 Yes No Yes Yes No
Function: The SystemControlByNameMBS function retrieves system information and allows processes with appropriate privileges to set system information.
Example:
dim m1 as MemoryBlock = SystemControlByNameMBS("hw.physicalcpu")
dim m2 as MemoryBlock = SystemControlByNameMBS("hw.logicalcpu")

MsgBox "physicalcpu: "+str(m1.Long(0))+EndOfLine+"logicalcpu: "+str(m2.Long(0))
Notes:
The name is given as an ASCII string.
Returns nil on any error.

See also:

Some examples using this method:

Feedback, Comments & Corrections

SystemControlByNameMBS(name as string, input as memoryblock) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSXCF Plugin 6.2 Yes No Yes Yes No
Function: The SystemControlByNameMBS function retrieves system information and allows processes with appropriate privileges to set system information.
Notes:
The name is given as an ASCII string.
Returns nil on any error.

See also:

Some examples using this method:

Feedback, Comments & Corrections

SystemControlMBS(name as memoryblock) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSXCF Plugin 6.2 Yes No Yes Yes No
Function: The SystemControlMBS function retrieves system information and allows processes with appropriate privileges to set system information.
Example:
Function IsRosetta() As boolean
Const CTL_HW = 6
Const HW_MODEL = 2

dim mib,m as MemoryBlock

mib=newMemoryBlock(8)
mib.Long(0) = CTL_HW
mib.Long(4) = HW_MODEL

m=SystemControlMBS(mib)
if m<>nil then
if m.CString(0)="PowerMac" then
Return true
end if
end if
End Function
Notes:
name is a MIB which can be constructed or queried with SystemControlNameToMIBMBS.
Returns nil on any error.

See also:

Some examples using this method:

Some FAQ entries about this method:

Feedback, Comments & Corrections

SystemControlMBS(name as memoryblock, input as memoryblock) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSXCF Plugin 6.2 Yes No Yes Yes No
Function: The SystemControlMBS function retrieves system information and allows processes with appropriate privileges to set system information.
Notes:
Returns nil on any error.
name is a MIB which can be constructed or queried with SystemControlNameToMIBMBS.

See also:

Some examples using this method:

Some FAQ entries about this method:

Feedback, Comments & Corrections

SystemControlNameToMIBMBS(name as string) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS MacOSXCF Plugin 6.2 Yes No Yes Yes No
Function: Searches the given MIB for the given name.
Notes:
Name is an ASCII string.
Returns nil on any error.

Some examples using this method:

Some FAQ entries about this method:

Feedback, Comments & Corrections

WindowsSystemMetricsMBS(what as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method System MBS Win Plugin 3.1 No Yes No Yes, Windows only No
Function: The WindowsSystemMetrics function retrieves various system metrics (widths and heights of display elements) and system configuration settings.
Example:
const SM_CYSMICON = 50

MsgBox str(WindowsSystemMetricsMBS(SM_CYSMICON))
Notes:
All dimensions retrieved by GetSystemMetrics are in pixels.
If the function fails, the return value is zero.

Values for the what parameter:
SM_ARRANGE56Flags specifying how the system arranged minimized windows. For more information about minimized windows, see the following Remarks section.
SM_CLEANBOOT67Value that specifies how the system was started: 0 Normal boot; 1 Fail-safe boot; 2 Fail-safe with network boot; Fail-safe boot (also called SafeBoot) bypasses the user's startup files.
SM_CMETRICS83(Windows 2000 or newer)
SM_CMONITORS80Number of display monitors on the desktop. (Windows 2000 or newer)
SM_CMOUSEBUTTONS43Number of buttons on mouse, or zero if no mouse is installed.
SM_CXBORDER5Width, in pixels, of a window border.
SM_CXCURSOR13Width, in pixels, of a cursor. The system cannot create cursors of other sizes.
SM_CXDLGFRAME7Thickness, in pixels, of the sizing border around the perimeter of a window that can be resized. (or SM_CXFIXEDFRAME)
SM_CXDOUBLECLK36Width, in pixels, of the rectangle around the location of a first click in a double-click sequence. The second click must occur within this rectangle for the system to consider the two clicks a double-click. (The two clicks must also occur within a specified time.)
SM_CXDRAG68Width, in pixels, of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation.
SM_CXEDGE45Width, in pixels, of a 3-D border.
SM_CXFRAME32Thickness, in pixels, of the sizing border around the perimeter of a window that can be resized. (or SM_CXSIZEFRAME)
SM_CXFULLSCREEN16Width of the client area for a full-screen window on the primary display monitor.
SM_CXHSCROLL21Width, in pixels, of the arrow bitmap on a horizontal scroll bar.
SM_CXHTHUMB10Width, in pixels, of the thumb box in a horizontal scroll bar.
SM_CXICON11The default width, in pixels, of an icon. TheLoadIcon function can load only icons of these dimensions.
SM_CXICONSPACING38Width, in pixels, of a grid cell for items in large icon view. Each item fits into a rectangle of this size when arranged. These values are always greater than or equal to SM_CXICON and SM_CYICON.
SM_CXMAXIMIZED61Default width, in pixels, of a maximized top-level window on the primary display monitor.
SM_CXMAXTRACK59Default maximum width, in pixels, of a window that has a caption and sizing borders. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions.
SM_CXMENUCHECK71Width, in pixels, of the default menu check-mark bitmap.
SM_CXMENUSIZE54Width, in pixels, of menu bar buttons, such as the child window close button used in the multiple document interface.
SM_CXMIN28Minimum width, in pixels, of a window.
SM_CXMINIMIZED57Width, in pixels, of a normal minimized window.
SM_CXMINSPACING47Width, in pixels, of a grid cell for minimized windows. Each minimized window fits into a rectangle this size when arranged. These values are always greater than or equal to SM_CXMINIMIZED and SM_CYMINIMIZED.
SM_CXMINTRACK34Minimum tracking width, in pixels, of a window. The user cannot drag the window frame to a size smaller than these dimensions. A window can override these values by processing the WM_GETMINMAXINFO message.
SM_CXSCREEN0Width, in pixels, of the screen of the primary display monitor.
SM_CXSIZE30Width, in pixels, of a button in a window's caption or title bar.
SM_CXSMICON49Recommended width, in pixels, of a small icon. Small icons typically appear in window captions and in small icon view.
SM_CXSMSIZE52Width, in pixels, of small caption buttons.
SM_CXVIRTUALSCREEN78Width, in pixels, of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. (Windows 98/ME and 2000 or newer)
SM_CXVSCROLL2Width, in pixels, of a vertical scroll bar; and height, in pixels, of the arrow bitmap on a vertical scroll bar.
SM_CYBORDER6Height, in pixels, of a window border.
SM_CYCAPTION4Height, in pixels, of a normal caption area.
SM_CYCURSOR14Height, in pixels, of a cursor. The system cannot create cursors of other sizes.
SM_CYDLGFRAME8Thickness, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable. (or SM_CYFIXEDFRAME)
SM_CYDOUBLECLK37Height, in pixels, of the rectangle around the location of a first click in a double-click sequence. The second click must occur within this rectangle for the system to consider the two clicks a double-click. (The two clicks must also occur within a specified time.)
SM_CYDRAG69Height, in pixels, of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation.
SM_CYEDGE46Height, in pixels, of a 3-D border.
SM_CYFRAME33Thickness, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable. (or SM_CYSIZEFRAME)
SM_CYFULLSCREEN17Height of the client area for a full-screen window on the primary display monitor.
SM_CYHSCROLL3Height, in pixels, of a horizontal scroll bar.
SM_CYICON12The default height, in pixels, of an icon. TheLoadIcon function can load only icons of these dimensions.
SM_CYICONSPACING39Height, in pixels, of a grid cell for items in large icon view. Each item fits into a rectangle of this size when arranged. These values are always greater than or equal to SM_CXICON and SM_CYICON.
SM_CYKANJIWINDOW18For double-byte character set versions of the system, this is the height, in pixels, of the Kanji window at the bottom of the screen.
SM_CYMAXIMIZED62Default height, in pixels, of a maximized top-level window on the primary display monitor.
SM_CYMAXTRACK60Default maximum height, in pixels, of a window that has a caption and sizing borders. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions.
SM_CYMENU15Height, in pixels, of a single-line menu bar.
SM_CYMENUCHECK72Height, in pixels, of the default menu check-mark bitmap.
SM_CYMENUSIZE55Height, in pixels, of menu bar buttons, such as the child window close button used in the multiple document interface.
SM_CYMIN29Minimum height, in pixels, of a window.
SM_CYMINIMIZED58Height, in pixels, of a normal minimized window.
SM_CYMINSPACING48Height, in pixels, of a grid cell for minimized windows. Each minimized window fits into a rectangle this size when arranged. These values are always greater than or equal to SM_CXMINIMIZED and SM_CYMINIMIZED.
SM_CYMINTRACK35Minimum tracking height, in pixels, of a window. The user cannot drag the window frame to a size smaller than these dimensions. A window can override these values by processing the WM_GETMINMAXINFO message.
SM_CYSCREEN1Height, in pixels, of the screen of the primary display monitor.
SM_CYSIZE31Height, in pixels, of a button in a window's caption or title bar.
SM_CYSMCAPTION51Height, in pixels, of a small caption.
SM_CYSMICON50Recommended height, in pixels, of a small icon. Small icons typically appear in window captions and in small icon view.
SM_CYSMSIZE53Height, in pixels, of small caption buttons.
SM_CYVIRTUALSCREEN79Height, in pixels, of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. (Windows 98/ME and 2000 or newer)
SM_CYVSCROLL20Height, in pixels, of a vertical scroll bar; and height, in pixels, of the arrow bitmap on a vertical scroll bar.
SM_CYVTHUMB9Height, in pixels, of the thumb box in a vertical scroll bar.
SM_DBCSENABLED42TRUE or nonzero if the double-byte character set (DBCS) version of USER.EXE is installed; FALSE or zero otherwise.
SM_DEBUG22TRUE or nonzero if the debugging version of USER.EXE is installed; FALSE or zero otherwise.
SM_IMMENABLED82(Windows 2000 or newer)
SM_MENUDROPALIGNMENT40TRUE or nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; FALSE or zero if the menus are left-aligned.
SM_MIDEASTENABLED74TRUE if the system is enabled for Hebrew and Arabic languages.
SM_MOUSEPRESENT19TRUE or nonzero if a mouse is installed; FALSE or zero otherwise.
SM_MOUSEWHEELPRESENT75TRUE or nonzero if a mouse with a wheel is installed; FALSE or zero otherwise. (Windows 98/ME/2000 or newer)
SM_NETWORK63The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use
SM_PENWINDOWS41TRUE or nonzero if the Microsoft Windows for Pen computing extensions are installed; FALSE or zero otherwise.
SM_REMOTESESSION&h1000(Windows 2000 or newer)
SM_SAMEDISPLAYFORMAT81TRUE if all the display monitors have the same color format, FALSE otherwise. Note that two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel's color value. (Windows 98/ME/2000 or newer)
SM_SECURE44TRUE if security is present; FALSE otherwise.
SM_SHOWSOUNDS70TRUE or nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; FALSE, or zero, otherwise.
SM_SLOWMACHINE73TRUE if the computer has a low-end (slow) processor; FALSE otherwise.
SM_SWAPBUTTON23TRUE or nonzero if the meanings of the left and right mouse buttons are swapped; FALSE or zero otherwise.
SM_XVIRTUALSCREEN76Coordinates for the left side and the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. (Windows 98/ME/2000 or newer)
SM_YVIRTUALSCREEN77Coordinates for the left side and the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. (Windows 98/ME/2000 or newer)

The SM_ARRANGE setting specifies how the system arranges minimized windows, and consists of a starting position and a direction. The starting position can be one of the following values:
ARW_BOTTOMLEFT 0x0000LStart at the lower-left corner of the screen (default position).
ARW_BOTTOMRIGHT 0x0001LStart at the lower-right corner of the screen. Equivalent to ARW_STARTRIGHT.
ARW_HIDE 0x0008LHide minimized windows by moving them off the visible area of the screen.
ARW_TOPLEFT 0x0002LStart at the upper-left corner of the screen. Equivalent to ARV_STARTTOP.
ARW_TOPRIGHT 0x0003LStart at the upper-right corner of the screen. Equivalent to ARW_STARTTOP | SRW_STARTRIGHT.


The direction in which to arrange can be one of the following values:
ARW_DOWN 0x0004LArrange vertically, top to bottom.
ARW_LEFT 0x0000LArrange horizontally, left to right.
ARW_RIGHT 0x0000LArrange horizontally, right to left.
ARW_UP 0x0004LArrange vertically, bottom to top.

see also
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85).aspx

Some examples using this method:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Mac Plugin, MBS MacOSX Plugin, MBS MacOSXCF Plugin, MBS QuickTime Plugin, MBS Util Plugin, MBS Win Plugin.




Links
MBS Xojo PDF Plugins