Source Samples and Utilities
||Binary DirectX 9
samples and demos.
Shell Library and Samples
||View the description
of Windows Shell Library and Samples.
||Demonstrates how to create a single running instance
of an application. If a previous instance exists, that window is brought to the
foreground and restored if necessary, then the application exits. Otherwise, a mutex
is created by the process to ensure that no other instance is created during the lifetime
of the application window.
When the application is closed the mutex is closed as well so that new instances can be
created. Note that if the application exits unexpectedly Windows releases the process
resources, including the mutex, automatically.
||This sample is a
dialog-based application that displays system information (hardware
and Windows). It demonstrates the following:
- Creating a dialog with the GUI Builder
- Working with resources
- Creating a project and generating an
- Using external resource scripts
- Integrating Resource Compilation
The sample comes with step-by-step instructions on
how to implement a complete dialog-based application that uses
resources and a custom icon.
In Smalltalk MT, the standard serialization methods use memory-mapping technology.
MappedObjectStream implements an easy-to use interface. An instance of MappedObjectStream
maps a set of objects into the address space of the process. The top-level object is
called the root object. There is only one root object, but it can be arbitrary, and in
particular it can be a collection.
1. To serialize an object:
| bytes newBytes mos file rootObject |
rootObject := Array with: 123 with: 'abc' copy with: 2.44.
bytes := ByteArray new: 4000.
mos := MappedObjectStream on: bytes.
mos nextPutAll: rootObject. " add the object to serialize "
mos setLimit. " truncate the stream "
mos saveFile. " serializes and writes the class directory "
" copy the data to a new byte array "
newBytes := ByteArray new: mos size.
mos copyFrom: 0 to: mos size into: newBytes.
" write the byte array to a file for demonstration purposes "
file := File createFile: 'test.bin'.
file nextPutAll: newBytes.
2. To load an object:
| newBytes mos file |
file := File openFile: 'test.bin'.
newBytes := file contents.
" newBytes contains the data "
mos := MappedObjectStream on: newBytes.
" the root object remains accessible as long as newBytes
The code below recompiles all methods without installing them. This allows you to
detect compilation errors (for example, undefined constants, deleted classes or other
| compiler oldProgress |
oldProgress := nil.
progressIndicator notNil ifTrue: [
oldProgress := progressIndicator.
progressIndicator := ProgressDialog new openModelessIn: NULL title: 'Recompiling Methods'.
compiler := (Smalltalk at: #CompilationContext) new.
Compiler iterateOn: Object with: [ :md |
(md source indexOfString: SOURCE_NOT_AVAILABLE) == 0 ifTrue: [
progressIndicator setText: md printString.
Compiler load: md source
class: md smalltalkClass
category: md category
timeStamp: md timeStamp
oldProgress notNil ifTrue: [progressIndicator := oldProgress ].