Добрый день!
Помогите с проблемой разобраться!
С помощью визарда DLL создаю стандартным образом (С++,VCL) основной файл DLL, Который должен создавать и вызывать практически пустую форму, на которой расположен только Bevel. Создаю файл описаний и собственно файл с формой! Все компилирую - без ошибок:
Файл формы:
//---------------------------------------------------------------------------
#include
#include
#pragma hdrstop
#include "FrameForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFFRAME *FFRAME;
//---------------------------------------------------------------------------
__fastcall TFFRAME::TFFRAME(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFFRAME::FormShow(TObject *Sender)
{
Width = 120;
Height = 160;
BorderStyle = bsNone;
AlphaBlend = true;
AlphaBlendValue = 150;
TransparentColor= true;
TransparentColorValue= clYellow;
Color= clYellow;
}
//---------------------------------------------------------------------------
void __fastcall TFFRAME::SetPos(int X, int Y)
{
Left = X;
Top = Y;
}
//---------------------------------------------------------------------------
void __fastcall TFFRAME::SetSize(int W, int H)
{
Width = W;
Height = H;
}
//---------------------------------------------------------------------------
Файл объявлений DLL:
//---------------------------------------------------------------------------
#ifdef FFRAME_EXPORTS
#define FFRAME_API __declspec(dllexport)
#else
#define FFRAME_API __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
//---------------------------------------------------------------------------
FFRAME_API void __stdcall FFRAME_Open (void);
FFRAME_API void __stdcall FFRAME_SetPos (int Left, int Top);
FFRAME_API void __stdcall FFRAME_SetSize (int Width, int Height);
//---------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif
Основной файл DLL:
//---------------------------------------------------------------------------
#include
#include
#pragma hdrstop
#define FFRAME_EXPORTS
#include "ONFRAME.H"
#include "FrameForm.h"
//---------------------------------------------------------------------------
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
FFRAME_API void __stdcall FFRAME_Open(void)
{
FFRAME = new TFFRAME(Application);
FFRAME->ShowModal();
delete FFRAME;
}
//---------------------------------------------------------------------------
FFRAME_API void __stdcall FFRAME_SetPos(int Left,int Top)
{
FFRAME->SetPos(Left,Top);
}
//---------------------------------------------------------------------------
FFRAME_API void __stdcall FFRAME_SetSize(int Width, int Height)
{
FFRAME->SetSize(Width,Height);
}
//---------------------------------------------------------------------------
Повторяюсь! Все компилируется без ошибок!
DLL,LIB,H Сливаю в другую директорию, где находится тестовая программа, подвязываю в прожект Lib файл, компилирую без ошибок. Программа загружается нормально. На ней кнопка, вызывающая FFRAME_Open(). При нажатии на кнопку появляется ошибка
"Cannot make a visible windows modal". Это вроде как ошибка VCL!
На самом деле на форме установлено свойство visible = true!
Помогите понять причину! Вроде уже десятка два аналогичных DLL сделал - первый раз с таким столкнулся!
С Уважением,
Onic777