Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
TScreen, TApplication used in a DLL Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
24-Aug-02
Category
Others
Language
Delphi 2.x
Views
142
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

TScreen, TApplication used in a DLL

Answer:

Each DLL in Delphi maintains its own instance of Application & Screen, your 
DLL-calling application should send the its own Application and Screen values to 
the DLL. The DLL should save and restore its original values.

You should put this code somewhere in your DLL and call the Init() function from 
your application:


1   const
2     SavedApplication: TApplication = nil;
3     SavedScreen: TScreen = nil;
4   
5     // export this procedure and call it after loading the DLL
6   
7   procedure Init(anApplicationHandle, aScreenHandle: LongWord);
8   begin
9     if not Assigned(SavedApplication) then
10    begin
11      SavedApplication := Application;
12      Application := TApplication(anApplicationHandle);
13    end;
14  
15    if not Assigned(SavedScreen) then
16    begin
17      // ....same...
18    end;
19  end;
20  
21  initialization
22  
23  finalization
24    if Assigned(SavedApplication) then
25    begin
26      Application := SavedApplication;
27    end;
28  
29    if Assigned(SavedScreen) then
30    begin
31      // ....same.....
32    end;
33  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC