EXE文件: FMakeDll.cpp
//---------------------------------------------------------------------------
//使用静态调用,别忘了Project->Add to project...添加MakeDll.lib
#include <vcl.h>
#pragma hdrstop
#include "FTestDll.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
hMyDll = NULL;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TestA(10);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if(hMyDll != NULL)
{
ShowMessage("已经为对象分配资源!");
return;
}
hMyDll = InitMakeDll();
if(hMyDll != NULL)
{
ShowMessage("获得对象句柄成功!");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
int irtn;
irtn = TestB(hMyDll,20);
if(errOk == irtn)
{
ShowMessage("使用句柄执行测试函数B成功!");
}
}
//---------------------------------------------------------------------------
[1] [2] [3] 下一页