function create_form($parent, $title, $width, $height)
{
    global $wb;
    start_drawing_functions();
    // Create the form
    $wb->formwin = wb_create_window($parent, ResizableWindow, $title, 0, 0, $width, $height, WBC_INVISIBLE | WBC_CUSTOMDRAW | WBC_NOTIFY, WBC_REDRAW | WBC_RESIZE | WBC_MOUSEDOWN | WBC_MOUSEUP | WBC_MOUSEMOVE | WBC_DBLCLICK);
    // Remove unwanted window buttons
    $style = GetWindowStyle($wb->formwin);
    SetWindowStyle($wb->formwin, $style & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
    EnableCloseButton($wb->formwin, false);
    // Set more window properties
    wb_set_area($wb->formwin, WBC_MINSIZE, 0, 0, 80, 60);
    wb_set_handler($wb->formwin, "process_form");
    wb_set_image($wb->formwin, PATH_RESPVT . "form.ico");
    // Initialize form data
    reset_form(DEFAULT_WINCLASS, $parent, $title, $width, $height);
}
function read_project($filename)
{
    global $wb;
    $wb->project = parse_ini(file_get_contents($filename), false);
    // Read form data (section "Form"))
    $wb->currentform = 0;
    $section = $wb->project["Form"];
    $title = $section["caption"];
    $style = (int) $section["style"];
    $value = (int) $section["value"];
    $class = $section["class"];
    $geom = preg_split("/\\s+/", $section["geom"]);
    reset_form($class, $wb->mainwin, $title, max(1, (int) $geom[2]), max(1, (int) $geom[3]), $style, $value);
    $ncontrols = (int) $section["controls"];
    // Loop to read control data from project file
    for ($i = 0; $i < $ncontrols; $i++) {
        // Read a section with the form data
        $section = $wb->project["Form_ctrl" . (string) ($i + 1)];
        if (!$section) {
            break;
        }
        // Read control data
        $class = $section["class"];
        $caption = $section["caption"];
        $geom = preg_split("/\\s+/", $section["geom"]);
        $id = $section["id"];
        $style = $section["style"];
        $value = $section["value"];
        create_control($class, $caption, max(1, (int) $geom[2]), max(1, (int) $geom[3]), max(0, (int) $geom[0]), max(0, (int) $geom[1]), $id, $style, $value, false);
    }
    wb_set_text($wb->statusbar, "Created {$i} controls");
    $wb->form[$wb->currentform]->ncurrent_control = -1;
    foreach ($wb->project_array as $var) {
        $var = strtolower($var);
        $wb->form[$wb->currentform]->{$var} = $wb->project['Projectsettings'][$var];
        if (!$wb->form[$wb->currentform]->{$var}) {
            $wb->form[$wb->currentform]->{$var} = constant('DEFAULT_' . strtoupper($var));
        }
    }
    $wb->form[$wb->currentform]->ncurrindex = $wb->project['Projectsettings']['currentindex'];
    wb_set_selected($wb->tree, 0);
    update_control_data(true);
}