> For the complete documentation index, see [llms.txt](https://windows96.gitbook.io/dev-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://windows96.gitbook.io/dev-docs/api-usage/gui/creating-a-window.md).

# Creating a window

## Preface

In Windows 96, all windows inherit the [`StandardWindow`](https://apidocs.windows96.net/interfaces/StandardWindow.html) class, which is found in `w96.StandardWindow`.

It is not recommended to instantiate this class directly, as you're meant to be using [`this.createWindow`](https://apidocs.windows96.net/interfaces/WApplication.html#createWindow) inside a WApplication instance, for resource management reasons.

## How windows are created

As mentioned before, windows are created with the function below

```javascript
createWindow(params: WindowParams, isAppWindow: Boolean): StandardWindow
```

The `params` parameter is an object that contains the initialization parameters to use to create the window. These parameters include fields like `title`, `resizable`, etc.

The `isAppWindow` parameter specifies if the window is an app window (main window). An app window will destroy all child dialogs that have been created inside the `WApplication` instance when closed, and will trigger an application termination event.

## Creating a basic window

Here is an application that creates a very basic window with some text as the HTML body. You can run it with `basic-window-test` through the run box or the terminal.

```javascript
const { register } = w96.app;
const { Theme } = w96.ui;

class BasicWindowTest extends WApplication {
    constructor() { super(); }
    
    async main(argv) {
        super.main(argv);
        
        // 1. Create the window and assign it to a variable
        const mainwnd = this.createWindow({
            title: "Basic Window",
            body: "this is a very basic window."
        }, true);
        
        // 2. Show it
        mainwnd.show();
    }
}

register({
    command: "basic-window-test",
    type: "gui",
    cls: BasicWindowTest,
    meta: {
        icon: Theme.getIconUrl("exec"),
        friendlyName: "Basic Window Test"
    }
});
```

The result should be something like this:

![The resultant window. It has no icon and does not show itself in the taskbar.](https://543967396-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-McsE7-aoYBgJN2_hYWT%2F-MgLKUoGb1h0h9Fc_OQQ%2F-MgLMKf_H5v5UictKQIw%2Fimage.png?alt=media\&token=9f6677ea-3d10-46bd-a7a6-ff7b2317a592)
