快捷搜索:  汽车  科技

delphi桌面程序教程(DeWebDelphi开发Web应用)

delphi桌面程序教程(DeWebDelphi开发Web应用)如果是D11, 则重命名DeWebServer11.exe为DeWebServer.exe;先删除DeWebServer.exe,实时更新:https://gitee.com/xamh/dewebsdk(重要! 许多新用户忽略这一步,导致出现空白界面)如果遇到以下情况,选择“OK”按钮

DeWeb是一个可以直接将Delphi程序快速转换为网页应用的工具!

使用DeWeb 开发者不需要学习HTML/CSS、JavaScript、Java、PHP、ASP、C#等新知识,用Delphi搞定一切。

DeWeb开发的网页支持所有客户端,包括手机、平板等。

网站: http://www.delphibbs.com

实时更新:https://gitee.com/xamh/dewebsdk

开发版本
  • 目前支持Delphi 10.3/10.4/11。
  • DeWeb默认使用Delphi 10.4.2 编译,推荐使用此版本开发!
第一次编译前准备

重要! 许多新用户忽略这一步,导致出现空白界面)

  • 打开Source\dwVcls\ AllVcls.groupproj

如果遇到以下情况,选择“OK”按钮

delphi桌面程序教程(DeWebDelphi开发Web应用)(1)

  • 然后Build all;

delphi桌面程序教程(DeWebDelphi开发Web应用)(2)

  • 复制对应的服务器程序(仅Delphi版本非10.4.x的需要)。

先删除DeWebServer.exe,

如果是D11, 则重命名DeWebServer11.exe为DeWebServer.exe;

如果是D10.3.x,则重命名DeWebServer103.exe为DeWebServer.exe;

入门教程hello world!
  • 新建一个DLL,命名为hello1.dpr
  • 新增一个Form.(File->New->VCL Form - Delphi)。注:不要更改单元名称和Form名称,即分别为unit1.pas和Form1
  • 在Form1中添加一个Label 设置其Caption为"Hello DeWeb"
  • 将hello1.dpr源文件代码更改为

library hello1; uses ShareMem SysUtils Forms Messages StdCtrls Variants Windows Classes Data.Win.ADODB unit1 in 'unit1.pas' {Form1}; {$R *.res} var DLLApp : TApplication; DLLScreen : TScreen; function dwLoad(AParams:String;AConnection:TADOConnection;AApp:TApplication;AScreen:TScreen):TForm;stdcall; begin // Application := AApp; Screen := AScreen; // Form1 := TForm1.Create(nil); //Form1.ADOQuery1.Connection := AConnection; Result := Form1; 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;//保证DLL卸载时恢复原来的Application DLLUnloadProc(DLL_PROCESS_DETACH); end.

  • 保存到source\demos\hello1目录中
  • 更改Project设置为

delphi桌面程序教程(DeWebDelphi开发Web应用)(3)

  • 设置运行参数

菜单:Run – Parameters

delphi桌面程序教程(DeWebDelphi开发Web应用)(4)

  • 编译运行,即可以直接打开服务器程序DeWebserver.exe

delphi桌面程序教程(DeWebDelphi开发Web应用)(5)

  • 双击hello1 即可打开当前应用

猜您喜欢: