신효철 님이 쓰신 글 :
: 안녕하세요.
: 초보개발자 입니다.
:
: 델파이에서 작성한 폼이 있는 dll을
: c++빌더에서 동적생성하여 c++빌더 폼의 panel에 생성하고자 합니다.
:
: dll소스입니다.
:
: //procedure Ftpshow(pParent : TComponent); export; stdcall;
: procedure Ftpshow(pParent : TWinControl); export; stdcall;
: begin
: Form5 := TForm5.Create(pParent);
: //Form5.Parent := pParent;
: //Form5.ParentWindow := pParent.Handle;
:
: Form5.Show;
: end;
:
: exports
: Ftpshow;
:
:
: c++빌더 소스입니다.
:
: {
: // typedef int (*TFtpshow)(TComponent * pParent);
: typedef int (*TFtpshow)(TWinControl * pParent);
: HINSTANCE hDll = Null;
: hDll = LoadLibraryA("Project4.dll");
: if (hDll)
: {
: TFtpshow Ftpshow;
: Ftpshow = (TFtpshow)GetProcAddress(hDll, "Ftpshow");
:
: Ftpshow(this->pnlMain);
:
: FreeLibrary(hDll);
: }
: else
: ShowMessage("Can't load library");
: FreeLibrary(hDll);
:
:
: 주석처리한 부분은 인터넷 검색하여 시도했던 방법입니다.
: 에러는 메모리 위반 에러가 뜨는데 검색해도 더이상 길이 안보여 질문드립니다.
FreeLibrary 를 왜 두번하지요?
|