Overview

The Property Manager provides Windows-compatible property storage, allowing applications to attach arbitrary data to window handles without modifying the window class. This enables flexible data storage and retrieval for windows and controls.

Features

  • SetProp: Attach data to window handles
  • GetProp: Retrieve data from window handles
  • RemoveProp: Remove properties from windows
  • Atom Table: String-to-integer atom mapping
  • Custom Atoms: User-defined atom IDs (starting at 0xC000)

Atom Management

Atoms are integer identifiers for strings, similar to Windows atom tables:

  • findAtom(string): Find atom ID for a string
  • addAtom(string): Create or retrieve atom for a string
  • Custom Atoms: Start at 0xC000 (Windows-compatible)

API

setProp(hwnd, atomOrString, value)

Attaches a property to a window:

  • hwnd - Window handle
  • atomOrString - Atom ID or string name
  • value - Property value (any type)

getProp(hwnd, atomOrString)

Retrieves a property from a window:

  • hwnd - Window handle
  • atomOrString - Atom ID or string name

Returns the property value or null if not found.

removeProp(hwnd, atomOrString)

Removes a property from a window:

  • hwnd - Window handle
  • atomOrString - Atom ID or string name

Usage Example

const PropertyManager = require('./system/property');

const propManager = new PropertyManager();

// Set a property using a string
propManager.setProp(hwnd, 'MyProperty', { data: 'value' });

// Get the property
const value = propManager.getProp(hwnd, 'MyProperty');

// Or use an atom
const atom = propManager.addAtom('MyProperty');
propManager.setProp(hwnd, atom, { data: 'value' });
const value2 = propManager.getProp(hwnd, atom);

// Remove the property
propManager.removeProp(hwnd, 'MyProperty');

Integration

The Property Manager integrates with:

  • Window Manager: Properties are stored per window handle
  • GUI Integration: Initialized as part of the GUI system
  • Controls: Used by controls to store internal state

Related Documentation