Solved

MultiMonitor Form Positions In ActiveX DLL's

Posted on 2004-04-27
10
263 Views
Last Modified: 2010-04-05
Hi Guys,

I have a multi monitor system running XP.  I have a normal application and several ActiveX DLL's which contain forms.

The problem is when I load my application and move it to the other screen when I call a method on my ActiveX DLL the forms they produce appear on the primary monitor and not the monitor of the app that called it.

Obviously if I were to have the forms inside my main application and NOT in the dlls then I could use properties like :

(Position := poScreenCenter and  DefaultMonitor := dmActiveForm)

I could do some nasty stuff like pass the monitor the Dlls should appear on into the DLLs but that seems a bit cack.  Does anyone know a way of doing this automatically?

Cheers
Woody
0
Comment
Question by:WoodyJ007
  • 5
  • 3
  • 2
10 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10927013

   I am not sure If I understand your problem at all. But I had problem with ActiveX forms. The problem was that when I compile the DLL - the variable Self is the form itself, but when I use them in Application - the variable Self is the form that display them. The pre-defied variables Self and Application are transparent...

   Probably you can work with the Form handles ...
0
 

Author Comment

by:WoodyJ007
ID: 10927059
I'll try to explain it better.  

Must have a multimonitor system to replicate.

First create an ActiveX DLL.  Then create an Automation Object (ActiveX) into the same project.

Make a method called ShowMe on the interface and create and display a form (or even just a message box) in the implementation of it.

-

Now create a normal application and put a button on the form.  Import the TLB for the new DLL and in the implmentation of the button click make the call ShowMe on the DLL.

When you run the application click the button.   Now move the application to the other screen and click the button again.  The messagebox/form should appear on the same screen that the calling application is on but it will always appear on the primary monitor.

Hope that is clearer.

Cheers
Woody

ps

I'm using Delphi7
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10927113

   Do you specify the activex form container or just create the forms ...
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:WoodyJ007
ID: 10927131
I'm not creating ActiveX forms.

I'm creating normal forms inside the ActiveX DLL.

To replicate you can use my above post and just use a simple message box instead of a form.
0
 
LVL 17

Accepted Solution

by:
geobul earned 500 total points
ID: 10927830
Hi,

Have you tried passing the Application handle to the dll this way (add Forms to the uses clause):

procedure TMyAutoObj.ShowMe(oApplication: THandle);
begin
  Application.Handle := oApplication;
  with TDllForm1.Create(Application) do begin
    ...

Regards, Geo
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10927981

   Maybe the form handle ...
0
 

Author Comment

by:WoodyJ007
ID: 10928062
Yeah as I said at the top I could pass extra information into the DLL but I'm sure there must be a way of doing it automatically in the DLL itself without needing to pass extra info in.
0
 
LVL 17

Expert Comment

by:geobul
ID: 10929657
Perhaps changing Position property of the DLL forms to poMainFormCenter instead of the default poDesigned during design-time would help. Or/and setting their DefaultMonitor property to dmMainForm also. Can't test that here, just guessing.

Regards, Geo
0
 

Author Comment

by:WoodyJ007
ID: 10929729
I've tried all the usual stuff like that.  Looks like the only way I can do it is to pass info into the DLL or maybe write it to the reg for the dll to pick up.
0
 

Author Comment

by:WoodyJ007
ID: 11792634
I passed in the app handle to the dll in the end.

Thanks
Woody
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LAN or WAN ? 11 89
Create a path if not exists 7 76
How to convert memory stream to PDF file 6 51
CheckListBox usage 3 58
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now