1.dll子視窗的式樣必須設定為無框(borderstyle:=bsnone;formstyle:=fsnormal)可以在dll.dpr中**控制
2.dll.dpr**
vardllscr: tscreen;
varptr:plongint;
begin
screen := scr;
frmdllform.top :=top;
frmdllform.left:=left;
frmdllform.width :=width;
frmdllform.height:=height;
frmdllform.borderstyle :=bsnone;
frmdllform.formstyle
:=fsnormal;
// frmdllform.show;
//定位好後在呼叫時候顯示可以防止視窗忽閃
result:=frmdllform;
end;
procedure exitdll(reason: integer);
begin
if reason = dll_process_detach then
begin
screen := dllscr;
end;
end;
exports
createdllform;
begin
dllscr := screen;
dllproc := @exitdll;
end.
3.exe.dpr主視窗呼叫**
type
;//都可以
var
frmmain: tfrmmain;
dllform: tform;
implementation
procedure tform1.panel1click(sender:tobject);
vardllhandle: thandle;
dllsub: invokedllform;
begin
dllhandle :=loadlibrary('sysnewsread.dll');
if dllhandle <> 0 then
begin
@dllsub :=getprocaddress(dllhandle, 'createdllform');
if assigned(dllsub) then
begin
if not assigned(dllform) then
begin
setwindowpos(dllform.handle, 0, 0, 0, panel1.width ,panel1.height, swp_nozorder);//可以去掉
dllform.parentwindow:=panel1.handle;//將容器設定為父視窗
windows.setparent(dllform.handle,panel1.handle);
dllform.show;//這裡顯示出視窗
end;
end;
end;
end;
e(varmsg: tagmsg;var handled:boolean);
begin
if assigned(dllform) then
ifisdialogmessage(dllform.handle,msg)thenhandled:=true
;//通過該****dll視窗的訊息。
end;
procedure tform1.panel1enter(sender:tobject);
begin
//將dll視窗設定為前景視窗
setforegroundwindow(dllform.handle);
windows.setfocus(dllform.handle);
end;
procedure tform1.panel1resize(sender:tobject);
begin
if assigned(dllform) then
setwindowpos(dllform.handle, 0, 0,0, panel1.width , panel1.height, swp_nozorder);
end;
DLL中建立視窗
char szclassname mainwclass wndclas wndclass 用描述主視窗的引數填充wndclas 結構 wndclass.cbsize sizeof wndclass wndclass.style cs hredraw cs vredraw wndclass.lpfnw...
DLL宣告的總結
本文 於 http topic.csdn.net u 20090824 13 be972397 bec9 4f7f 910c 83e0d91bcbad.html 有關dll的問題現在資料很多,但是很多人寫dll時經常出現呼叫程式無法找到相關的匯出函式的問題,這裡主要的原因是dll在宣告時出的問題。在...
Python Turtle視窗控制
turtle.bgcolor args 引數args 顏色字串或0 colormode範圍內的三個數字或此類數字的3元組 設定或返回turtlescreen的背景顏色。screen.bgcolor orange screen.bgcolor orange screen.bgcolor 800080 ...