먼저 mfc 로 윈도우의 핸들을 받아서 버튼 컨트롤을 추가하는 dll을 작성하였읍니다.
void attachButton(HWND hwnd){
CWnd *cwnd = CWnd::FromHandle(hwnd);
CButton *bt = new CButton();
bt->Create(L"abt",WS_CHILD|WS_VISIBLE,CRect(20,80,100,120),cwnd,100);
}
그리고 이것을 dll로 만들어서 mfc 상에서는 잘 작동하는듯 했읍니다.
그런데 델파이의 twincontrol을 베이스로 콤포넌트를 제작하면서
이것을 호출하니 에러가 나더군요.
procedure AttachButton(HWnd: Integer); stdcall; external 'testDll.dll' name
'attachButton';
constructor TWinControl1.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Parent := (Owner as TWinControl);
AttachButton(handle);
end;
제 생각엔 어차피 윈도우 핸들만 존재한다면 델파이던지 mfc 던지 상관없이 작동할 줄 알았는데
먼가 작동체계가 다른걸까요?
고수님들의 조언을 구합니다.
|