zoukankan      html  css  js  c++  java
  • DeWeb --- Hello,World!

    1.新建一个DLL,命名为hello.dpr

    2.新增一个Form.(File->New->VCL Form - Delphi),建议不要更改单元名称和Form名称,即分别为unit1.pas和Form1

    3.在Form1中添加一个Label,设置其Caption为"Hello,DeWeb"

    4.将hello.dpr源文件代码更改为
    //====================================
    library hello;

    uses
    ShareMem, SysUtils, Forms, Messages, StdCtrls,
    Variants, Windows, Classes,
    unit1 in 'unit1.pas' {Form1};

    {$R *.res}
    type
    PdwGetEvent=function (ACtrl:TComponent;AData:String):string; StdCall;
    var
    DLLApp : TApplication;
    DLLScreen : TScreen;
    function dwLoad(AParams:String;AApp:TApplication;AScreen:TScreen):TForm;stdcall;
    var
    AForm : TForm1;
    begin
    //
    Application := AApp;
    Screen := AScreen;
    //
    AForm := TForm1.Create(nil);
    AForm.Hint := AParams;
    Result := AForm;
    end;

    procedure DLLUnloadProc(dwReason: DWORD);
    begin
    if dwReason = DLL_PROCESS_DETACH then begin
    Application := DLLApp; //恢复
    Screen := DLLScreen;
    end;
    end;

    exports
    dwLoad;

    begin
    DLLApp := Application; //保存 DLL 中初始的 Application
    DLLScreen := Screen;
    DLLProc := @DLLUnloadProc;//保证卸载时恢复原Application
    DLLUnloadProc(DLL_PROCESS_DETACH);
    end.
    //====================================

    5.编译生成hello.dll,复制到source untimeapps中

    6.运行source untimeDeWebServer.exe,注意使端口为80

    7.打开现代浏览器(Chrome/FireFox等),打开http://127.0.0.1/hello.dw

  • 相关阅读:
    python 3字符编码
    python 数据类型 datatype
    部署python django程序
    linux centos7安装python3
    关于mysql数据库优化
    关于bottle WEB框架中签名cookie的一点理解
    1111
    bottle框架剖析
    the difference __str__ and __repr__
    property getitem setitem
  • 原文地址:https://www.cnblogs.com/maxxua/p/14166891.html
Copyright © 2011-2022 走看看