신효철 님이 쓰신 글 :
: aaa 님이 쓰신 글 :
: : 신효철 님이 쓰신 글 :
: : : 안녕하세요.
: : : 초보개발자 입니다.
: : :
: : : 델파이에서 작성한 폼이 있는 dll을
: : : c++빌더에서 동적생성하여 c++빌더 폼의 panel에 생성하고자 합니다.
: : :
: : : dll소스입니다.
: : :
: : : //procedure Ftpshow(pParent : TComponent); export; stdcall;
: : : procedure Ftpshow(pParent : TWinControl); 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 를 왜 두번하지요?
:
: 아..한번만 하면 되는데 이부분은 실수했네요. 감사합니다ㅎㅎ
:
: c++메인 폼의 pnlMain 에 dll폼은 어찌해야 올라갈까요?(pnlMain 는 panel 입니다.)
:
: 에러내역은
: First chance exception at $7576B9BC. Exception class EAccessViolation with message 'Access violation at address 00000080. Read of address 00000080'. Process Project4.exe (13008)
: 입니다. c++의 pParent의 주소가 달라지는건지 잘 안되네요. 조언좀 부탁드립니다.
procedure Ftpshow(pParent : TWinControl); stdcall;
typedef int (*TFtpshow)(TWinControl * pParent);
이거랑 뭐가다른지 비교좀해보센
리턴타입이랑 __ stdcall 이게 안보이고 있고 차이인가?
델파이는 모르지만 덱파이에는 없던 int가 보이고 델파이에있던
__ stdcall 이안보이고 이문제인듯보이눈데
맞나?
|