程式語言 - C++ Builder 6 - Visual Component Library (VCL) - Single Document Interface (SDI) - Create Window



main.cpp

#pragma resource "*.dfm"

#include <vcl.h>
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>

USEFORM("main.cpp", Form1);

class TForm1 : public TForm
{
public:
    __fastcall TForm1(TComponent* Owner);
};

TForm1 *Form1;

__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
}

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    Application->Initialize();
    Application->CreateForm(__classid(TForm1), &Form1);
    Application->Run();
    return 0;
}

main.dfm

object Form1: TForm1
    Left = 0
    Top = 0
    Width = 300
    Height = 300
    Caption = 'main'
    Color = clBtnFace
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    OldCreateOrder = False
    PixelsPerInch = 144
    TextHeight = 20
end

編譯、執行

$ export WINEPREFIX=/home/user/.wine_amd64

$ box86 wine make -f main.mak

完成