从没用过C++ Builder,现在出现了两个问题 我用C++ Builder作了一个弹出窗体的简单DLL,但在Delphi中调用的时候关闭弹出的窗体没有问题,但在关闭主窗体时出现错误,说什么指定程序找不到,我后来又加了一个销毁窗体的函数,但是这下都不能运行了!说找不到输入点!请高手们指教!!
C++ Builder中
.h文件#ifndef DllH.h
#define DllH.h
#include "DllForm.h"
class _declspec(dllexport) _stdcall MyDllClass
{
public:
MyDllClass();};
TForm2* DllMyForm2;
extern "C" _declspec (dllexport) _stdcall void CreateFormFunct();
extern _declspec (dllexport) _stdcall void DeleteForm();#endif
.cpp文件
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
#include "DllH.h"
#include "DllForm.h"
USERES (Dll.res);
USEFORM(DllFORM.cpp,DllForm); MyDllClass :: MyDllClass()
{ };
void _stdcall CreateFormFunct()
{
DllMyForm2 = new TForm2(Application);
DllMyForm2->Show(); }; void _stdcall DeleteForm()
{
DllMyForm2->FreeOnRelease(); }Delphi中调用
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
procedure CreateFormFunct(); cdecl StdCall; external 'DLLTEST.dll';
procedure DeleteForm() ; StdCall; external 'DLLTEST.dll';
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
CreateFormFunct();
end;end.谢谢各位了!
C++ Builder中
.h文件#ifndef DllH.h
#define DllH.h
#include "DllForm.h"
class _declspec(dllexport) _stdcall MyDllClass
{
public:
MyDllClass();};
TForm2* DllMyForm2;
extern "C" _declspec (dllexport) _stdcall void CreateFormFunct();
extern _declspec (dllexport) _stdcall void DeleteForm();#endif
.cpp文件
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
#include "DllH.h"
#include "DllForm.h"
USERES (Dll.res);
USEFORM(DllFORM.cpp,DllForm); MyDllClass :: MyDllClass()
{ };
void _stdcall CreateFormFunct()
{
DllMyForm2 = new TForm2(Application);
DllMyForm2->Show(); }; void _stdcall DeleteForm()
{
DllMyForm2->FreeOnRelease(); }Delphi中调用
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
procedure CreateFormFunct(); cdecl StdCall; external 'DLLTEST.dll';
procedure DeleteForm() ; StdCall; external 'DLLTEST.dll';
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
CreateFormFunct();
end;end.谢谢各位了!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货