关于网友提出的“ 急,在MDI窗体的子窗体中调用DLL,使DLL中的窗体嵌在子窗体里什么都好,就是DLL窗体里的按钮快捷键不起作用100分送上”问题疑问,本网通过在网上对“ 急,在MDI窗体的子窗体中调用DLL,使DLL中的窗体嵌在子窗体里什么都好,就是DLL窗体里的按钮快捷键不起作用100分送上”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 急,在MDI窗体的子窗体中调用DLL,使DLL中的窗体嵌在子窗体里什么都好,就是DLL窗体里的按钮快捷键不起作用100分送上
描述: 具体代码是这样的.
Function Tfrm_frame.CreateChildForm(tLibHandle: THandle; tFormHandle: Integer): Boolean;
Var
Child : TMDIChild;
Begin
{ create a new MDI child window }
//showmessage('准备创建窗体');
Child := TMDIChild.Create(self);
Child.CanSize := true;
self.Delay(100);
//指定DLL窗体的父窗体为MDI的子窗体
TForm(tFormHandle).ParentWindow := Child.Handle;
//设置边界
TForm(tFormHandle).BorderStyle := bsNone;
.
.
.
.
.
.
end;
Procedure Tfrm_frame.openModule(dllPath: String);
Var
ModuleCreateProc : TCreateModule;
tmpLibHandle : THandle;
tmpFormHandle : Integer;
showType : Integer; //显示类型,0:模式窗体 1:非模式窗体
c_dllpath : Array[0..255] Of Char;
Begin
StrPCopy(c_dllpath, dllPath);
tmpLibHandle := LoadLibrary(c_dllpath);
If (tmpLibHandle <> 0) Then
Begin
tmpFormHandle := Application.Handle;
ModuleCreateProc := GetProcAddress(tmpLibHandle, 'CreateModule');
ModuleCreateProc(tmpFormHandle, Application);
CreateChildForm(tmpLibHandle, tmpFormHandle, showType);
End
end
解决方案1: http://www.delphibox.com/article.asp?articleid=563
你看一下这个....
解决方案2: 改
//指定DLL窗体的父窗体为MDI的子窗体
TForm(tFormHandle).ParentWindow := Child.Handle;
//设置边界
TForm(tFormHandle).BorderStyle := bsNone;
为
SetWindowLong(TForm(tFormHandle).Handle,GWL_STYLE,GetWindowLong(TForm(tFormHandle).Handle,GWL_STYLE) and not (WS_CAPTION or WS_THICKFRAME));
windows.SetParent(TForm(tFormHandle).Handle,Child.Handle);
试试
以上介绍了“ 急,在MDI窗体的子窗体中调用DLL,使DLL中的窗体嵌在子窗体里什么都好,就是DLL窗体里的按钮快捷键不起作用100分送上”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3593169.html