我猜想,是不是dll此时占用了主程序进程,要让dll窗口和主程序窗口都能响应操作,必须新开线程呢?我还没试过在线程中调用dll窗口。
请各位大大告诉我这是什么原因?
void __fastcall TForm1::ShowDLLaboutClick(TObject *Sender)
{
HINSTANCE ins;
ins = LoadLibrary("./dll/mkabout.dll");
try
{
if(ins == NULL)
throw MyException("Can't Load Library!");
FARPROC proc;
proc = GetProcAddress(ins,"_myAbout"); //一个什么也不做的form
if(proc == NULL)
{
FreeLibrary(ins);
throw MyException("Can't Get Proc Address!");
}
proc();
if(!FreeLibrary(ins))
{
throw MyException("Can't Free!");
}
}
catch (MyException &myException)
{
ShowMessage(myException.test);
}
}