[問題] BCB 寫視窗 DLL

看板C_and_CPP (C/C++)作者 (鳳梨王)時間16年前 (2009/05/25 14:34), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
最近嘗試 用 BCB 寫DLL 一般的傳值沒有問題,但如果是將 DLL 寫成要呼叫一個視窗出來 程式執行時,就會出現 Acess Violation 已將 dll及 lib檔放到主程式目錄下 呼叫方式為靜態呼叫 以下是我的測試程式 請各位大大幫我看一下 ====== dll.cpp DLL 主體 =============== #include <vcl.h> #include <windows.h> #pragma hdrstop // 被呼叫的視窗 Header File #include "dll1.h" USERES("BCB09052_DLL.res"); USEFORM("dll1.h",dllForm); #pragma argsused BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved) { return 1; } //--------------------------------------------------------------------------- void __declspec(dllexport) __stdcall FormShow(){ TdllForm *f = new TdllForm(NULL); f->ShowModal(); } ===== main.cpp 呼叫 DLL 的程式 ============ #include <vcl.h> #pragma hdrstop #include "main.h" #include "dlldef.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { FormShow(); } //--------------------------------------------------------------------------- -- If you're not have fun in baseball, you miss the point of everything. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.120.152.233
文章代碼(AID): #1A6ZlirS (C_and_CPP)
文章代碼(AID): #1A6ZlirS (C_and_CPP)