• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

MultiMonitor Form Positions In ActiveX DLL's

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
WoodyJ007
Asked:
WoodyJ007
  • 5
  • 3
  • 2
1 Solution
 
Ivanov_GCommented:

   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
 
WoodyJ007Author Commented:
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
 
Ivanov_GCommented:

   Do you specify the activex form container or just create the forms ...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
WoodyJ007Author Commented:
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
 
geobulCommented:
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
 
Ivanov_GCommented:

   Maybe the form handle ...
0
 
WoodyJ007Author Commented:
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
 
geobulCommented:
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
 
WoodyJ007Author Commented:
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
 
WoodyJ007Author Commented:
I passed in the app handle to the dll in the end.

Thanks
Woody
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now