Links

SalApplication

PPJ.Runtime.Windows.SalApplication
Namespace: PPJ.Runtime.Windows
Assembly: PPJ.Runtime.49 (4.9.0.0)
Base class for SAL applications.
C#
VB.NET
public class SalApplication
Public Class SalApplication

Constructors

SalApplication()

Default constructor.

SalApplication(args)

Constructs a new SalApplication instance and processes the startup arguments.
Name
Type
Description
args
String[]

Properties

ApplicationType

Type: Returns the type of the application.

CompanyName

String: Returns the company of the application loaded from the AssemblyCompany attribute;

DefaultPrinterSettings

PrinterSettings: Returns the default printer settings. This is set by SalPrt

FormsScaleFactor

SizeF: Global autoscaling factor used for all forms in the application. It is empty by default. In which case the standard scaling is used.

Instance

SalApplication: Returns the instance of the application

SkinApplication

Boolean: Enables/Disables the skinning of the entire application.

ThreadModel

ApartmentState: Returns the threading model.

Title

String: Returns the title of the application loaded from the AssemblyTitle attribute;

TopLevelForms

Form[]: Returns a list of all top-level forms that belong to this application.

UseCompatibleTextRendering

Boolean: Returns the value of the internal property Control.UseCompatibleTextRendering.

Version

Int32: Returns the version of the framework.

VisualStyler

VisualStyler: Returns the thread-safe instance of the VisualStyler component. VisualStyler can be used directly to set advanced properties.

VisualStyles

Boolean: Enables disables Windows visual styles.

XPStyle

Deprecated: This property has been deprecated. Use SalApplication.VisualStyles. Boolean: Enables disables XP visual styles.

Methods

AddForm(form)

Increase the reference count for the application object. It is called every time a new SalForm is created.
Parameter
Type
Description
form
Form
Returns: Int32. Updated reference count

ApplySkin(form)

Enables skinning for the form.
Parameter
Type
Description
form
Form

ApplySkin(control, children)

Enables skinning for the control.
Parameter
Type
Description
control
Control
children
Boolean

DelayDispose(obj)

Queue the object to be disposed at the next idle notification.
Parameter
Type
Description
obj

Disable()

Disables input to all open forms. Use SalAppDisable and SalAppEnable when there are multiple applications running simultaneously and you want to control which application receives user input.
Returns: Boolean. bOk

Enable()

Enables input to all open forms that were disabled by SalAppDisable. Use SalAppDisable and SalAppEnable when there are multiple applications running simultaneously and you want to control which application receives user input.
Returns: Boolean. bOk

EndTrace()

Stops all tracing. Any calls to SalTrace() occurring after SalEndTrace() will be ignored.
Returns: Boolean.

Find(name, activate)

Finds a visible top-level window for the specified application. its window handle.
Parameter
Type
Description
name
String
activate
Boolean
Returns: IntPtr. hWnd

GetProfileInt(section, entry, defaultValue, fileName)

Retrieves the integer value of an entry in the specified section of an initialization file or registry.
Parameter
Type
Description
section
String
entry
String
defaultValue
UInt32
fileName
String
Returns: UInt32.

GetProfileString(section, entry, defaultValue, value, fileName)

Parameter
Type
Description
section
String
entry
String
defaultValue
String
value
fileName
String
Returns: Int32.

IdleKick()

Generate an idle cycle.
Returns: Boolean. bOk

IdleRegister(ctrl, msg, wParam, lParam)

Registers a control to receive the specified message when there is an idle state.
Parameter
Type
Description
ctrl
Control
Target control on which to execute the call.
msg
Int32
wParam
Int32
lParam
Int32
Returns: Boolean.

IdleUnregister(ctrl)

Stops sending idle messages to a control.
Parameter
Type
Description
ctrl
Control
Target control on which to execute the call.
Returns: Boolean.

LoadApp(name, args)

Starts an application.
Parameter
Type
Description
name
String
args
String
Returns: Boolean.

LoadAppAndProcessMsgs(name, mode, retCode)

Parameter
Type
Description
name
String
mode
Int32
retCode
Returns: Boolean.

LoadAppAndWait(name, mode, retCode)

Parameter
Type
Description
name
String
mode
Int32
retCode
Returns: Boolean.

LoadSkinFile(path)

Loads the specified skin file. When loading a skin file, skinning is enabled automatically.
Parameter
Type
Description
path
String

LoadSkinResource(name)

Loads the specified skin file from the application's embedded resources. When loading a skin file, skinning is enabled automatically.
Parameter
Type
Description
name
String

LoadSkinResource(assembly, name)

Loads the specified skin file from the assembly's embedded resources. When loading a skin file, skinning is enabled automatically.
Parameter
Type
Description
assembly
Assembly
name
String

Pause(usec)

Pauses the application for the specified number of milliseconds while dispatching messages.
Parameter
Type
Description
usec
Int32

Quit()

Forces the termination of the application.

RemoveForm(form)

Decreases the reference count for the application object. When the count drops to zero (or below if there is a bug), the application exits. It is called every time a Sal form is destroyed. This should emulate SAL application's behavior with respect to top level windows. When the last form is destroyed the app exits.
Parameter
Type
Description
form
Form
Returns: Int32.

RemoveSkin(form)

Disables skinning for the form.
Parameter
Type
Description
form
Form

RemoveSkin(control, children)

Disables skinning for the control.
Parameter
Type
Description
control
Control
children
Boolean

Run(args)

Main method to startup a SAL application. The SAL application class that extends SalApplication should call this method in the application's Main method. Example:
public static int Main(string[] args)
{
return new PortedSalApplication().Run(args);
}
Parameter
Type
Description
args
String[]
Returns: Int32.

SetProfileString(section, entry, value, fileName)

Set the value of an entry in the specified section of an initialization file or registry. All profile information is stored as string, so if you want to store an integer it must be converted to a string first. Then it can be retrieved as an integer using the SalGetProfileInt- Function .
Parameter
Type
Description
section
String
The section heading.
entry
String
The entry whose associated value is being set.
value
String
The value of sEntry.
fileName
String
The name of the initialization file or company name depending on the settings made using the SalUseRegistry function. If you are searching for an INI file and do not specify the full path, searches for the file in the Windows subdirectory.
Returns: Boolean. bOk

StartTrace(outputType, traceFile, clear)

Allows tracing to begin.
Parameter
Type
Description
outputType
Int32
traceFile
String
clear
Boolean
Returns: Boolean.

Trace(severity, text)

Outputs a string to the trace output target selected earlier in the SalStartTrace function. Note that if tracing is not already activated, this function will return TRUE even though no trace action is taken. When writing to the event log, the severity level is kept in numeric form. When writing to any other output target, it is translated into a text string such as "Warning".
Parameter
Type
Description
severity
Int32
text
String
Returns: Boolean.

UseEventLog(useLog, logAndcontinue)

Enables logging of unhandled exceptions in the event log.
Parameter
Type
Description
useLog
Boolean
logAndcontinue
Boolean
Returns: Boolean.

UseRegistry(useRegistry, companyName)

This function is used to re-direct all SalProfile* functions to use the Registry. All values for the SalProfile* functions are saved as strings. The INI file name used as the last parameter of the SalProfile* functions will be used as the application name. The resulting path will be: \HKEY_CURRENT_USER\Software<company name><application name><section><setting>\
Parameter
Type
Description
useRegistry
Boolean
companyName
String
Returns: Boolean. bOk

Events

SkinChanged

EventHandler Fired when the loaded skin changes.