Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

ProcessMBS.Bundle as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 4.2 Yes No No Yes, macOS only No
Function: Returns the bundle path.
Notes:
Maybe nil if not available.
Returns on Mac OS X the path to the main bundle of the process.

Feedback, Comments & Corrections

ProcessMBS.BundleID as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 7.5 Yes No No Yes, macOS only No
Function: Returns the bundle identifier.
Notes:
Maybe "" if not available.
Returns on Mac OS X the identifier to the main bundle of the process.

Feedback, Comments & Corrections

CountProcessesMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Process MBS Util Plugin Yes No No Yes, macOS only No
Function: Counts how many processes are running.
Notes:
Short for this function:

function CountProcesses as Integer
dim n as Integer
dim p as ProcessMBS

p=new ProcessMBS
p.getfirstProcess
n=1
while p.getnextProcess
n=n+1
wend

return n
end if

Feedback, Comments & Corrections

ProcessMBS.GetCurrentProcess
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin Yes Yes No Yes No
Function: Load the current Process' information into the class.
Notes: This should always be your Realbasic application.

Feedback, Comments & Corrections

ProcessMBS.GetfirstProcess
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin Yes Yes No Yes No
Function: Load the first Process into the class.
Example:
dim p as ProcessMBS
p=new ProcessMBS
p.GetfirstProcess ' get first
do
msgBox p.name
loop until not p.GetNextProcess ' get next till no more

Feedback, Comments & Corrections

ProcessMBS.GetFrontProcess
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin Yes No No Yes, macOS only No
Function: Load the frontmost Process' information into the class.

Feedback, Comments & Corrections

ProcessMBS.GetNextProcess as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin Yes Yes No Yes No
Function: Load the next Process into the class.
Example:
dim p as ProcessMBS
p=new ProcessMBS
p.GetfirstProcess ' get first
do
msgBox p.name
loop until not p.GetNextProcess ' get next till no more
Notes: Returns true if successfull.

Feedback, Comments & Corrections

ProcessMBS.GetProcess(serial as memoryblock)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin Yes No No Yes, macOS only No
Function: Load the process information for the process with the given serial.

Feedback, Comments & Corrections

ProcessMBS.KillProcess as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 2.7 Yes Yes No Yes No
Function: Kills a Process on Mac OS X or Windows.
Example:
dim p as ProcessMBS
p=new ProcessMBS
p.getcurrentprocess
msgbox str(p.killprocess)
Notes:
Returns -1 if function is not available. Else returns a Mac OS error code where 0 equals "no error".

Sets the lasterror property.

Lasterror codes on Windows:
0 - failed
1 - normal exit
2 - forced exit

If you kill the main process of a task, this can kill the sub processes, too.

See also:

Feedback, Comments & Corrections

ProcessMBS.KillProcess(timeoutms as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 4.2 Yes Yes No Yes No
Function: Kills a Process on Mac OS X or Windows.
Example:
dim p as ProcessMBS
p=new ProcessMBS
p.getcurrentprocess
msgbox str(p.killprocess)
Notes:
Returns -1 if function is not available. Else returns a Mac OS error code where 0 equals "no error".

Sets the lasterror property.

Lasterror codes on Windows:
0 - failed
1 - normal exit
2 - forced exit

The timeout is in milliseconds. If you don't specify a timeout, 1000 ms are used.
If you kill the main process of a task, this can kill the sub processes, too.

See also:

Feedback, Comments & Corrections

ProcessMBS.MacProcessSerial as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 2.7 Yes No No Yes, macOS only No
Function: Returns the serial number for this process as a memoryblock with binary content.
Notes:
On Mac OS every process as its own unique ID. (If you launch one application two times, they may have everything equal except the process serial.)

The serial itself is a 8byte long memoryblock (two integer).

Returns nil on any error.

Feedback, Comments & Corrections

ProcessMBS.Priority as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Process MBS Util Plugin 10.2 Yes No No Yes, macOS only No
Function: The priority of the process.
Example:
dim p as new ProcessMBS

p.GetCurrentProcess

MsgBox str(p.priority) // shows 0

p.priority = 5

MsgBox str(p.priority) // shows 5
Notes:
20 (least) to -20 (max). Setting the value may be limited due to permissions.
(Read and Write computed property)

See also:

Feedback, Comments & Corrections

ProcessMBS.ProcessInformationCFDictionary as object
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 3.2 Yes No No Yes, macOS only No
Function: Returns a CFDictionaryMBS object with the properties of the process.
Example:
dim p as ProcessMBS
dim d as CFDictionaryMBS

p=new ProcessMBS

p.GetCurrentProcess

d=CFDictionaryMBS(p.ProcessInformationCFDictionary)

if d=nil then
MsgBox "This example works only on Mac OS X 10.2!"
else
// use information in dictionary
end if
Notes:
Only available on Mac OS X 10.2 or newer.
(And in Mac OS X 10.2 is a bug which may lead into a crash by using this function. Fixed in Mac OS X 10.3)
The function returns a CFDictionaryMBS, but to avoid plugin dependencies, the function is declared as Object, so RB 4.5 don't crash when an application uses the process plugin and dosn't use the CF Plugin.

Result:
An immutable CFDictionary containing these keys and their values. Keys marked with an '*' are optional. Over time more keys may be added.

Key NameType
"PSN"CFNumber, kCFNumberLongLongType
"Flavor"CFNumber, kCFNumberSInt32
"Attributes"CFNumber, kCFNumberSInt32
"ParentPSN"CFNumber, kCFNumberLongLong
"FileType"CFString, file type
"FileCreator"CFString, file creator
"pid"CFNumber, kCFNumberLongType
"LSBackgroundOnly"CFBoolean
"LSUIElement"CFBoolean
"IsHiddenAttr"CFBoolean
"IsCheckedInAttr"CFBoolean
"RequiresClassic"CFBoolean
"RequiresCarbon"CFBoolean
"LSUserQuitOnly"CFBoolean
"LSUIPresentationMode"CFNumber, kCFNumberShortType
"BundlePath"CFString
kIOBundleExecutableKeyCFString
kIOBundleNameKeyCFString
kIOBundleIdentifierKeyCFString

Feedback, Comments & Corrections

ProcessMBS.QuitProcess as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 3.1 Yes No No Yes, macOS only No
Function: Quits a Process on Mac OS.
Example:
dim p as ProcessMBS
p=new ProcessMBS
p.getcurrentprocess
msgbox str(p.QuitProcess)
Notes:
Returns -1 if function is not available. Else returns a Mac OS error code where 0 equals "no error".
Sets the lasterror property.

Feedback, Comments & Corrections

ProcessMBS.SameAs(other as ProcessMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin Yes No No Yes, macOS only No
Function: Returns true if two ProcessMBS objects have the same Process.

Feedback, Comments & Corrections

ProcessMBS.SetFrontProcessWithOptions(options as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 4.1 Yes No No Yes, macOS only No
Function: Moves the current process to the front.
Example:
dim p as ProcessMBS

// move my front window to the front
p=new ProcessMBS
p.GetCurrentProcess
p.SetFrontProcessWithOptions 1
Notes:
If you pass 0 in the options parameter, the process is activated and all process windows are brought forward.

If you pass kSetFrontProcessFrontWindowOnly (value 1), the process is activated and the frontmost non-floating window is brought forward. (Mac OS X only)

Feedback, Comments & Corrections

ProcessMBS.SetServiceMode(ismode as boolean) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 2.7 No Yes No Yes, Windows only No
Function: If an application is a service, it is not listed inside the Windows force quit window.
Notes: Works only on Windows 95, 98 and ME.

Feedback, Comments & Corrections

ProcessMBS.TransformProcessType(mode as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 15.2 Yes No No Yes, macOS only No
Function: Changes the 'type' of the process specified in the psn parameter.
Notes:
Given a psn for an application, this call transforms that application into the given type. Foreground applications have a menu bar and appear in the Dock. Background applications do not appear in the Dock, do not have a menu bar (and should not have windows or other user interface). UIElement applications do not have a menu bar, do not appear in the dock, but may in limited circumstances present windows and user interface. If a foreground application is frontmost when transformed into a background application, it is first hidden and another application is made frontmost. A UIElement or background-only application which is transformed into a foreground application is not brought to the front (use SetFrontProcess() after the transform if this is required) nor will it be shown if it is hidden (even if hidden automatically by being transformed into a background-only application), so the caller should use ShowHideProcess() to show the application after it is transformed into a foreground application. Applications can only transform themselves; this call cannot change the type of another application.

Returns error code (0 for success).

Feedback, Comments & Corrections

ProcessMBS.TransformToForegroundApplication as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 8.6 Yes No No Yes, macOS only No
Function: Transforms a background application to a foreground application.
Notes:
Returns a Mac OS error code. Returns -1 if the function is not available. You need to select a process first with Get*Process functions.
Requires Mac OS X 10.3.

You can use this call to transform a background-only application into a foreground application. A foreground application appears in the Dock (and in the Force Quit dialog) and contains a menu bar. This function does not cause the application to be brought to the front; you must set FrontProcess=true to do so.

While available starting in 10.3 "Panther," calling TransformProcessType on a UIElement application in 10.3 or 10.4 will return paramErr (-50), rendering it only usable on a full BackgroundOnly? application. Leopard supports foregrounding both UIElement and BackgroundOnly? applications.

Feedback, Comments & Corrections

ProcessMBS.Update
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin Yes No No Yes, macOS only No
Function: Updates the classes information.
Notes: Use it if you want the current CPUTime value after some time.

Feedback, Comments & Corrections

ProcessMBS.WinFullProcessImagePath as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 9.6 No Yes No Yes, Windows only No
Function: Retrieves the full name of the executable image for the specified process.
Notes:
Returns empty string on any error like missing permissions.
The path is in the device style "Device\Harddisk0\Partition1\WINNT\System32\test.exe".

Requires Windows Vista or Windows Server 2008 or newer.

Feedback, Comments & Corrections

ProcessMBS.WinModulePath as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 9.6 No Yes No Yes, Windows only No
Function: Returns the path the first code file in this process.
Notes:
Returns empty string on any error like missing permissions.
The path is in the typical style "C:\path\name.exe".

Feedback, Comments & Corrections

ProcessMBS.WinProcessImagePath as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Process MBS Util Plugin 9.6 No Yes No Yes, Windows only No
Function: Retrieves the name of the executable file for the specified process.
Notes:
Returns empty string on any error like missing permissions.
The path is in the device style "Device\Harddisk0\Partition1\WINNT\System32\test.exe".

Requires Windows XP or Windows Server 2003 or newer.

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Util Plugin.





Links
MBS Xojo blog