Delphi中安装和使用KOL和MCK


本文整理自网络,侵删。

  

创建一个普通的Application,保存好。把KOLProject放到主Form上。设置KOLProject的属性projectDest为新的KOL’s project的名字,这个名字是任意的,设置后将生成一个新的dpr文件,这个dpr文件是符合KOL的要求,这个名字内不可以有路径。然后再放一个KOLForm上去,将主Form转成KOLForm。全部保存后关闭所有的文件,再重新打开新设置的名字的project就行了。

MCK的功能就是将一个VCL的控件映射为KOL的控件,利用了DELPHI的GUI设计功能来设计KOL。所以每当放一个KOL控件,就会生成一段KOL代码,非常地有用。不过有个限制,必须要在同一个目录下。

KOL利用DELPHI编译器会自动SmartLink的功能,成功地将一个GUI程序减少到来二十几K左右,加上UPX压缩后就剩下十几K了。

dunit的使用非常简单,只要将dunit的源码都放在可以搜索到目录下就了。基本上只需要一个TestFramework.pas文件就够了,如果需要运行GUI则还要一个GUITestRunner.pas文件。

一般来说如果与want配合则要使用dll,创建一个dll,不需要任何form,加入单元:TestFrameWork,ShareMem和所有需要测试的单元。
假设:SecurityUnit是源码,创建SecurityUnitTest作为测试单元。定义 TTestSecurity = class(TTestCase)类型。
加上
initialization
TestFramework.RegisterTest(TTestSecurity.Suite);
注册一下测试类,当然测试类是可以写在一起。

将dpr里面的
begin
end;
改为
exports
RegisteredTests name ’Test’;
end;
=====================================
KOL和MCK的安装 1、把KOL中的kol.pas拷贝到MCK目录中。 2、运行Delphi选择Tools菜单->Environmaent ptions... ->Library页,选择"Library Path"右边的按钮会弹出 "Directories"对话框,然后添加KOL和MCK的路径。 3、打MCK目录中的包文件安装。 如何创建一个KOL工程 1、在Delphi中新建一个应用程序,然后保存(这一步一定要 做),保存时工程名一定不要改变,窗体名可以随便。 2、在控件面板KOL中放一个TKOLProject控件到窗体并设置 projectDest属性为你想要的工程名比如说是 "KOLSample",再把dprResource属性设为真(这关系到 你能不能用Project->Options...中的设置设置你的程序 图标以及程序的版本号)。 3、在控件面板KOL中放一个TKOLForm控件到窗体,这个控件 和TForm差不多的,保存并关闭当前工程。 4、这时候你就会在保存目录中发现一个名为"KOLSample"的 工程,聪明的你可能会想到Project1这个工程不再需要 了,是的你可以毫不留情的删掉它(其它的就不要删了)。 打开KOLSample,运行。

?我使用过程中遇到的问题:
1、提示找不到ExptIntf.dcu
解决方法:
依次 Project-->Options-->Directories/Conditionals-->Search path选择C:\Program Files\Borland\Delphi7\Source\ToolsAPI目录

2、找不到Proxies.Pas
解决办法:
自己写一个Proxies.Pas
如下
unit Proxies;
interface
Function IsProxyClass(ComponentClass: TClass): Boolean;
implementation
Function IsProxyClass(ComponentClass: TClass): Boolean;
begin
Result := True;
end;
end.

?

你的使用方法不对,请仔细阅读

(09-5-20,这种方法似乎不对:编译的程序更大了,又拐到了forms.dcu上去了,哈哈。)

*
***************
*******************************

III. STARTING NEW KOL MIRROR PROJECT

*******************************
***************
*

1. Start Delphi and choose File|New Application.

2. DO NOT place any components on the form at this stage. Choose File|Save All and select the destination folder for your project. Note that ALL FILES of your project ALWAYS HAVE TO BE PLACED IN THE SAME DIRECTORY!
You may change the name of the .PAS file, but you MUST NOT change the name of the .DPR file.

3. Place the TKOLProject component onto the form.

4. The name of the output MCK file can be set by changing the ProjectDest property (path MUST NOT be included). If you type MySuperKOLProj, for instance, then the output MCK project will be named MySuperKOLProj.DPR. The EXE file's name will be (as you might have guessed already) MySuperKOLProj.EXE.

5. Drop the TKOLForm component onto the form.

6. In DELPHI5 only: Project | Options | Directories/Conditionals | Search path, add:
$(Delphi)\Source\ToolsApi
(this only seems to be necessary when working with Delphi 5 - the compiler needs to know the path to toolintf.pas, dsgnintf.pas, editintf.pas and exptintf)

7. If TKOLForm component was dropped (5.) AFTER changing ProjectDest property of TKOLProject component (4.), this step is not necessary, and destination project is ready. Otherwise:
change any property of the TKOLForm (or change the form's size or position). Even though no exe-file is created, you can open the resulting project immediately. This way allows you to convert a dll-project to a mck-compatible one as well.

8. Open the resulting project (it should be found in the same directory). Now it is high time you removed Project1.* - these files are no longer necessary.

9. Play with your new KOL/MCK Project (adjust Parameters, drop TKOL... components, compile, run, debug, etc.) Enjoy!

几个对应的属性:

Application->Applet

Form1->Form1.Form


相关阅读 >>

Delphi dbnavigator1 删除时弹出确认对话框

Delphi 防止程序重复执行的单元

Delphi 资源管理器套件

Delphi 禁止截屏printscreen

isleapyear:返回给定的年份是否是闰年

delph记录输出日志

Delphi xe7 判断android应用程序中的通信状态类型

Delphi读写firebird二进制数据

Delphi fmx手机app,如何下载网站图片而不卡界面

Delphi出现 no mapping for the unicode character exists in the target multi-byte code page 处理方法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...